r2076 - in branches/wao-4.0-obsvente: wao-services/src/main/java/fr/ifremer/wao/services/service wao-services/src/test/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web/action wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/fr/ifremer/wao/web/action wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer wao-web/src/main/webapp wao-web/src/main/webapp/WEB-INF/content wao-web/src/main/webapp/WEB-INF/content/obsmer
Author: bleny Date: 2014-06-20 15:56:00 +0200 (Fri, 20 Jun 2014) New Revision: 2076 Url: http://forge.codelutin.com/projects/wao/repository/revisions/2076 Log: refs #4491 boats for obsvente in branch Added: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsList.java branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java branches/wao-4.0-obsvente/wao-services/src/test/java/fr/ifremer/wao/services/service/BoatsServiceTest.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatDetailsAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatsAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatsFilterValuesJsonAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/CancelBoatSelectionAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/ExportBoatsAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/GetBoatContactsCountJsonAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/UpdateBoatElligibilityJsonAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/UpdateBoatInfosJsonAction.java branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/BoatsAction-conversion.properties branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/GetBoatContactsCountJsonAction-conversion.properties branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/boat-details.jsp branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/boats.jsp Removed: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsList.java branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java branches/wao-4.0-obsvente/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerBoatsServiceTest.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsFilterValuesJsonAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CancelBoatSelectionAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ExportBoatsAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SearchBoatJsonAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatElligibilityJsonAction.java branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/BoatsAction-conversion.properties branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction-conversion.properties branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp Modified: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java branches/wao-4.0-obsvente/wao-web/src/main/webapp/endpoints-js.jsp Copied: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsList.java (from rev 2075, branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsList.java) =================================================================== --- branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsList.java (rev 0) +++ branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsList.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,58 @@ +package fr.ifremer.wao.services.service; + +/* + * #%L + * Wao :: Services + * %% + * Copyright (C) 2009 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.wao.entity.Boat; +import org.nuiton.util.pagination.PaginationResult; + +import java.io.Serializable; + +/** + * Created on 4/1/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 4.0 + */ +public class BoatsList implements Serializable { + + private static final long serialVersionUID = 1L; + + protected PaginationResult<Boat> boats; + + protected BoatsFilterValues filterValues; + + public PaginationResult<Boat> getBoats() { + return boats; + } + + public void setBoats(PaginationResult<Boat> boats) { + this.boats = boats; + } + + public BoatsFilterValues getFilterValues() { + return filterValues; + } + + public void setFilterValues(BoatsFilterValues filterValues) { + this.filterValues = filterValues; + } +} Copied: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java (from rev 2075, branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java) =================================================================== --- branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java (rev 0) +++ branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,291 @@ +package fr.ifremer.wao.services.service; + +/* + * #%L + * Wao :: Services + * %% + * Copyright (C) 2009 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.google.common.base.Charsets; +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; +import com.google.common.cache.Cache; +import com.google.common.collect.ImmutableSet; +import fr.ifremer.wao.BoatsFilter; +import fr.ifremer.wao.ContactsFilter; +import fr.ifremer.wao.WaoTechnicalException; +import fr.ifremer.wao.entity.Boat; +import fr.ifremer.wao.entity.BoatInfos; +import fr.ifremer.wao.entity.BoatInfosImpl; +import fr.ifremer.wao.entity.BoatInfosTopiaDao; +import fr.ifremer.wao.entity.BoatTopiaDao; +import fr.ifremer.wao.entity.Company; +import fr.ifremer.wao.entity.Contact; +import fr.ifremer.wao.entity.ContactState; +import fr.ifremer.wao.entity.ContactTopiaDao; +import fr.ifremer.wao.entity.ElligibleBoat; +import fr.ifremer.wao.entity.ElligibleBoatTopiaDao; +import fr.ifremer.wao.entity.ObsProgram; +import fr.ifremer.wao.services.AuthenticatedWaoUser; +import fr.ifremer.wao.services.service.csv.BoatImportExportModel; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.csv.Export; +import org.nuiton.csv.ExportModel; +import org.nuiton.util.pagination.PaginationParameter; +import org.nuiton.util.pagination.PaginationResult; + +import java.io.InputStream; +import java.util.Collection; +import java.util.Date; +import java.util.HashSet; +import java.util.List; + +/** + * Created on 4/1/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 4.0 + */ +public class BoatsService extends WaoServiceSupport { + + /** Logger. */ + private static final Log log = LogFactory.getLog(BoatsService.class); + + public BoatsFilterValues getBoatsFilterValues(AuthenticatedWaoUser authenticatedWaoUser, BoatsFilter filter) { + + Optional<String> optionalCompanyId = Optional.absent(); + if (authenticatedWaoUser.isCoordinatorOrObserver()) { + optionalCompanyId = Optional.of(authenticatedWaoUser.getCompany().getTopiaId()); + } + + BoatsFilterValuesCacheKey boatsFilterValuesCacheKey = + new BoatsFilterValuesCacheKey( + serviceContext.getLocale(), + authenticatedWaoUser.getObsProgram(), + optionalCompanyId); + + Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> cache = + serviceContext.getBoatsFilterValuesCache(); + + BoatsFilterValues boatsFilterValues = cache.getIfPresent(boatsFilterValuesCacheKey); + + if (boatsFilterValues == null) { + + BoatTopiaDao dao = getBoatDao(); + + List<Boat> boats = dao.findAll(filter); + + boatsFilterValues = new BoatsFilterValues(serviceContext.getLocale(), authenticatedWaoUser.getObsProgram(), optionalCompanyId); + + for (Boat boat : boats) { + boatsFilterValues.addBoat(boat); + } + + cache.put(boatsFilterValuesCacheKey, boatsFilterValues); + + } + + return boatsFilterValues; + } + + public BoatsList getBoatsList(AuthenticatedWaoUser authenticatedWaoUser, + BoatsFilter filter, + PaginationParameter pager) { + + BoatTopiaDao dao = getBoatDao(); + + PaginationResult<Boat> boats = dao.find(filter, pager); + + BoatsFilterValues boatsFilterValues = getBoatsFilterValues(authenticatedWaoUser, filter); + + BoatsList boatsList = new BoatsList(); + boatsList.setBoats(boats); + boatsList.setFilterValues(boatsFilterValues); + return boatsList; + } + + public PaginationParameter newBoatsPaginationParameter(int pageNumber, int pageSize) { + PaginationParameter result = PaginationParameter.of(pageNumber, pageSize, Boat.PROPERTY_NAME, false); + return result; + } + + public BoatsFilter newBoatsFilter(AuthenticatedWaoUser authenticatedWaoUser) { + + BoatsFilter boatsFilter = new BoatsFilter(); + + if (authenticatedWaoUser.isProfessional()) { + // Pour le profesionnel, on restreint d'office à la liste des bateaux qu'il peut voir + Collection<String> canReadBoatsTopiaIds = authenticatedWaoUser.getWaoUser().getCanReadBoatsTopiaIds(); + if (CollectionUtils.isEmpty(canReadBoatsTopiaIds)) { + if (log.isWarnEnabled()) { + log.warn("user " + authenticatedWaoUser.getWaoUser() + " is professional but can't read any boat"); + } + } else { + boatsFilter.setBoatIds(new HashSet<>(canReadBoatsTopiaIds)); + } + } + + return boatsFilter; + + } + + public InputStream exportBoats(BoatsFilter filter) { + + BoatTopiaDao dao = getBoatDao(); + + List<Boat> sampleRows = dao.findAll(filter); + + ExportModel<Boat> exportModel = + new BoatImportExportModel(getLocale()); + + Export<Boat> export = Export.newExport(exportModel, sampleRows); + + try { + + String csvContent = export.toString(Charsets.UTF_8); + + InputStream csvInputStream = IOUtils.toInputStream(csvContent, Charsets.UTF_8); + + return csvInputStream; + + } catch (Exception e) { + throw new WaoTechnicalException(e); + } + } + + public BoatDetails getBoatDetails(ObsProgram obsProgram, String boatId, String companyId) { + + BoatInfos boatInfos = getBoatInfos(boatId, companyId); + + Contact mostRecentContact = getContactDao().findMostRecentContactOrNull(obsProgram, boatId, companyId); + + ContactsFilter filter = new ContactsFilter(); + filter.getSampleRowFilter().setObsProgram(obsProgram); + filter.getBoatFilter().setBoatIds(ImmutableSet.of(boatId)); + filter.getSampleRowFilter().setCompanyIds(ImmutableSet.of(companyId)); + long contactsCount = getContactDao().forFilter(filter, false).count(); + + Date now = serviceContext.getNow(); + + BoatDetails boatDetails = new BoatDetails(now, obsProgram, boatInfos, mostRecentContact, contactsCount); + + return boatDetails; + + } + + public BoatInfos getBoatInfos(String boatId, String companyId) { + + BoatInfosTopiaDao dao = getBoatInfosDao(); + + Optional<BoatInfos> optionalBoatInfos = + dao.newQueryBuilder() + .addTopiaIdEquals(BoatInfos.PROPERTY_BOAT, boatId) + .addTopiaIdEquals(BoatInfos.PROPERTY_COMPANY, companyId) + .tryFindUnique(); + + BoatInfos boatInfos; + if (optionalBoatInfos.isPresent()) { + boatInfos = optionalBoatInfos.get(); + } else { + Boat boat = getBoatDao().findByTopiaId(boatId); + Company company = getCompanyDao().findByTopiaId(companyId); + boatInfos = new BoatInfosImpl(); + boatInfos.setBoat(boat); + boatInfos.setCompany(company); + } + + return boatInfos; + + } + + public void saveBoatInfos(BoatInfos boatInfos) { + + BoatInfosTopiaDao dao = getBoatInfosDao(); + + if (boatInfos.isPersisted()) { + dao.update(boatInfos); + } else { + dao.create(boatInfos); + } + + commit(); + + } + + public BoatContactsCounts getBoatContactsCounts(AuthenticatedWaoUser authenticatedWaoUser, String boatId, String companyId, Date since) { + + ContactsFilter filter = new ContactsFilter(); + + filter.getSampleRowFilter().setObsProgram(authenticatedWaoUser.getObsProgram()); + filter.setPeriodFrom(since); + filter.getBoatFilter().setBoatIds(ImmutableSet.of(boatId)); + filter.setFilterOnObservationBeginDate(false); + + ContactTopiaDao dao = getContactDao(); + + long contactsCount = dao.forFilter(filter, false).count(); + + filter.getSampleRowFilter().setCompanyIds(ImmutableSet.of(companyId)); + long contactsCompanyCount = dao.forFilter(filter, false).count(); + + filter.setContactStates(ImmutableSet.of(ContactState.OBSERVATION_DONE)); + long observationsCompanyCount = dao.forFilter(filter, false).count(); + + filter.getSampleRowFilter().setCompanyIds(null); + long observationsCount = dao.forFilter(filter, false).count(); + + Preconditions.checkState(contactsCompanyCount <= contactsCount); + Preconditions.checkState(observationsCount <= contactsCount); + + Preconditions.checkState(observationsCompanyCount <= contactsCompanyCount); + Preconditions.checkState(observationsCompanyCount <= observationsCount); + + return new BoatContactsCounts(contactsCount, observationsCount, contactsCompanyCount, observationsCompanyCount); + + } + + public Collection<Boat> getBoats(BoatsFilter boatsFilter, int pageSize) { + + PaginationParameter pager = newBoatsPaginationParameter(0, pageSize); + + PaginationResult<Boat> boats = getBoatDao().find(boatsFilter, pager); + + return boats.getElements(); + + } + + public void changeBoatElligibility(AuthenticatedWaoUser authenticatedWaoUser, String boatId, String sampleRowId, boolean active) { + + ElligibleBoatTopiaDao dao = getElligibleBoatDao(); + + ElligibleBoat elligibleBoat = dao.forBoatIdAndSampleRowId(boatId, sampleRowId).findUnique(); + + if (authenticatedWaoUser.isAdmin()) { + elligibleBoat.setGlobalActive(active); + } else if (authenticatedWaoUser.isCoordinatorOrObserver()) { + elligibleBoat.setCompanyActive(active); + } else { + throw new IllegalStateException(authenticatedWaoUser.getWaoUser().toString()); + } + + commit(); + } +} Deleted: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsList.java =================================================================== --- branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsList.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsList.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,60 +0,0 @@ -package fr.ifremer.wao.services.service; - -/* - * #%L - * Wao :: Services - * %% - * Copyright (C) 2009 - 2014 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import fr.ifremer.wao.entity.Boat; - -import java.io.Serializable; -import java.util.List; - -import org.nuiton.util.pagination.PaginationResult; - -/** - * Created on 4/1/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 4.0 - */ -public class ObsMerBoatsList implements Serializable { - - private static final long serialVersionUID = 1L; - - protected PaginationResult<Boat> boats; - - protected BoatsFilterValues filterValues; - - public PaginationResult<Boat> getBoats() { - return boats; - } - - public void setBoats(PaginationResult<Boat> boats) { - this.boats = boats; - } - - public BoatsFilterValues getFilterValues() { - return filterValues; - } - - public void setFilterValues(BoatsFilterValues filterValues) { - this.filterValues = filterValues; - } -} Deleted: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java =================================================================== --- branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,291 +0,0 @@ -package fr.ifremer.wao.services.service; - -/* - * #%L - * Wao :: Services - * %% - * Copyright (C) 2009 - 2014 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import com.google.common.base.Charsets; -import com.google.common.base.Optional; -import com.google.common.base.Preconditions; -import com.google.common.cache.Cache; -import com.google.common.collect.ImmutableSet; -import fr.ifremer.wao.BoatsFilter; -import fr.ifremer.wao.ContactsFilter; -import fr.ifremer.wao.WaoTechnicalException; -import fr.ifremer.wao.entity.Boat; -import fr.ifremer.wao.entity.BoatInfos; -import fr.ifremer.wao.entity.BoatInfosImpl; -import fr.ifremer.wao.entity.BoatInfosTopiaDao; -import fr.ifremer.wao.entity.BoatTopiaDao; -import fr.ifremer.wao.entity.Company; -import fr.ifremer.wao.entity.Contact; -import fr.ifremer.wao.entity.ContactState; -import fr.ifremer.wao.entity.ContactTopiaDao; -import fr.ifremer.wao.entity.ElligibleBoat; -import fr.ifremer.wao.entity.ElligibleBoatTopiaDao; -import fr.ifremer.wao.entity.ObsProgram; -import fr.ifremer.wao.services.AuthenticatedWaoUser; -import fr.ifremer.wao.services.service.csv.BoatImportExportModel; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.csv.Export; -import org.nuiton.csv.ExportModel; -import org.nuiton.util.pagination.PaginationParameter; -import org.nuiton.util.pagination.PaginationResult; - -import java.io.InputStream; -import java.util.Collection; -import java.util.Date; -import java.util.HashSet; -import java.util.List; - -/** - * Created on 4/1/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 4.0 - */ -public class ObsMerBoatsService extends WaoServiceSupport { - - /** Logger. */ - private static final Log log = LogFactory.getLog(ObsMerBoatsService.class); - - public BoatsFilterValues getBoatsFilterValues(AuthenticatedWaoUser authenticatedWaoUser, BoatsFilter filter) { - - Optional<String> optionalCompanyId = Optional.absent(); - if (authenticatedWaoUser.isCoordinatorOrObserver()) { - optionalCompanyId = Optional.of(authenticatedWaoUser.getCompany().getTopiaId()); - } - - BoatsFilterValuesCacheKey boatsFilterValuesCacheKey = - new BoatsFilterValuesCacheKey( - serviceContext.getLocale(), - authenticatedWaoUser.getObsProgram(), - optionalCompanyId); - - Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> cache = - serviceContext.getBoatsFilterValuesCache(); - - BoatsFilterValues boatsFilterValues = cache.getIfPresent(boatsFilterValuesCacheKey); - - if (boatsFilterValues == null) { - - BoatTopiaDao dao = getBoatDao(); - - List<Boat> boats = dao.findAll(filter); - - boatsFilterValues = new BoatsFilterValues(serviceContext.getLocale(), authenticatedWaoUser.getObsProgram(), optionalCompanyId); - - for (Boat boat : boats) { - boatsFilterValues.addBoat(boat); - } - - cache.put(boatsFilterValuesCacheKey, boatsFilterValues); - - } - - return boatsFilterValues; - } - - public ObsMerBoatsList getBoatsList(AuthenticatedWaoUser authenticatedWaoUser, - BoatsFilter filter, - PaginationParameter pager) { - - BoatTopiaDao dao = getBoatDao(); - - PaginationResult<Boat> boats = dao.find(filter, pager); - - BoatsFilterValues boatsFilterValues = getBoatsFilterValues(authenticatedWaoUser, filter); - - ObsMerBoatsList obsMerBoatsList = new ObsMerBoatsList(); - obsMerBoatsList.setBoats(boats); - obsMerBoatsList.setFilterValues(boatsFilterValues); - return obsMerBoatsList; - } - - public PaginationParameter newBoatsPaginationParameter(int pageNumber, int pageSize) { - PaginationParameter result = PaginationParameter.of(pageNumber, pageSize, Boat.PROPERTY_NAME, false); - return result; - } - - public BoatsFilter newBoatsFilter(AuthenticatedWaoUser authenticatedWaoUser) { - - BoatsFilter boatsFilter = new BoatsFilter(); - - if (authenticatedWaoUser.isProfessional()) { - // Pour le profesionnel, on restreint d'office à la liste des bateaux qu'il peut voir - Collection<String> canReadBoatsTopiaIds = authenticatedWaoUser.getWaoUser().getCanReadBoatsTopiaIds(); - if (CollectionUtils.isEmpty(canReadBoatsTopiaIds)) { - if (log.isWarnEnabled()) { - log.warn("user " + authenticatedWaoUser.getWaoUser() + " is professional but can't read any boat"); - } - } else { - boatsFilter.setBoatIds(new HashSet<>(canReadBoatsTopiaIds)); - } - } - - return boatsFilter; - - } - - public InputStream exportBoats(BoatsFilter filter) { - - BoatTopiaDao dao = getBoatDao(); - - List<Boat> sampleRows = dao.findAll(filter); - - ExportModel<Boat> exportModel = - new BoatImportExportModel(getLocale()); - - Export<Boat> export = Export.newExport(exportModel, sampleRows); - - try { - - String csvContent = export.toString(Charsets.UTF_8); - - InputStream csvInputStream = IOUtils.toInputStream(csvContent, Charsets.UTF_8); - - return csvInputStream; - - } catch (Exception e) { - throw new WaoTechnicalException(e); - } - } - - public BoatDetails getBoatDetails(ObsProgram obsProgram, String boatId, String companyId) { - - BoatInfos boatInfos = getBoatInfos(boatId, companyId); - - Contact mostRecentContact = getContactDao().findMostRecentContactOrNull(obsProgram, boatId, companyId); - - ContactsFilter filter = new ContactsFilter(); - filter.getSampleRowFilter().setObsProgram(obsProgram); - filter.getBoatFilter().setBoatIds(ImmutableSet.of(boatId)); - filter.getSampleRowFilter().setCompanyIds(ImmutableSet.of(companyId)); - long contactsCount = getContactDao().forFilter(filter, false).count(); - - Date now = serviceContext.getNow(); - - BoatDetails boatDetails = new BoatDetails(now, obsProgram, boatInfos, mostRecentContact, contactsCount); - - return boatDetails; - - } - - public BoatInfos getBoatInfos(String boatId, String companyId) { - - BoatInfosTopiaDao dao = getBoatInfosDao(); - - Optional<BoatInfos> optionalBoatInfos = - dao.newQueryBuilder() - .addTopiaIdEquals(BoatInfos.PROPERTY_BOAT, boatId) - .addTopiaIdEquals(BoatInfos.PROPERTY_COMPANY, companyId) - .tryFindUnique(); - - BoatInfos boatInfos; - if (optionalBoatInfos.isPresent()) { - boatInfos = optionalBoatInfos.get(); - } else { - Boat boat = getBoatDao().findByTopiaId(boatId); - Company company = getCompanyDao().findByTopiaId(companyId); - boatInfos = new BoatInfosImpl(); - boatInfos.setBoat(boat); - boatInfos.setCompany(company); - } - - return boatInfos; - - } - - public void saveBoatInfos(BoatInfos boatInfos) { - - BoatInfosTopiaDao dao = getBoatInfosDao(); - - if (boatInfos.isPersisted()) { - dao.update(boatInfos); - } else { - dao.create(boatInfos); - } - - commit(); - - } - - public BoatContactsCounts getBoatContactsCounts(AuthenticatedWaoUser authenticatedWaoUser, String boatId, String companyId, Date since) { - - ContactsFilter filter = new ContactsFilter(); - - filter.getSampleRowFilter().setObsProgram(authenticatedWaoUser.getObsProgram()); - filter.setPeriodFrom(since); - filter.getBoatFilter().setBoatIds(ImmutableSet.of(boatId)); - filter.setFilterOnObservationBeginDate(false); - - ContactTopiaDao dao = getContactDao(); - - long contactsCount = dao.forFilter(filter, false).count(); - - filter.getSampleRowFilter().setCompanyIds(ImmutableSet.of(companyId)); - long contactsCompanyCount = dao.forFilter(filter, false).count(); - - filter.setContactStates(ImmutableSet.of(ContactState.OBSERVATION_DONE)); - long observationsCompanyCount = dao.forFilter(filter, false).count(); - - filter.getSampleRowFilter().setCompanyIds(null); - long observationsCount = dao.forFilter(filter, false).count(); - - Preconditions.checkState(contactsCompanyCount <= contactsCount); - Preconditions.checkState(observationsCount <= contactsCount); - - Preconditions.checkState(observationsCompanyCount <= contactsCompanyCount); - Preconditions.checkState(observationsCompanyCount <= observationsCount); - - return new BoatContactsCounts(contactsCount, observationsCount, contactsCompanyCount, observationsCompanyCount); - - } - - public Collection<Boat> getBoats(BoatsFilter boatsFilter, int pageSize) { - - PaginationParameter pager = newBoatsPaginationParameter(0, pageSize); - - PaginationResult<Boat> boats = getBoatDao().find(boatsFilter, pager); - - return boats.getElements(); - - } - - public void changeBoatElligibility(AuthenticatedWaoUser authenticatedWaoUser, String boatId, String sampleRowId, boolean active) { - - ElligibleBoatTopiaDao dao = getElligibleBoatDao(); - - ElligibleBoat elligibleBoat = dao.forBoatIdAndSampleRowId(boatId, sampleRowId).findUnique(); - - if (authenticatedWaoUser.isAdmin()) { - elligibleBoat.setGlobalActive(active); - } else if (authenticatedWaoUser.isCoordinatorOrObserver()) { - elligibleBoat.setCompanyActive(active); - } else { - throw new IllegalStateException(authenticatedWaoUser.getWaoUser().toString()); - } - - commit(); - } -} Modified: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java =================================================================== --- branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -71,7 +71,6 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -82,7 +81,6 @@ import org.nuiton.csv.ImportRuntimeException; import org.nuiton.topia.persistence.TopiaEntities; import org.nuiton.topia.persistence.TopiaEntity; -import org.nuiton.util.DateUtil; import java.io.InputStream; import java.text.ParseException; @@ -95,7 +93,7 @@ import java.util.Map; import java.util.Set; -public class ObsMerSamplingPlanService extends WaoServiceSupport { +public class ObsMerSamplingPlanService extends SamplingPlanService { private static final Log log = LogFactory.getLog(ObsMerSamplingPlanService.class); @@ -360,14 +358,6 @@ } - public SampleRow getSampleRow(String sampleRowId) { - - SampleRow sampleRow = getSampleRowDao().findByTopiaId(sampleRowId); - - return sampleRow; - - } - public void commentSampleRow(AuthenticatedWaoUser authenticatedWaoUser, String sampleRowId, String comment) { SampleRow sampleRow = getSampleRow(sampleRowId); @@ -383,14 +373,6 @@ } - public List<SampleRow> getSamplingPlanRows(SampleRowsFilter sampleRowsFilter) { - - SampleRowTopiaDao dao = getSampleRowDao(); - - return dao.findAll(sampleRowsFilter); - - } - public ObsMerSamplingPlan getSamplingPlan( AuthenticatedWaoUser authenticatedWaoUser, SampleRowsFilter sampleRowsFilter) { @@ -459,53 +441,6 @@ } - public SampleRowsFilter newSampleRowsFilter(AuthenticatedWaoUser authenticatedWaoUser) { - - // all users can see only rows for the program they are logged for - SampleRowsFilter newFilter = new SampleRowsFilter(); - newFilter.setObsProgram(authenticatedWaoUser.getObsProgram()); - - // We don't want to see all rows but the ones important for today - Date fromDate = serviceContext.getNow(); - Date toDate = fromDate; - - // Dans ObsMer et ObsVente, le plan est mensualisé - fromDate = DateUtils.truncate(fromDate, Calendar.MONTH); - - // la période initiale doit toujours aller d'avril à mars (contractuel). - // on prend la période dans laquelle on se trouve actuellement - - // si on est avant le premier avril de l'année courante - boolean beforePeriodChangeInCurrentYear = DateUtil.getMonth(fromDate) < 3; - - if (beforePeriodChangeInCurrentYear) { - // on prend la période qui a commencé l'année dernière et qui finit - // cette année - fromDate = DateUtils.setMonths(fromDate, 3); - fromDate = DateUtils.addYears(fromDate, -1); - } else { - // on prend la période qui commence cette année et se termine - // l'année prochaine - fromDate = DateUtils.setMonths(fromDate, 3); - } - - // on a fromDate sur le premier avril de la bonne année, on va - // jusqu'au mois de mars suivant - toDate = DateUtils.addMonths(fromDate, 11); - - newFilter.setPeriodFrom(fromDate); - newFilter.setPeriodTo(toDate); - - // Very very important to do that at beginning - // Evo #2227 : Guest user has no default company filter - if (authenticatedWaoUser.isCoordinatorOrObserver()) { - newFilter.setCompanyIds(Sets.newHashSet(authenticatedWaoUser.getCompany().getTopiaId())); - } - - return newFilter; - - } - public void importSamplingPlan(AuthenticatedWaoUser authenticatedWaoUser, InputStream csv) throws ImportErrorException { ImportModel<SampleRow> samplingPlanImportModel = @@ -794,21 +729,4 @@ } - public List<SampleRow> getUnfinishedSampleRows(AuthenticatedWaoUser authenticatedWaoUser, String companyId) { - - SampleRowsFilter sampleRowsFilter = newSampleRowsFilter(authenticatedWaoUser); - - sampleRowsFilter.setCompanyIds(ImmutableSet.of(companyId)); - - Date now = getNow(); - sampleRowsFilter.setPeriodFrom(now); - // sampleRowsFilter.setPeriodTo(DateUtils.addYears(now, 1)); - - sampleRowsFilter.setOrderByArguments(ImmutableSet.of(SampleRow.PROPERTY_CODE)); - - List<SampleRow> unfinishedSampleRows = getSamplingPlanRows(sampleRowsFilter); - - return unfinishedSampleRows; - - } } Added: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java =================================================================== --- branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java (rev 0) +++ branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,96 @@ +package fr.ifremer.wao.services.service; + +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; +import fr.ifremer.wao.SampleRowsFilter; +import fr.ifremer.wao.entity.SampleRow; +import fr.ifremer.wao.entity.SampleRowTopiaDao; +import fr.ifremer.wao.services.AuthenticatedWaoUser; +import org.apache.commons.lang3.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.DateUtil; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +public class SamplingPlanService extends WaoServiceSupport { + + private static final Log log = LogFactory.getLog(SamplingPlanService.class); + + public SampleRow getSampleRow(String sampleRowId) { + + SampleRow sampleRow = getSampleRowDao().findByTopiaId(sampleRowId); + + return sampleRow; + + } + + public SampleRowsFilter newSampleRowsFilter(AuthenticatedWaoUser authenticatedWaoUser) { + + // all users can see only rows for the program they are logged for + SampleRowsFilter newFilter = new SampleRowsFilter(); + newFilter.setObsProgram(authenticatedWaoUser.getObsProgram()); + + // We don't want to see all rows but the ones important for today + Date fromDate = serviceContext.getNow(); + Date toDate = fromDate; + + // Dans ObsMer et ObsVente, le plan est mensualisé + fromDate = DateUtils.truncate(fromDate, Calendar.MONTH); + + // la période initiale doit toujours aller d'avril à mars (contractuel). + // on prend la période dans laquelle on se trouve actuellement + + // si on est avant le premier avril de l'année courante + boolean beforePeriodChangeInCurrentYear = DateUtil.getMonth(fromDate) < 3; + + if (beforePeriodChangeInCurrentYear) { + // on prend la période qui a commencé l'année dernière et qui finit + // cette année + fromDate = DateUtils.setMonths(fromDate, 3); + fromDate = DateUtils.addYears(fromDate, -1); + } else { + // on prend la période qui commence cette année et se termine + // l'année prochaine + fromDate = DateUtils.setMonths(fromDate, 3); + } + + // on a fromDate sur le premier avril de la bonne année, on va + // jusqu'au mois de mars suivant + toDate = DateUtils.addMonths(fromDate, 11); + + newFilter.setPeriodFrom(fromDate); + newFilter.setPeriodTo(toDate); + + // Very very important to do that at beginning + // Evo #2227 : Guest user has no default company filter + if (authenticatedWaoUser.isCoordinatorOrObserver()) { + newFilter.setCompanyIds(Sets.newHashSet(authenticatedWaoUser.getCompany().getTopiaId())); + } + + return newFilter; + + } + + public List<SampleRow> getUnfinishedSampleRows(AuthenticatedWaoUser authenticatedWaoUser, String companyId) { + + SampleRowsFilter sampleRowsFilter = newSampleRowsFilter(authenticatedWaoUser); + + sampleRowsFilter.setCompanyIds(ImmutableSet.of(companyId)); + + Date now = getNow(); + sampleRowsFilter.setPeriodFrom(now); + // sampleRowsFilter.setPeriodTo(DateUtils.addYears(now, 1)); + + sampleRowsFilter.setOrderByArguments(ImmutableSet.of(SampleRow.PROPERTY_CODE)); + + SampleRowTopiaDao dao = getSampleRowDao(); + + List<SampleRow> unfinishedSampleRows = dao.findAll(sampleRowsFilter); + + return unfinishedSampleRows; + + } +} Copied: branches/wao-4.0-obsvente/wao-services/src/test/java/fr/ifremer/wao/services/service/BoatsServiceTest.java (from rev 2075, branches/wao-4.0-obsvente/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerBoatsServiceTest.java) =================================================================== --- branches/wao-4.0-obsvente/wao-services/src/test/java/fr/ifremer/wao/services/service/BoatsServiceTest.java (rev 0) +++ branches/wao-4.0-obsvente/wao-services/src/test/java/fr/ifremer/wao/services/service/BoatsServiceTest.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,73 @@ +package fr.ifremer.wao.services.service; + +/* + * #%L + * Wao :: Services + * %% + * Copyright (C) 2009 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.wao.BoatsFilter; +import fr.ifremer.wao.services.AbstractWaoServiceTest; +import fr.ifremer.wao.services.ObsMerFixtures; +import org.junit.Before; +import org.junit.Test; +import org.nuiton.util.pagination.PaginationParameter; + +/** + * Created on 4/1/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 4.0 + */ +public class BoatsServiceTest extends AbstractWaoServiceTest { + + protected BoatsService service; + + protected ObsMerFixtures fixtures; + + @Before + public void setUp() { + service = newService(BoatsService.class); + fixtures = new ObsMerFixtures(newServiceContext()); + } + + protected boolean isDatabaseWithReferential() { + return true; + } + + @Test + public void testGetBoatsFilterValues() { + + BoatsFilter filter = service.newBoatsFilter(fixtures.admin()); + + BoatsFilterValues boatsFilterValues = service.getBoatsFilterValues(fixtures.admin(), filter); + + } + + @Test + public void testGetBoatsList() { + + BoatsFilter filter = service.newBoatsFilter(fixtures.admin()); + + PaginationParameter pager = service.newBoatsPaginationParameter(0, 50); + + BoatsList boatsList = service.getBoatsList(fixtures.admin(), filter, pager); + + } + +} \ No newline at end of file Deleted: branches/wao-4.0-obsvente/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerBoatsServiceTest.java =================================================================== --- branches/wao-4.0-obsvente/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerBoatsServiceTest.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerBoatsServiceTest.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,74 +0,0 @@ -package fr.ifremer.wao.services.service; - -/* - * #%L - * Wao :: Services - * %% - * Copyright (C) 2009 - 2014 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import fr.ifremer.wao.BoatsFilter; -import fr.ifremer.wao.services.AbstractWaoServiceTest; -import fr.ifremer.wao.services.ObsMerFixtures; -import org.junit.Before; -import org.junit.Test; -import org.nuiton.topia.persistence.pager.TopiaPagerBean; -import org.nuiton.util.pagination.PaginationParameter; - -/** - * Created on 4/1/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 4.0 - */ -public class ObsMerBoatsServiceTest extends AbstractWaoServiceTest { - - protected ObsMerBoatsService service; - - protected ObsMerFixtures fixtures; - - @Before - public void setUp() { - service = newService(ObsMerBoatsService.class); - fixtures = new ObsMerFixtures(newServiceContext()); - } - - protected boolean isDatabaseWithReferential() { - return true; - } - - @Test - public void testGetBoatsFilterValues() { - - BoatsFilter filter = service.newBoatsFilter(fixtures.admin()); - - BoatsFilterValues boatsFilterValues = service.getBoatsFilterValues(fixtures.admin(), filter); - - } - - @Test - public void testGetBoatsList() { - - BoatsFilter filter = service.newBoatsFilter(fixtures.admin()); - - PaginationParameter pager = service.newBoatsPaginationParameter(0, 50); - - ObsMerBoatsList boatsList = service.getBoatsList(fixtures.admin(), filter, pager); - - } - -} \ No newline at end of file Copied: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatDetailsAction.java (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatDetailsAction.java (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatDetailsAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,98 @@ +package fr.ifremer.wao.web.action; + +/* + * #%L + * Wao :: Web + * %% + * Copyright (C) 2009 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.google.common.base.Preconditions; +import fr.ifremer.wao.entity.SampleRow; +import fr.ifremer.wao.services.service.BoatDetails; +import fr.ifremer.wao.services.service.BoatsService; +import fr.ifremer.wao.services.service.SamplingPlanService; +import fr.ifremer.wao.web.WaoJspActionSupport; + +import java.util.List; + +public class BoatDetailsAction extends WaoJspActionSupport { + + private static final long serialVersionUID = 1L; + + protected transient BoatsService service; + + protected transient SamplingPlanService samplingPlanService; + + protected String companyId; + + protected String boatId; + + protected BoatDetails boatDetails; + + protected SampleRow startBoatSelectionForSampleRow; + + private List<SampleRow> sampleRowsToSetElligible; + + public void setService(BoatsService service) { + this.service = service; + } + + public void setSamplingPlanService(SamplingPlanService samplingPlanService) { + this.samplingPlanService = samplingPlanService; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public void setBoatId(String boatId) { + this.boatId = boatId; + } + + @Override + public String execute() { + + Preconditions.checkState(getAuthenticatedWaoUser().isAuthorizedToViewBoatDetails(companyId)); + + boatDetails = service.getBoatDetails(getObsProgram(), boatId, companyId); + + String startBoatSelectionForSampleRowId = session.getStartBoatSelectionForSampleRowId(); + + if (startBoatSelectionForSampleRowId != null) { + startBoatSelectionForSampleRow = samplingPlanService.getSampleRow(startBoatSelectionForSampleRowId); + } + + // TODO brendan 14/04/14 really useful ? + sampleRowsToSetElligible = samplingPlanService.getUnfinishedSampleRows(getAuthenticatedWaoUser(), companyId); + + return SUCCESS; + + } + + public BoatDetails getBoatDetails() { + return boatDetails; + } + + public SampleRow getStartBoatSelectionForSampleRow() { + return startBoatSelectionForSampleRow; + } + + public List<SampleRow> getSampleRowsToSetElligible() { + return sampleRowsToSetElligible; + } +} Copied: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatsAction.java (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatsAction.java (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatsAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,192 @@ +package fr.ifremer.wao.web.action; + +/* + * #%L + * Wao :: Web + * %% + * Copyright (C) 2009 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.google.common.base.Objects; +import com.opensymphony.xwork2.Preparable; +import fr.ifremer.wao.BoatsFilter; +import fr.ifremer.wao.entity.Boat; +import fr.ifremer.wao.entity.Company; +import fr.ifremer.wao.entity.SampleRow; +import fr.ifremer.wao.services.service.BoatsFilterValues; +import fr.ifremer.wao.services.service.BoatsList; +import fr.ifremer.wao.services.service.BoatsService; +import fr.ifremer.wao.services.service.SamplingPlanService; +import fr.ifremer.wao.services.service.administration.CompaniesService; +import fr.ifremer.wao.web.WaoJspActionSupport; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.pagination.PaginationParameter; +import org.nuiton.util.pagination.PaginationResult; + +import java.util.List; + +/** + * Created on 4/1/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 4.0 + */ +public class BoatsAction extends WaoJspActionSupport implements Preparable { + + private static final long serialVersionUID = 1L; + + private static final Log log = LogFactory.getLog(BoatsAction.class); + + protected transient BoatsService service; + + protected transient CompaniesService companiesService; + + protected transient SamplingPlanService samplingPlanService; + + protected int pageNumber; // 1-based page number + + protected long firstRangePage; + + protected long lastRangePage; + + /** + * Boats filter. + */ + protected BoatsFilter filter; + + /** + * List of boats according to the input pager and filter. + */ + protected BoatsList boatList; + + protected String startBoatSelectionForSampleRowId; + + protected SampleRow startBoatSelectionForSampleRow; + + public void setService(BoatsService service) { + this.service = service; + } + + public BoatsFilter getFilter() { + if (filter == null) { + prepare(); + } + return filter; + } + + public List<Boat> getBoats() { + return boatList.getBoats().getElements(); + } + + public BoatsFilterValues getFilterValues() { + return boatList.getFilterValues(); + } + + public PaginationResult<Boat> getPagination() { + return boatList.getBoats(); + } + + public void setStartBoatSelectionForSampleRowId(String startBoatSelectionForSampleRowId) { + this.startBoatSelectionForSampleRowId = startBoatSelectionForSampleRowId; + } + + public void setSamplingPlanService(SamplingPlanService samplingPlanService) { + this.samplingPlanService = samplingPlanService; + } + + public void setCompaniesService(CompaniesService companiesService) { + this.companiesService = companiesService; + } + + public void setPageNumber(int pageNumber) { + this.pageNumber = pageNumber; + } + + @Override + public void prepare() { + + if (filter == null) { + filter = service.newBoatsFilter(getAuthenticatedWaoUser()); + } + + if (StringUtils.isNotBlank(startBoatSelectionForSampleRowId)) { + + session.setStartBoatSelectionForSampleRowId(startBoatSelectionForSampleRowId); + + if (log.isInfoEnabled()) { + log.info("user " + getAuthenticatedWaoUser().getWaoUser() + " is starting to select a boat for sample row " + startBoatSelectionForSampleRow); + } + + } + + if (session.getStartBoatSelectionForSampleRowId() != null) { + + startBoatSelectionForSampleRow = samplingPlanService.getSampleRow(session.getStartBoatSelectionForSampleRowId()); + + } + + } + + @Override + public String execute() { + + filter = Objects.firstNonNull(session.getBoatsFilter(), filter); + + return applyFilter(); + + } + + public String resetFilter() { + + filter = service.newBoatsFilter(getAuthenticatedWaoUser()); + + return applyFilter(); + + } + + public String applyFilter() { + + getSession().setBoatsFilter(filter); + + PaginationParameter pager = service.newBoatsPaginationParameter(pageNumber, 25); + boatList = service.getBoatsList(getAuthenticatedWaoUser(), filter, pager); + + firstRangePage = getPaginationFirstPage(boatList.getBoats(), 10); + lastRangePage = getPaginationLastPage(boatList.getBoats(), 10, firstRangePage); + + return SUCCESS; + + } + + public SampleRow getStartBoatSelectionForSampleRow() { + return startBoatSelectionForSampleRow; + } + + public List<Company> getAllCompanies() { + return companiesService.getAllCompanies(); + } + + public long getFirstRangePage() { + return firstRangePage; + } + + public long getLastRangePage() { + return lastRangePage; + } +} Copied: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatsFilterValuesJsonAction.java (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsFilterValuesJsonAction.java) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatsFilterValuesJsonAction.java (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/BoatsFilterValuesJsonAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,90 @@ +package fr.ifremer.wao.web.action; + +/* + * #%L + * Wao :: Web + * %% + * Copyright (C) 2009 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.opensymphony.xwork2.Preparable; +import fr.ifremer.wao.BoatsFilter; +import fr.ifremer.wao.services.service.BoatsFilterValues; +import fr.ifremer.wao.services.service.BoatsService; +import fr.ifremer.wao.web.WaoJsonActionSupport; +import org.apache.commons.lang3.StringUtils; + +/** + * Created on 4/1/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 4.0 + */ +public class BoatsFilterValuesJsonAction extends WaoJsonActionSupport implements Preparable { + + private static final long serialVersionUID = 1L; + + protected transient BoatsService service; + + protected BoatsFilter filter; + + protected BoatsFilterValues filterValues; + + protected String filterValuesField; + + public void setService(BoatsService service) { + this.service = service; + } + + public void setFilterValuesField(String filterValuesField) { + this.filterValuesField = filterValuesField; + } + + public BoatsFilter getFilter() { + if (filter == null) { + prepare(); + } + return filter; + } + + @Override + public void prepare() { + + filter = service.newBoatsFilter(session.getAuthenticatedWaoUser()); + } + + @Override + public String execute() { + + filterValues = service.getBoatsFilterValues(session.getAuthenticatedWaoUser(), filter); + + if (StringUtils.isNotBlank(filterValuesField)) { + + // le client ne demande qu'un seul champ, on peut éviter de retourner l'objet complet + + filterValues = filterValues.getCopyWithSingleProperty(filterValuesField); + + } + + return SUCCESS; + } + + public BoatsFilterValues getFilterValues() { + return filterValues; + } + +} \ No newline at end of file Copied: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/CancelBoatSelectionAction.java (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CancelBoatSelectionAction.java) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/CancelBoatSelectionAction.java (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/CancelBoatSelectionAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,22 @@ +package fr.ifremer.wao.web.action; + +import fr.ifremer.wao.web.WaoJspActionSupport; +import org.apache.struts2.convention.annotation.Result; +import org.apache.struts2.convention.annotation.Results; + + +@Results({ + @Result(name="success", type="redirectAction", params = { "actionName", "boats" }) +}) +public class CancelBoatSelectionAction extends WaoJspActionSupport { + + @Override + public String execute() { + + session.setStartBoatSelectionForSampleRowId(null); + + return SUCCESS; + + } + +} Copied: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/ExportBoatsAction.java (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ExportBoatsAction.java) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/ExportBoatsAction.java (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/ExportBoatsAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,77 @@ +package fr.ifremer.wao.web.action; + +/* + * #%L + * Wao :: Web + * %% + * Copyright (C) 2009 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.opensymphony.xwork2.Preparable; +import fr.ifremer.wao.BoatsFilter; +import fr.ifremer.wao.services.service.BoatsService; + +import java.io.InputStream; +import java.util.Date; + +/** + * Created on 4/1/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 4.0 + */ +public class ExportBoatsAction extends AbstractDownloadCsvAction implements Preparable { + + private static final long serialVersionUID = 1L; + + protected transient BoatsService service; + + protected BoatsFilter filter; + + public void setService(BoatsService service) { + this.service = service; + } + + public BoatsFilter getFilter() { + if (filter == null) { + prepare(); + } + return filter; + } + + @Override + public void prepare() { + + filter = service.newBoatsFilter(getAuthenticatedWaoUser()); + + } + + @Override + public String getFileName() { + + return "boats_" + getObsProgram().name() + "_" + dateFormat.format(new Date()) + ".csv"; + + } + + @Override + public InputStream getInputStream() { + + return service.exportBoats(filter); + + } + +} \ No newline at end of file Copied: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/GetBoatContactsCountJsonAction.java (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction.java) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/GetBoatContactsCountJsonAction.java (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/GetBoatContactsCountJsonAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,50 @@ +package fr.ifremer.wao.web.action; + +import fr.ifremer.wao.services.service.BoatContactsCounts; +import fr.ifremer.wao.services.service.BoatsService; +import fr.ifremer.wao.web.WaoJsonActionSupport; + +import java.util.Date; + +public class GetBoatContactsCountJsonAction extends WaoJsonActionSupport { + + protected Date since; + + protected BoatsService service; + + protected String boatId; + + protected String companyId; + + protected BoatContactsCounts boatContactsCounts; + + public void setSince(Date since) { + this.since = since; + } + + public void setService(BoatsService service) { + this.service = service; + } + + public void setBoatId(String boatId) { + this.boatId = boatId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + @Override + public String execute() { + + boatContactsCounts = service.getBoatContactsCounts(session.getAuthenticatedWaoUser(), boatId, companyId, since); + + return SUCCESS; + + } + + public BoatContactsCounts getBoatContactsCounts() { + return boatContactsCounts; + } + +} Copied: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/UpdateBoatElligibilityJsonAction.java (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatElligibilityJsonAction.java) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/UpdateBoatElligibilityJsonAction.java (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/UpdateBoatElligibilityJsonAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,39 @@ +package fr.ifremer.wao.web.action; + +import fr.ifremer.wao.services.service.BoatsService; +import fr.ifremer.wao.web.WaoJsonActionSupport; + +public class UpdateBoatElligibilityJsonAction extends WaoJsonActionSupport { + + protected BoatsService service; + + protected String boatId; + + protected String sampleRowId; + + protected boolean active; + + public void setService(BoatsService service) { + this.service = service; + } + + public void setActive(boolean active) { + this.active = active; + } + + public void setBoatId(String boatId) { + this.boatId = boatId; + } + + public void setSampleRowId(String sampleRowId) { + this.sampleRowId = sampleRowId; + } + + @Override + public String execute() { + + service.changeBoatElligibility(session.getAuthenticatedWaoUser(), boatId, sampleRowId, active); + + return SUCCESS; + } +} Copied: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/UpdateBoatInfosJsonAction.java (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/UpdateBoatInfosJsonAction.java (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/UpdateBoatInfosJsonAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,59 @@ +package fr.ifremer.wao.web.action; + +import com.google.common.base.Preconditions; +import com.opensymphony.xwork2.Preparable; +import fr.ifremer.wao.entity.BoatInfos; +import fr.ifremer.wao.services.service.BoatsService; +import fr.ifremer.wao.web.WaoJsonActionSupport; + +public class UpdateBoatInfosJsonAction extends WaoJsonActionSupport implements Preparable { + + private static final long serialVersionUID = 1L; + + protected transient BoatsService service; + + protected String companyId; + + protected String boatId; + + protected BoatInfos boatInfos; + + public void setService(BoatsService service) { + this.service = service; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public void setBoatId(String boatId) { + this.boatId = boatId; + } + + @Override + public void prepare() { + + Preconditions.checkState(session.getAuthenticatedWaoUser().isAuthorizedToViewBoatDetails(companyId)); + + boatInfos = service.getBoatInfos(boatId, companyId); + + } + + public BoatInfos getBoatInfos() { + return boatInfos; + } + + public void setBoatInfos(BoatInfos boatInfos) { + this.boatInfos = boatInfos; + } + + @Override + public String execute() { + + service.saveBoatInfos(boatInfos); + + return SUCCESS; + + } + +} Deleted: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,98 +0,0 @@ -package fr.ifremer.wao.web.action.obsmer; - -/* - * #%L - * Wao :: Web - * %% - * Copyright (C) 2009 - 2014 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import com.google.common.base.Preconditions; -import fr.ifremer.wao.entity.SampleRow; -import fr.ifremer.wao.services.service.BoatDetails; -import fr.ifremer.wao.services.service.ObsMerBoatsService; -import fr.ifremer.wao.services.service.ObsMerSamplingPlanService; -import fr.ifremer.wao.web.WaoJspActionSupport; - -import java.util.List; - -public class BoatDetailsAction extends WaoJspActionSupport { - - private static final long serialVersionUID = 1L; - - protected transient ObsMerBoatsService service; - - protected transient ObsMerSamplingPlanService obsMerSamplingPlanService; - - protected String companyId; - - protected String boatId; - - protected BoatDetails boatDetails; - - protected SampleRow startBoatSelectionForSampleRow; - - private List<SampleRow> sampleRowsToSetElligible; - - public void setService(ObsMerBoatsService service) { - this.service = service; - } - - public void setObsMerSamplingPlanService(ObsMerSamplingPlanService obsMerSamplingPlanService) { - this.obsMerSamplingPlanService = obsMerSamplingPlanService; - } - - public void setCompanyId(String companyId) { - this.companyId = companyId; - } - - public void setBoatId(String boatId) { - this.boatId = boatId; - } - - @Override - public String execute() { - - Preconditions.checkState(getAuthenticatedWaoUser().isAuthorizedToViewBoatDetails(companyId)); - - boatDetails = service.getBoatDetails(getObsProgram(), boatId, companyId); - - String startBoatSelectionForSampleRowId = session.getStartBoatSelectionForSampleRowId(); - - if (startBoatSelectionForSampleRowId != null) { - startBoatSelectionForSampleRow = obsMerSamplingPlanService.getSampleRow(startBoatSelectionForSampleRowId); - } - - // TODO brendan 14/04/14 really useful ? - sampleRowsToSetElligible = obsMerSamplingPlanService.getUnfinishedSampleRows(getAuthenticatedWaoUser(), companyId); - - return SUCCESS; - - } - - public BoatDetails getBoatDetails() { - return boatDetails; - } - - public SampleRow getStartBoatSelectionForSampleRow() { - return startBoatSelectionForSampleRow; - } - - public List<SampleRow> getSampleRowsToSetElligible() { - return sampleRowsToSetElligible; - } -} Deleted: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,192 +0,0 @@ -package fr.ifremer.wao.web.action.obsmer; - -/* - * #%L - * Wao :: Web - * %% - * Copyright (C) 2009 - 2014 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import com.google.common.base.Objects; -import com.opensymphony.xwork2.Preparable; -import fr.ifremer.wao.BoatsFilter; -import fr.ifremer.wao.entity.Boat; -import fr.ifremer.wao.entity.Company; -import fr.ifremer.wao.entity.SampleRow; -import fr.ifremer.wao.services.service.BoatsFilterValues; -import fr.ifremer.wao.services.service.ObsMerBoatsList; -import fr.ifremer.wao.services.service.ObsMerBoatsService; -import fr.ifremer.wao.services.service.ObsMerSamplingPlanService; -import fr.ifremer.wao.services.service.administration.CompaniesService; -import fr.ifremer.wao.web.WaoJspActionSupport; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.pagination.PaginationParameter; -import org.nuiton.util.pagination.PaginationResult; - -import java.util.List; - -/** - * Created on 4/1/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 4.0 - */ -public class BoatsAction extends WaoJspActionSupport implements Preparable { - - private static final long serialVersionUID = 1L; - - private static final Log log = LogFactory.getLog(BoatsAction.class); - - protected transient ObsMerBoatsService service; - - protected transient CompaniesService companiesService; - - protected transient ObsMerSamplingPlanService obsMerSamplingPlanService; - - protected int pageNumber; // 1-based page number - - protected long firstRangePage; - - protected long lastRangePage; - - /** - * Boats filter. - */ - protected BoatsFilter filter; - - /** - * List of boats according to the input pager and filter. - */ - protected ObsMerBoatsList boatList; - - protected String startBoatSelectionForSampleRowId; - - protected SampleRow startBoatSelectionForSampleRow; - - public void setService(ObsMerBoatsService service) { - this.service = service; - } - - public BoatsFilter getFilter() { - if (filter == null) { - prepare(); - } - return filter; - } - - public List<Boat> getBoats() { - return boatList.getBoats().getElements(); - } - - public BoatsFilterValues getFilterValues() { - return boatList.getFilterValues(); - } - - public PaginationResult<Boat> getPagination() { - return boatList.getBoats(); - } - - public void setStartBoatSelectionForSampleRowId(String startBoatSelectionForSampleRowId) { - this.startBoatSelectionForSampleRowId = startBoatSelectionForSampleRowId; - } - - public void setObsMerSamplingPlanService(ObsMerSamplingPlanService obsMerSamplingPlanService) { - this.obsMerSamplingPlanService = obsMerSamplingPlanService; - } - - public void setCompaniesService(CompaniesService companiesService) { - this.companiesService = companiesService; - } - - public void setPageNumber(int pageNumber) { - this.pageNumber = pageNumber; - } - - @Override - public void prepare() { - - if (filter == null) { - filter = service.newBoatsFilter(getAuthenticatedWaoUser()); - } - - if (StringUtils.isNotBlank(startBoatSelectionForSampleRowId)) { - - session.setStartBoatSelectionForSampleRowId(startBoatSelectionForSampleRowId); - - if (log.isInfoEnabled()) { - log.info("user " + getAuthenticatedWaoUser().getWaoUser() + " is starting to select a boat for sample row " + startBoatSelectionForSampleRow); - } - - } - - if (session.getStartBoatSelectionForSampleRowId() != null) { - - startBoatSelectionForSampleRow = obsMerSamplingPlanService.getSampleRow(session.getStartBoatSelectionForSampleRowId()); - - } - - } - - @Override - public String execute() { - - filter = Objects.firstNonNull(session.getBoatsFilter(), filter); - - return applyFilter(); - - } - - public String resetFilter() { - - filter = service.newBoatsFilter(getAuthenticatedWaoUser()); - - return applyFilter(); - - } - - public String applyFilter() { - - getSession().setBoatsFilter(filter); - - PaginationParameter pager = service.newBoatsPaginationParameter(pageNumber, 25); - boatList = service.getBoatsList(getAuthenticatedWaoUser(), filter, pager); - - firstRangePage = getPaginationFirstPage(boatList.getBoats(), 10); - lastRangePage = getPaginationLastPage(boatList.getBoats(), 10, firstRangePage); - - return SUCCESS; - - } - - public SampleRow getStartBoatSelectionForSampleRow() { - return startBoatSelectionForSampleRow; - } - - public List<Company> getAllCompanies() { - return companiesService.getAllCompanies(); - } - - public long getFirstRangePage() { - return firstRangePage; - } - - public long getLastRangePage() { - return lastRangePage; - } -} Deleted: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsFilterValuesJsonAction.java =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsFilterValuesJsonAction.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsFilterValuesJsonAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,90 +0,0 @@ -package fr.ifremer.wao.web.action.obsmer; - -/* - * #%L - * Wao :: Web - * %% - * Copyright (C) 2009 - 2014 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import com.opensymphony.xwork2.Preparable; -import fr.ifremer.wao.BoatsFilter; -import fr.ifremer.wao.services.service.BoatsFilterValues; -import fr.ifremer.wao.services.service.ObsMerBoatsService; -import fr.ifremer.wao.web.WaoJsonActionSupport; -import org.apache.commons.lang3.StringUtils; - -/** - * Created on 4/1/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 4.0 - */ -public class BoatsFilterValuesJsonAction extends WaoJsonActionSupport implements Preparable { - - private static final long serialVersionUID = 1L; - - protected transient ObsMerBoatsService service; - - protected BoatsFilter filter; - - protected BoatsFilterValues filterValues; - - protected String filterValuesField; - - public void setService(ObsMerBoatsService service) { - this.service = service; - } - - public void setFilterValuesField(String filterValuesField) { - this.filterValuesField = filterValuesField; - } - - public BoatsFilter getFilter() { - if (filter == null) { - prepare(); - } - return filter; - } - - @Override - public void prepare() { - - filter = service.newBoatsFilter(session.getAuthenticatedWaoUser()); - } - - @Override - public String execute() { - - filterValues = service.getBoatsFilterValues(session.getAuthenticatedWaoUser(), filter); - - if (StringUtils.isNotBlank(filterValuesField)) { - - // le client ne demande qu'un seul champ, on peut éviter de retourner l'objet complet - - filterValues = filterValues.getCopyWithSingleProperty(filterValuesField); - - } - - return SUCCESS; - } - - public BoatsFilterValues getFilterValues() { - return filterValues; - } - -} \ No newline at end of file Deleted: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CancelBoatSelectionAction.java =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CancelBoatSelectionAction.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CancelBoatSelectionAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,22 +0,0 @@ -package fr.ifremer.wao.web.action.obsmer; - -import fr.ifremer.wao.web.WaoJspActionSupport; -import org.apache.struts2.convention.annotation.Result; -import org.apache.struts2.convention.annotation.Results; - - -@Results({ - @Result(name="success", type="redirectAction", params = { "actionName", "boats" }) -}) -public class CancelBoatSelectionAction extends WaoJspActionSupport { - - @Override - public String execute() { - - session.setStartBoatSelectionForSampleRowId(null); - - return SUCCESS; - - } - -} Deleted: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ExportBoatsAction.java =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ExportBoatsAction.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ExportBoatsAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,78 +0,0 @@ -package fr.ifremer.wao.web.action.obsmer; - -/* - * #%L - * Wao :: Web - * %% - * Copyright (C) 2009 - 2014 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import com.opensymphony.xwork2.Preparable; -import fr.ifremer.wao.BoatsFilter; -import fr.ifremer.wao.services.service.ObsMerBoatsService; -import fr.ifremer.wao.web.action.AbstractDownloadCsvAction; - -import java.io.InputStream; -import java.util.Date; - -/** - * Created on 4/1/14. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 4.0 - */ -public class ExportBoatsAction extends AbstractDownloadCsvAction implements Preparable { - - private static final long serialVersionUID = 1L; - - protected transient ObsMerBoatsService service; - - protected BoatsFilter filter; - - public void setService(ObsMerBoatsService service) { - this.service = service; - } - - public BoatsFilter getFilter() { - if (filter == null) { - prepare(); - } - return filter; - } - - @Override - public void prepare() { - - filter = service.newBoatsFilter(getAuthenticatedWaoUser()); - - } - - @Override - public String getFileName() { - - return "boats_" + getObsProgram().name() + "_" + dateFormat.format(new Date()) + ".csv"; - - } - - @Override - public InputStream getInputStream() { - - return service.exportBoats(filter); - - } - -} \ No newline at end of file Deleted: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction.java =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,50 +0,0 @@ -package fr.ifremer.wao.web.action.obsmer; - -import fr.ifremer.wao.services.service.BoatContactsCounts; -import fr.ifremer.wao.services.service.ObsMerBoatsService; -import fr.ifremer.wao.web.WaoJsonActionSupport; - -import java.util.Date; - -public class GetBoatContactsCountJsonAction extends WaoJsonActionSupport { - - protected Date since; - - protected ObsMerBoatsService service; - - protected String boatId; - - protected String companyId; - - protected BoatContactsCounts boatContactsCounts; - - public void setSince(Date since) { - this.since = since; - } - - public void setService(ObsMerBoatsService service) { - this.service = service; - } - - public void setBoatId(String boatId) { - this.boatId = boatId; - } - - public void setCompanyId(String companyId) { - this.companyId = companyId; - } - - @Override - public String execute() { - - boatContactsCounts = service.getBoatContactsCounts(session.getAuthenticatedWaoUser(), boatId, companyId, since); - - return SUCCESS; - - } - - public BoatContactsCounts getBoatContactsCounts() { - return boatContactsCounts; - } - -} Deleted: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SearchBoatJsonAction.java =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SearchBoatJsonAction.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SearchBoatJsonAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,71 +0,0 @@ -package fr.ifremer.wao.web.action.obsmer; - -import com.google.common.base.Function; -import com.google.common.collect.Collections2; -import com.opensymphony.xwork2.Preparable; -import fr.ifremer.wao.BoatsFilter; -import fr.ifremer.wao.entity.Boat; -import fr.ifremer.wao.services.service.FilterOption; -import fr.ifremer.wao.services.service.ObsMerBoatsService; -import fr.ifremer.wao.web.WaoJsonActionSupport; - -import java.util.Collection; - -public class SearchBoatJsonAction extends WaoJsonActionSupport implements Preparable { - - protected static final Function<Boat, FilterOption> BOAT_TO_FILTER_OPTION_FUNCTION = new Function<Boat, FilterOption>() { - - @Override - public FilterOption apply(Boat boat) { - String value = boat.getTopiaId(); - String label = boat.getImmatriculation() + " " + boat.getName(); - return FilterOption.forValueAndLabel(value, label); - } - }; - - protected ObsMerBoatsService service; - - protected BoatsFilter filter; - - protected int pageSize; - - protected Collection<FilterOption> boatFilterOptions; - - public void setService(ObsMerBoatsService service) { - this.service = service; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public BoatsFilter getFilter() { - if (filter == null) { - prepare(); - } - return filter; - } - - @Override - public void prepare() { - - filter = service.newBoatsFilter(session.getAuthenticatedWaoUser()); - - } - - @Override - public String execute() { - - Collection<Boat> boats = service.getBoats(filter, pageSize); - - boatFilterOptions = Collections2.transform(boats, BOAT_TO_FILTER_OPTION_FUNCTION); - - return SUCCESS; - - } - - public Collection<FilterOption> getBoatFilterOptions() { - return boatFilterOptions; - } - -} Deleted: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatElligibilityJsonAction.java =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatElligibilityJsonAction.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatElligibilityJsonAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,39 +0,0 @@ -package fr.ifremer.wao.web.action.obsmer; - -import fr.ifremer.wao.services.service.ObsMerBoatsService; -import fr.ifremer.wao.web.WaoJsonActionSupport; - -public class UpdateBoatElligibilityJsonAction extends WaoJsonActionSupport { - - protected ObsMerBoatsService service; - - protected String boatId; - - protected String sampleRowId; - - protected boolean active; - - public void setService(ObsMerBoatsService service) { - this.service = service; - } - - public void setActive(boolean active) { - this.active = active; - } - - public void setBoatId(String boatId) { - this.boatId = boatId; - } - - public void setSampleRowId(String sampleRowId) { - this.sampleRowId = sampleRowId; - } - - @Override - public String execute() { - - service.changeBoatElligibility(session.getAuthenticatedWaoUser(), boatId, sampleRowId, active); - - return SUCCESS; - } -} Deleted: branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,59 +0,0 @@ -package fr.ifremer.wao.web.action.obsmer; - -import com.google.common.base.Preconditions; -import com.opensymphony.xwork2.Preparable; -import fr.ifremer.wao.entity.BoatInfos; -import fr.ifremer.wao.services.service.ObsMerBoatsService; -import fr.ifremer.wao.web.WaoJsonActionSupport; - -public class UpdateBoatInfosJsonAction extends WaoJsonActionSupport implements Preparable { - - private static final long serialVersionUID = 1L; - - protected transient ObsMerBoatsService service; - - protected String companyId; - - protected String boatId; - - protected BoatInfos boatInfos; - - public void setService(ObsMerBoatsService service) { - this.service = service; - } - - public void setCompanyId(String companyId) { - this.companyId = companyId; - } - - public void setBoatId(String boatId) { - this.boatId = boatId; - } - - @Override - public void prepare() { - - Preconditions.checkState(session.getAuthenticatedWaoUser().isAuthorizedToViewBoatDetails(companyId)); - - boatInfos = service.getBoatInfos(boatId, companyId); - - } - - public BoatInfos getBoatInfos() { - return boatInfos; - } - - public void setBoatInfos(BoatInfos boatInfos) { - this.boatInfos = boatInfos; - } - - @Override - public String execute() { - - service.saveBoatInfos(boatInfos); - - return SUCCESS; - - } - -} Copied: branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/BoatsAction-conversion.properties (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/BoatsAction-conversion.properties) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/BoatsAction-conversion.properties (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/BoatsAction-conversion.properties 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1 @@ +filter=org.nuiton.web.struts2.converters.JsonConverter Copied: branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/GetBoatContactsCountJsonAction-conversion.properties (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction-conversion.properties) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/GetBoatContactsCountJsonAction-conversion.properties (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/GetBoatContactsCountJsonAction-conversion.properties 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1 @@ +since=fr.ifremer.wao.web.converter.DateConverter Deleted: branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/BoatsAction-conversion.properties =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/BoatsAction-conversion.properties 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/BoatsAction-conversion.properties 2014-06-20 13:56:00 UTC (rev 2076) @@ -1 +0,0 @@ -filter=org.nuiton.web.struts2.converters.JsonConverter Deleted: branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction-conversion.properties =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction-conversion.properties 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/resources/fr/ifremer/wao/web/action/obsmer/GetBoatContactsCountJsonAction-conversion.properties 2014-06-20 13:56:00 UTC (rev 2076) @@ -1 +0,0 @@ -since=fr.ifremer.wao.web.converter.DateConverter Copied: branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/boat-details.jsp (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/boat-details.jsp (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/boat-details.jsp 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,402 @@ +<%-- + #%L + Wao :: Web + %% + Copyright (C) 2009 - 2014 Ifremer + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> +<%@taglib uri="/struts-tags" prefix="s" %> + +<script> + $(document).ready(function () { + + // le formulaire concernant l'interlocuteur + + var $boatInfosForm = $('#boat-infos-form'); + var $saveBoatInfosButton = $('#save-boat-infos'); + var $unlockBoatInfosFormButton = $('#unlock-boat-infos-form'); + + $saveBoatInfosButton.click(function () { + $boatInfosForm.find('input, textarea').attr('readonly', 'readonly'); + $saveBoatInfosButton.attr('disabled', 'disabled'); + $unlockBoatInfosFormButton.removeAttr('disabled'); + var data = WAO.toData($boatInfosForm); + var successCallback = function () { + WAO.notifications.success('<s:text name="wao.ui.form.BoatInfos.success"/>'); + } + WAO.post(WAO.UPDATE_BOAT_INFOS_JSON_URL, data, successCallback); + }); + + $unlockBoatInfosFormButton.click(function () { + $boatInfosForm.find('input[readonly], button, textarea').removeAttr('readonly').removeAttr('disabled'); + $unlockBoatInfosFormButton.attr('disabled', 'disabled'); + }); + + + // le calcul des sollicitations + + var $boatContactsCountForm = $('#boat-contacts-count-form'); + var $boatContactsCountsTable = $('#boat-contacts-counts-table'); + + $boatContactsCountsTable.hide(); + + var getBoatContactsCount = function () { + var data = WAO.toData($boatContactsCountForm); + var since = data.since; + var successCallback = function (data) { + var tr = '<tr>' + + ' <td>' + + since + + ' </td>' + + ' <td>' + + data.boatContactsCounts.contactsCompanyCount + + ' (' + data.boatContactsCounts.observationsCompanyCount + ')' + + ' </td>' + + ' <td>' + + data.boatContactsCounts.contactsCount + + ' (' + data.boatContactsCounts.observationsCount + ')' + + ' </td>' + + '</tr>'; + $boatContactsCountsTable.find('tbody').append(tr); + $boatContactsCountsTable.show(); + }; + WAO.get(WAO.GET_BOAT_CONTACTS_COUNT_JSON_URL, data, successCallback); + } + + $('#get-boat-contacts-count').click(getBoatContactsCount); + $boatContactsCountForm.enterKey(getBoatContactsCount); + + // création d'un contact depuis une ligne éligible + + var $createContactFromBoatButton = $('#createContactFromBoatButton'); + var $sampleRowIdInput = $('input[name="sampleRowId"]'); + var expiredSampleRowIds = <s:property value="boatDetails.expiredSampleRowIds" escapeHtml="false"/> + $sampleRowIdInput.change(function () { + $createContactFromBoatButton.removeAttr('disabled'); + }); + $createContactFromBoatButton.click(function (e) { + var selectedSampleRowIsExpired = $.inArray($('input[name="sampleRowId"]:checked').val(), expiredSampleRowIds); + var confirmMessage = "<s:text name="wao.ui.contacts.createFromBoat.warn"/>"; + if (selectedSampleRowIsExpired && ! confirm(confirmMessage)) { + e.preventDefault(); + } + }); + + // suppresssion d'une éligibilité + $('.remove-boat-eligibility').click(function (e) { + e.preventDefault(); + if (confirm("<s:text name="wao.ui.removeBoatEligibility.confirm"/>")) { + var url = $(this).attr('href'); + var $toRemove = $(this).parents('.elligible-sample-row') + var successCallback = function (data) { + $toRemove.remove(); + }; + WAO.post(url, {}, successCallback); + } + }); + + }); +</script> + +<h2> + <s:text name="wao.ui.boatinfo.contacts"> + <s:param value="boatDetails.boatInfos.boat.name"/> + </s:text> +</h2> + +<h3> + <s:text name="wao.ui.boats.contacts.existing"/> +</h3> + +<s:if test="boatDetails.contactsCount > 0"> + + <h4> + <s:text name="wao.ui.contact.lastContact"/> + </h4> + + <table class="table"> + <tbody> + <tr> + <th> + <s:text name="wao.ui.field.Contact.creationDate"/> + </th> + <td> + <s:property value="boatDetails.mostRecentContact.creationDate"/> + </td> + </tr> + <tr> + <th> + <s:text name="wao.ui.field.Contact.mainObserver"/> + </th> + <td> + <s:property value="boatDetails.mostRecentContact.mainObserver.fullName"/> + </td> + </tr> + <tr> + <th> + <s:text name="wao.ui.field.Contact.contactState"/> + </th> + <td> + <s:property value="%{getText(boatDetails.mostRecentContact.contactState)}"/> + </td> + </tr> + <tr> + <th> + <s:text name="wao.ui.field.Contact.sampleRow"/> + </th> + <td> + <s:property value="boatDetails.mostRecentContact.sampleRow.code"/> + </td> + </tr> + </tbody> + </table> + + <s:url action="contacts" id="viewAssociatedContactsForBoatUrl"> + <s:param name="filter.boatFilter.registrationCode" value="boatDetails.boatInfos.boat.immatriculation"/> + <s:param name="filter.sampleRowFilter.companyIds" value="boatDetails.boatInfos.company.topiaId"/> + <s:param name="filter.periodFrom"/> + <s:param name="filter.periodTo"/> + </s:url> + <s:a href="%{viewAssociatedContactsForBoatUrl}"> + <s:text name="wao.ui.action.viewAssociatedContactsForBoat"> + <s:param value="boatDetails.contactsCount"/> + </s:text> + </s:a> + +</s:if> +<s:else> + <s:text name="wao.ui.boats.contacts.none"/> +</s:else> + +<h3> + <s:text name="wao.ui.contact.creation"/> +</h3> + +<s:if test="boatDetails.boatInfos.boat.active"> + <s:if test="startBoatSelectionForSampleRow == null"> + <s:if test="boatDetails.elligibleForSampleRows.empty"> + <s:text name="wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty" /> + </s:if> + <s:else> + <s:text name="wao.ui.boats.associatedLine"/> + <s:if test="boatDetails.newContactCreatable && authenticatedWaoUser.authorizedToCreateContact"> + <s:form action="create-contact"> + + <s:hidden name="boatId" value="%{boatDetails.boatInfos.boat.topiaId}"/> + + <div class="control-group"> + <div class="controls"> + <s:iterator value="boatDetails.elligibleForSampleRows" status="status"> + <div class="elligible-sample-row"> + <s:set name="radioId">radio-<s:property value="#status.index"/></s:set> + <input type="radio" name="sampleRowId" id="<s:property value="#radioId"/>" value="<s:property value="topiaId"/>"/> + <%-- + <label for="<s:property value="%{#radioId}"/>" class="radio"> + <s:property value="code"/> + </label> + --%> + <s:property value="code"/> + <s:url action="update-boat-elligibility-json" id="updateBoatElligibilityUrl"> + <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/> + <s:param name="sampleRowId" value="topiaId"/> + <s:param name="active" value="false"/> + </s:url> + <s:a href="%{updateBoatElligibilityUrl}" cssClass="btn btn-link remove-boat-eligibility"> + <i class="icon-remove"></i> + </s:a> + </div> + </s:iterator> + </div> + </div> + + + <s:submit id="createContactFromBoatButton" type="button" cssClass="btn btn-success" disabled="true"> + <i class="icon-plus"></i> + <s:text name="wao.ui.contacts.createFromBoat"/> + </s:submit> + </s:form> + </s:if> + <s:else> + <ul> + <s:iterator value="boatDetails.elligibleForSampleRows"> + <li class="elligible-sample-row"> + <s:property value="code"/> + <s:url action="update-boat-elligibility-json" id="updateBoatElligibilityUrl"> + <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/> + <s:param name="sampleRowId" value="topiaId"/> + <s:param name="active" value="false"/> + </s:url> + <s:a href="%{updateBoatElligibilityUrl}" cssClass="btn btn-link remove-boat-eligibility"> + <i class="icon-remove"></i> + </s:a> + </li> + </s:iterator> + </ul> + </s:else> + </s:else> + <s:if test="authenticatedWaoUser.authorizedToCreateContact"> + <div class="alert alert-info"> + <s:text name="wao.ui.tip.useBoatSelectionForSampleRow"/> + </div> + </s:if> + </s:if> + <s:else> + <s:if test="boatDetails.newContactCreatable"> + <s:if test="boatDetails.newContactCreatable && authenticatedWaoUser.authorizedToCreateContact"> + <s:url action="create-contact" id="createContactUrl"> + <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/> + <s:param name="sampleRowId" value="startBoatSelectionForSampleRow.topiaId"/> + </s:url> + <s:a href="%{createContactUrl}" cssClass="btn btn-success"> + <i class="icon-plus"></i> + <s:text name="wao.ui.contacts.createFromBoatAndSelectedSampleRow"> + <s:param value="startBoatSelectionForSampleRow.code"/> + <s:param value="startBoatSelectionForSampleRow.professionDescription"/> + </s:text> + </s:a> + </s:if> + </s:if> + <s:else> + <div class="alert"> + <s:text name="wao.ui.tip.contactAlreadyExists"/> + </div> + </s:else> + </s:else> + +</s:if> +<s:else> + <div class="alert"> + <s:text name="wao.ui.tip.inactiveBoat"/> + </div> +</s:else> + +<h3> + <s:text name="wao.ui.boatDetails.boatContactsCounts.title"/> +</h3> + +<table id="boat-contacts-counts-table" class="table no-border-top"> + <thead> + <tr> + <td> + <s:text name="wao.ui.boatDetails.boatContactsCounts.since"/> + </td> + <td> + <s:text name="wao.ui.boatDetails.boatContactsCounts.contactsCompanyCount"/> + </td> + <td> + <s:text name="wao.ui.boatDetails.boatContactsCounts.contactsCount"/> + </td> + </thead> + <tbody> + </tbody> +</table> + +<s:form id="boat-contacts-count-form"> + + <s:hidden name="boatId" value="%{boatDetails.boatInfos.boat.topiaId}" /> + <s:hidden name="companyId" value="%{boatDetails.boatInfos.company.topiaId}" /> + + <div class="input-prepend input-append"> + + <span class="add-on"> + <s:text name="wao.ui.boatDetails.boatContactsCounts.since"/> + </span> + + <input name="since" type="text" value="<s:property value="%{oneYearAgoDatePlaceHolder}"/>"/> + + <button type="button" id="get-boat-contacts-count" class="btn"> + <i class="icon-plus"></i> <s:text name="wao.ui.boatDetails.boatContactsCounts.compute" /> + </button> + </div> +</s:form> + +<h2> + <s:text name="wao.ui.boatinfo.title"> + <s:param value="boatDetails.boatInfos.boat.name"/> + </s:text> +</h2> + +<h3> + <s:text name="wao.ui.boats.info"/> +</h3> + +<table class="table"> + <tbody> + <tr> + <th class="no-border-top"> + <s:text name="wao.ui.field.Boat.shipOwner"/> + </th> + <td class="no-border-top"> + <s:url action="boats" id="shipOwnerBoatsUrl"> + <s:param name="filter.shipOwnerIds" value="boatDetails.boatInfos.boat.shipOwner.topiaId"/> + </s:url> + <s:set name="shipOwnerBoatsTitle"> + <s:text name="wao.ui.action.viewShipOwnerBoats"/> + </s:set> + <s:a href="%{shipOwnerBoatsUrl}" title="%{shipOwnerBoatsTitle}"> + <s:property value="boatDetails.boatInfos.boat.shipOwner.firstName"/> + <s:property value="boatDetails.boatInfos.boat.shipOwner.lastName"/> + </s:a> + </td> + </tr> + <tr> + <th> + <s:text name="wao.ui.field.Boat.boatGroup"/> + </th> + <td> + <s:if test="boatDetails.boatInfos.boat.boatGroup == null"> + <s:text name="wao.ui.misc.N/A"/> + </s:if> + <s:else> + <s:property value="boatDetails.boatInfos.boat.boatGroup.description"/> + </s:else> + </td> + </tr> + </tbody> +</table> + +<h3> + <s:text name="wao.ui.boats.interlocutor"/> +</h3> + +<s:form id="boat-infos-form" cssClass="form-horizontal"> + + <s:hidden name="boatId" value="%{boatDetails.boatInfos.boat.topiaId}" /> + <s:hidden name="companyId" value="%{boatDetails.boatInfos.company.topiaId}" /> + + <s:textfield name="boatInfos.contactFirstName" value="%{boatDetails.boatInfos.contactFirstName}" label="%{getText('wao.ui.field.BoatInfos.contactFirstName')}" readonly="true" cssClass="input-large" /> + <s:textfield name="boatInfos.contactLastName" value="%{boatDetails.boatInfos.contactLastName}" label="%{getText('wao.ui.field.BoatInfos.contactLastName')}" readonly="true" cssClass="input-large" /> + <s:textfield type="email" name="boatInfos.contactEmail" value="%{boatDetails.boatInfos.contactEmail}" label="%{getText('wao.ui.field.BoatInfos.contactEmail')}" readonly="true" cssClass="input-large" /> + <s:textfield type="tel" name="boatInfos.contactPhoneNumber" value="%{boatDetails.boatInfos.contactPhoneNumber}" label="%{getText('wao.ui.field.BoatInfos.contactPhoneNumber')}" readonly="true" cssClass="input-large" /> + <s:textfield type="number" name="boatInfos.dup" value="%{boatDetails.boatInfos.dup}" label="%{getText('wao.ui.field.BoatInfos.dup')}" readonly="true" cssClass="input-small" /> + <s:textfield name="boatInfos.contactAddress1" value="%{boatDetails.boatInfos.contactAddress1}" label="%{getText('wao.ui.field.BoatInfos.contactAddress1')}" readonly="true" cssClass="input-xxlarge" /> + <s:textfield name="boatInfos.contactAddress2" value="%{boatDetails.boatInfos.contactAddress2}" label="%{getText('wao.ui.field.BoatInfos.contactAddress2')}" readonly="true" cssClass="input-xxlarge" /> + <s:textfield name="boatInfos.contactPostalCode" value="%{boatDetails.boatInfos.contactPostalCode}" label="%{getText('wao.ui.field.BoatInfos.contactPostalCode')}" readonly="true" cssClass="input-small" /> + <s:textfield name="boatInfos.contactCity" value="%{boatDetails.boatInfos.contactCity}" label="%{getText('wao.ui.field.BoatInfos.contactCity')}" readonly="true" cssClass="input-large" /> + <s:textarea name="boatInfos.comment" value="%{boatDetails.boatInfos.comment}" label="%{getText('wao.ui.field.BoatInfos.comment')}" readonly="true" cssClass="input-xxlarge" /> + + <div class="form-actions"> + <button type="button" id="unlock-boat-infos-form" class="btn"> + <i class="icon-edit"></i> <s:text name="wao.ui.action.edit" /> + </button> + + <button type="button" id="save-boat-infos" class="btn" disabled="disabled"> + <i class="icon-hdd"></i> <s:text name="wao.ui.action.save" /> + </button> + </div> + +</s:form> \ No newline at end of file Copied: branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/boats.jsp (from rev 2075, branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp) =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/boats.jsp (rev 0) +++ branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/boats.jsp 2014-06-20 13:56:00 UTC (rev 2076) @@ -0,0 +1,308 @@ +<%-- + #%L + Wao :: Web + %% + Copyright (C) 2009 - 2014 Ifremer + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> +<%@taglib uri="/struts-tags" prefix="s" %> + +<html> + +<head> + <title> + <s:text name="wao.ui.page.Boats.title"/> + </title> + + <script> + + $(document).ready(function () { + + var boatFilterMappings = [ + + <s:if test="authenticatedWaoUser.authorizedToFilterOnBoats"> + { + filterName: 'boatIds', + filterLabel: "<s:text name="wao.ui.entity.Boat"/>", + filterValuesField: 'boats', + minimumInputLength: 3 + }, + </s:if> + { + filterName: 'elligibleForSampleRowsFilter.fishingZoneFacadeNames', + filterLabel: "<s:text name="wao.ui.field.FishingZone.facadeName"/>", + filterValuesField: 'elligibleForSampleRowsFilterValues.fishingZoneFacadeNames' + }, + { + filterName: 'elligibleForSampleRowsFilter.fishingZoneSectorNames', + filterLabel: "<s:text name="wao.ui.field.FishingZone.sectorName"/>", + filterValuesField: 'elligibleForSampleRowsFilterValues.fishingZoneSectorNames' + }, + { + filterName: 'elligibleForSampleRowsFilter.sampleRowCodes', + filterLabel: "<s:text name="wao.ui.field.SampleRow.code"/>", + filterValuesField: 'elligibleForSampleRowsFilterValues.sampleRowCodes' + }, + { + filterName: 'districtIds', + filterLabel: "<s:text name="wao.ui.field.Boat.district"/>", + filterValuesField: 'districts' + }, + { + filterName: 'shipOwnerIds', + filterLabel: "<s:text name="wao.ui.field.Boat.shipOwner"/>", + filterValuesField: 'shipOwners', + minimumInputLength: 3 + }, + { + filterName: 'portOfRegistryIds', + filterLabel: "<s:text name="wao.ui.field.Boat.portOfRegistry"/>", + filterValuesField: 'portsOfRegistry' + } + ]; + + filter = <s:property value="filter" escapeHtml="false"/>; + + boatsFilterController2 = new FilterController2(boatFilterMappings, filter, WAO.BOATS_FILTER_VALUES_JSON_URL, $('#boats-filters-form fieldset.extra-filters')); + boatsFilterController2.init(); + +// var $boatsFiltersForm = $('#boats-filters-form'); +// var boatsFilterController = new FilterController(WAO.BOATS_FILTER_VALUES_JSON_URL, $boatsFiltersForm); +// boatsFilterController.init(); + + var $boatDetails = $('#boat-details'); + var $companyId = $('#companyId'); + + var showBoatDetails = function (boatId) { + var companyId = $companyId.val(); + var successCallback = function (data) { + $boatDetails.html(data); + $('tr.boat-row').removeClass('highlight'); + $('tr[data-boat-id="' + boatId + '"]').addClass('highlight'); + $boatDetails.effect('highlight', 'slow'); + }; + var data = { + fragment: true, + boatId: boatId, + companyId: companyId + }; + WAO.get(WAO.BOAT_DETAILS_URL, data, successCallback); + } + $('a.boat-details-action').click(function (e) { + e.preventDefault(); + var boatId = $(this).parents('tr.boat-row').attr('data-boat-id'); + showBoatDetails(boatId); + }); + $companyId.change(function () { + var boatId = $('tr.boat-row.highlight').attr('data-boat-id'); + if (boatId) { + showBoatDetails(boatId); + } + }); + + }); + + </script> + +</head> + +<content tag="mainClass">large</content> +<content tag="boatsMenuItemClass">active</content> + +<s:if test="startBoatSelectionForSampleRow != null"> + <div class="alert alert-info"> + <s:text name="wao.ui.tip.boatSelectionForSampleRowStarted"> + <s:param value="startBoatSelectionForSampleRow.code"/> + <s:param value="startBoatSelectionForSampleRow.professionDescription"/> + </s:text> + <s:url action="cancel-boat-selection" id="cancelBoatSelectionUrl"/> + <s:a href="%{cancelBoatSelectionUrl}" cssClass="btn btn-link"> + <s:text name="wao.ui.action.cancel"/> + </s:a> + </div> +</s:if> + +<div id="boats-filters-list-details-layout"> + + <div> + <s:form method="GET" id="boats-filters-form" cssClass="filters-form"> + + <fieldset class="extra-filters"> + + </fieldset> + + <div class="form-actions"> + + <s:submit type="button" action="boats!applyFilter" cssClass="btn btn-primary"> + <i class="icon-filter"></i> <s:text name="wao.ui.action.filter"/> + </s:submit> + + <s:submit type="button" action="boats!resetFilter" cssClass="btn"> + <i class="icon-trash"></i> <s:text name="wao.ui.action.reset"/> + </s:submit> + + <s:submit action="export-boats" type="button" cssClass="btn"> + <i class="icon-download"></i> <s:text name="wao.ui.action.csvExport"/> + </s:submit> + + </div> + + </s:form> + + </div> + + <div> + <div class="arrow-right"></div> + <h2> + <s:text name="wao.ui.boats.title"> + <s:param value="%{pagination.count}"/> + </s:text> + </h2> + + <s:if test="authenticatedWaoUser.authorizedToViewBoatDetailsForAllCompanies"> + <s:select id="companyId" + name="companyId" + label="Vous devez sélectionner la société pour laquelle vous souhaitez consulter les informations" + list="allCompanies" + listKey="%{topiaId}" + listValue="%{name}" + value="%{authenticatedWaoUser.waoUser.company.topiaId}" + cssClass="input-xxlarge" /> + </s:if> + <s:else> + <s:hidden id="companyId" name="companyId" value="%{authenticatedWaoUser.waoUser.company.topiaId}"/> + </s:else> + + <table id="boats-list" class="table-condensed table-striped table-hover"> + <thead> + <tr> + <th> + <s:text name="wao.ui.boats.registrationCode"/> + </th> + <th> + <s:text name="wao.ui.boats.boatName"/> + </th> + <th> + <s:text name="wao.ui.boats.boatLength"/> (cm) + </th> + <th> + <s:text name="wao.ui.boats.buildYear"/> + </th> + <th> + <s:text name="wao.ui.boats.district"/> + </th> + <th> + <span data-original-title="<s:text name="wao.ui.boats.portOfRegistry.description"/>" data-toggle="tooltip" data-placement="bottom"> + <s:text name="wao.ui.boats.portOfRegistry"/> + </span> + </th> + </tr> + </thead> + <tbody> + <s:iterator value="boats" var="boat"> + <tr data-boat-id="<s:property value="topiaId"/>" class="boat-row"> + <td> + <s:if test="authenticatedWaoUser.authorizedToViewBoatDetails"> + <s:url action="boat-details" id="boatDetailsUrl"> + <s:param name="companyId" value="authenticatedWaoUser.waoUser.company.topiaId" /> + <s:param name="boatId" value="topiaId" /> + </s:url> + <s:a href="%{boatDetailsUrl}" cssClass="boat-details-action"> + <s:property value="%{'' + immatriculation}"/> + </s:a> + </s:if> + <s:else> + <s:property value="%{'' + immatriculation}"/> + </s:else> + </td> + <td<s:if test="!active"> class="inactive"</s:if>> + <s:property value="name"/> + </td> + <td><s:property value="boatLength"/></td> + <td><s:property value="%{'' + buildYear}"/></td> + <td><s:property value="district.districtCode"/></td> + <td> + <s:if test="portOfRegistry != null"> + <span data-original-title="<s:property value="portOfRegistry.description"/>" data-toggle="tooltip" data-placement="bottom"> + <s:property value="portOfRegistry.portCode"/> + </span> + </s:if> + </td> + </tr> + </s:iterator> + </todby> + </table> + + <%-- Pagination --%> + <div class="pagination"> + <ul> + <s:url var="fullUrl" includeParams="get"/> + <s:set var="paginationUrl" value="%{getPaginationUrl(#fullUrl)}"/> + <s:if test="firstRangePage > 2"> + <li> + <a href="${paginationUrl}0">1</a> + </li> + <li> + <a href="${paginationUrl}1">2</a> + </li> + <li> + <span>...</span> + </li> + </s:if> + + <s:iterator var="currentPage" begin="firstRangePage" end="lastRangePage"> + <li class="<s:if test="#currentPage - 1 == pagination.currentPage.pageNumber">active</s:if>"> + <a href="${paginationUrl}${currentPage - 1}"> + <s:property/> + </a> + </li> + </s:iterator> + + <s:if test="lastRangePage < pagination.pageCount - 1"> + <li> + <span>...</span> + </li> + <li> + <a href="${paginationUrl}${pagination.pageCount - 2}"> + <s:property value="pagination.pageCount - 1"/> + </a> + </li> + <li> + <a href="${paginationUrl}${pagination.pageCount - 1}"> + <s:property value="pagination.pageCount"/> + </a> + </li> + </s:if> + </ul> + </div> + </div> + + <s:if test="authenticatedWaoUser.authorizedToViewBoatDetails"> + + <div> + <div class="arrow-right"></div> + <div id="boat-details"> + <div class="alert alert-info"> + <s:text name="wao.ui.tip.youMustChooseBoat" /> + </div> + </div> + </div> + </s:if> + +</div> + +</html> Deleted: branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,402 +0,0 @@ -<%-- - #%L - Wao :: Web - %% - Copyright (C) 2009 - 2014 Ifremer - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> -<%@taglib uri="/struts-tags" prefix="s" %> - -<script> - $(document).ready(function () { - - // le formulaire concernant l'interlocuteur - - var $boatInfosForm = $('#boat-infos-form'); - var $saveBoatInfosButton = $('#save-boat-infos'); - var $unlockBoatInfosFormButton = $('#unlock-boat-infos-form'); - - $saveBoatInfosButton.click(function () { - $boatInfosForm.find('input, textarea').attr('readonly', 'readonly'); - $saveBoatInfosButton.attr('disabled', 'disabled'); - $unlockBoatInfosFormButton.removeAttr('disabled'); - var data = WAO.toData($boatInfosForm); - var successCallback = function () { - WAO.notifications.success('<s:text name="wao.ui.form.BoatInfos.success"/>'); - } - WAO.post(WAO.OBSMER_UPDATE_BOAT_INFOS_JSON_URL, data, successCallback); - }); - - $unlockBoatInfosFormButton.click(function () { - $boatInfosForm.find('input[readonly], button, textarea').removeAttr('readonly').removeAttr('disabled'); - $unlockBoatInfosFormButton.attr('disabled', 'disabled'); - }); - - - // le calcul des sollicitations - - var $boatContactsCountForm = $('#boat-contacts-count-form'); - var $boatContactsCountsTable = $('#boat-contacts-counts-table'); - - $boatContactsCountsTable.hide(); - - var getBoatContactsCount = function () { - var data = WAO.toData($boatContactsCountForm); - var since = data.since; - var successCallback = function (data) { - var tr = '<tr>' - + ' <td>' - + since - + ' </td>' - + ' <td>' - + data.boatContactsCounts.contactsCompanyCount - + ' (' + data.boatContactsCounts.observationsCompanyCount + ')' - + ' </td>' - + ' <td>' - + data.boatContactsCounts.contactsCount - + ' (' + data.boatContactsCounts.observationsCount + ')' - + ' </td>' - + '</tr>'; - $boatContactsCountsTable.find('tbody').append(tr); - $boatContactsCountsTable.show(); - }; - WAO.get(WAO.OBSMER_GET_BOAT_CONTACTS_COUNT_JSON_URL, data, successCallback); - } - - $('#get-boat-contacts-count').click(getBoatContactsCount); - $boatContactsCountForm.enterKey(getBoatContactsCount); - - // création d'un contact depuis une ligne éligible - - var $createContactFromBoatButton = $('#createContactFromBoatButton'); - var $sampleRowIdInput = $('input[name="sampleRowId"]'); - var expiredSampleRowIds = <s:property value="boatDetails.expiredSampleRowIds" escapeHtml="false"/> - $sampleRowIdInput.change(function () { - $createContactFromBoatButton.removeAttr('disabled'); - }); - $createContactFromBoatButton.click(function (e) { - var selectedSampleRowIsExpired = $.inArray($('input[name="sampleRowId"]:checked').val(), expiredSampleRowIds); - var confirmMessage = "<s:text name="wao.ui.contacts.createFromBoat.warn"/>"; - if (selectedSampleRowIsExpired && ! confirm(confirmMessage)) { - e.preventDefault(); - } - }); - - // suppresssion d'une éligibilité - $('.remove-boat-eligibility').click(function (e) { - e.preventDefault(); - if (confirm("<s:text name="wao.ui.removeBoatEligibility.confirm"/>")) { - var url = $(this).attr('href'); - var $toRemove = $(this).parents('.elligible-sample-row') - var successCallback = function (data) { - $toRemove.remove(); - }; - WAO.post(url, {}, successCallback); - } - }); - - }); -</script> - -<h2> - <s:text name="wao.ui.boatinfo.contacts"> - <s:param value="boatDetails.boatInfos.boat.name"/> - </s:text> -</h2> - -<h3> - <s:text name="wao.ui.boats.contacts.existing"/> -</h3> - -<s:if test="boatDetails.contactsCount > 0"> - - <h4> - <s:text name="wao.ui.contact.lastContact"/> - </h4> - - <table class="table"> - <tbody> - <tr> - <th> - <s:text name="wao.ui.field.Contact.creationDate"/> - </th> - <td> - <s:property value="boatDetails.mostRecentContact.creationDate"/> - </td> - </tr> - <tr> - <th> - <s:text name="wao.ui.field.Contact.mainObserver"/> - </th> - <td> - <s:property value="boatDetails.mostRecentContact.mainObserver.fullName"/> - </td> - </tr> - <tr> - <th> - <s:text name="wao.ui.field.Contact.contactState"/> - </th> - <td> - <s:property value="%{getText(boatDetails.mostRecentContact.contactState)}"/> - </td> - </tr> - <tr> - <th> - <s:text name="wao.ui.field.Contact.sampleRow"/> - </th> - <td> - <s:property value="boatDetails.mostRecentContact.sampleRow.code"/> - </td> - </tr> - </tbody> - </table> - - <s:url action="contacts" id="viewAssociatedContactsForBoatUrl"> - <s:param name="filter.boatFilter.registrationCode" value="boatDetails.boatInfos.boat.immatriculation"/> - <s:param name="filter.sampleRowFilter.companyIds" value="boatDetails.boatInfos.company.topiaId"/> - <s:param name="filter.periodFrom"/> - <s:param name="filter.periodTo"/> - </s:url> - <s:a href="%{viewAssociatedContactsForBoatUrl}"> - <s:text name="wao.ui.action.viewAssociatedContactsForBoat"> - <s:param value="boatDetails.contactsCount"/> - </s:text> - </s:a> - -</s:if> -<s:else> - <s:text name="wao.ui.boats.contacts.none"/> -</s:else> - -<h3> - <s:text name="wao.ui.contact.creation"/> -</h3> - -<s:if test="boatDetails.boatInfos.boat.active"> - <s:if test="startBoatSelectionForSampleRow == null"> - <s:if test="boatDetails.elligibleForSampleRows.empty"> - <s:text name="wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty" /> - </s:if> - <s:else> - <s:text name="wao.ui.boats.associatedLine"/> - <s:if test="boatDetails.newContactCreatable && authenticatedWaoUser.authorizedToCreateContact"> - <s:form action="create-contact"> - - <s:hidden name="boatId" value="%{boatDetails.boatInfos.boat.topiaId}"/> - - <div class="control-group"> - <div class="controls"> - <s:iterator value="boatDetails.elligibleForSampleRows" status="status"> - <div class="elligible-sample-row"> - <s:set name="radioId">radio-<s:property value="#status.index"/></s:set> - <input type="radio" name="sampleRowId" id="<s:property value="#radioId"/>" value="<s:property value="topiaId"/>"/> - <%-- - <label for="<s:property value="%{#radioId}"/>" class="radio"> - <s:property value="code"/> - </label> - --%> - <s:property value="code"/> - <s:url action="update-boat-elligibility-json" id="updateBoatElligibilityUrl"> - <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/> - <s:param name="sampleRowId" value="topiaId"/> - <s:param name="active" value="false"/> - </s:url> - <s:a href="%{updateBoatElligibilityUrl}" cssClass="btn btn-link remove-boat-eligibility"> - <i class="icon-remove"></i> - </s:a> - </div> - </s:iterator> - </div> - </div> - - - <s:submit id="createContactFromBoatButton" type="button" cssClass="btn btn-success" disabled="true"> - <i class="icon-plus"></i> - <s:text name="wao.ui.contacts.createFromBoat"/> - </s:submit> - </s:form> - </s:if> - <s:else> - <ul> - <s:iterator value="boatDetails.elligibleForSampleRows"> - <li class="elligible-sample-row"> - <s:property value="code"/> - <s:url action="update-boat-elligibility-json" id="updateBoatElligibilityUrl"> - <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/> - <s:param name="sampleRowId" value="topiaId"/> - <s:param name="active" value="false"/> - </s:url> - <s:a href="%{updateBoatElligibilityUrl}" cssClass="btn btn-link remove-boat-eligibility"> - <i class="icon-remove"></i> - </s:a> - </li> - </s:iterator> - </ul> - </s:else> - </s:else> - <s:if test="authenticatedWaoUser.authorizedToCreateContact"> - <div class="alert alert-info"> - <s:text name="wao.ui.tip.useBoatSelectionForSampleRow"/> - </div> - </s:if> - </s:if> - <s:else> - <s:if test="boatDetails.newContactCreatable"> - <s:if test="boatDetails.newContactCreatable && authenticatedWaoUser.authorizedToCreateContact"> - <s:url action="create-contact" id="createContactUrl"> - <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/> - <s:param name="sampleRowId" value="startBoatSelectionForSampleRow.topiaId"/> - </s:url> - <s:a href="%{createContactUrl}" cssClass="btn btn-success"> - <i class="icon-plus"></i> - <s:text name="wao.ui.contacts.createFromBoatAndSelectedSampleRow"> - <s:param value="startBoatSelectionForSampleRow.code"/> - <s:param value="startBoatSelectionForSampleRow.professionDescription"/> - </s:text> - </s:a> - </s:if> - </s:if> - <s:else> - <div class="alert"> - <s:text name="wao.ui.tip.contactAlreadyExists"/> - </div> - </s:else> - </s:else> - -</s:if> -<s:else> - <div class="alert"> - <s:text name="wao.ui.tip.inactiveBoat"/> - </div> -</s:else> - -<h3> - <s:text name="wao.ui.boatDetails.boatContactsCounts.title"/> -</h3> - -<table id="boat-contacts-counts-table" class="table no-border-top"> - <thead> - <tr> - <td> - <s:text name="wao.ui.boatDetails.boatContactsCounts.since"/> - </td> - <td> - <s:text name="wao.ui.boatDetails.boatContactsCounts.contactsCompanyCount"/> - </td> - <td> - <s:text name="wao.ui.boatDetails.boatContactsCounts.contactsCount"/> - </td> - </thead> - <tbody> - </tbody> -</table> - -<s:form id="boat-contacts-count-form"> - - <s:hidden name="boatId" value="%{boatDetails.boatInfos.boat.topiaId}" /> - <s:hidden name="companyId" value="%{boatDetails.boatInfos.company.topiaId}" /> - - <div class="input-prepend input-append"> - - <span class="add-on"> - <s:text name="wao.ui.boatDetails.boatContactsCounts.since"/> - </span> - - <input name="since" type="text" value="<s:property value="%{oneYearAgoDatePlaceHolder}"/>"/> - - <button type="button" id="get-boat-contacts-count" class="btn"> - <i class="icon-plus"></i> <s:text name="wao.ui.boatDetails.boatContactsCounts.compute" /> - </button> - </div> -</s:form> - -<h2> - <s:text name="wao.ui.boatinfo.title"> - <s:param value="boatDetails.boatInfos.boat.name"/> - </s:text> -</h2> - -<h3> - <s:text name="wao.ui.boats.info"/> -</h3> - -<table class="table"> - <tbody> - <tr> - <th class="no-border-top"> - <s:text name="wao.ui.field.Boat.shipOwner"/> - </th> - <td class="no-border-top"> - <s:url action="boats" id="shipOwnerBoatsUrl"> - <s:param name="filter.shipOwnerIds" value="boatDetails.boatInfos.boat.shipOwner.topiaId"/> - </s:url> - <s:set name="shipOwnerBoatsTitle"> - <s:text name="wao.ui.action.viewShipOwnerBoats"/> - </s:set> - <s:a href="%{shipOwnerBoatsUrl}" title="%{shipOwnerBoatsTitle}"> - <s:property value="boatDetails.boatInfos.boat.shipOwner.firstName"/> - <s:property value="boatDetails.boatInfos.boat.shipOwner.lastName"/> - </s:a> - </td> - </tr> - <tr> - <th> - <s:text name="wao.ui.field.Boat.boatGroup"/> - </th> - <td> - <s:if test="boatDetails.boatInfos.boat.boatGroup == null"> - <s:text name="wao.ui.misc.N/A"/> - </s:if> - <s:else> - <s:property value="boatDetails.boatInfos.boat.boatGroup.description"/> - </s:else> - </td> - </tr> - </tbody> -</table> - -<h3> - <s:text name="wao.ui.boats.interlocutor"/> -</h3> - -<s:form id="boat-infos-form" cssClass="form-horizontal"> - - <s:hidden name="boatId" value="%{boatDetails.boatInfos.boat.topiaId}" /> - <s:hidden name="companyId" value="%{boatDetails.boatInfos.company.topiaId}" /> - - <s:textfield name="boatInfos.contactFirstName" value="%{boatDetails.boatInfos.contactFirstName}" label="%{getText('wao.ui.field.BoatInfos.contactFirstName')}" readonly="true" cssClass="input-large" /> - <s:textfield name="boatInfos.contactLastName" value="%{boatDetails.boatInfos.contactLastName}" label="%{getText('wao.ui.field.BoatInfos.contactLastName')}" readonly="true" cssClass="input-large" /> - <s:textfield type="email" name="boatInfos.contactEmail" value="%{boatDetails.boatInfos.contactEmail}" label="%{getText('wao.ui.field.BoatInfos.contactEmail')}" readonly="true" cssClass="input-large" /> - <s:textfield type="tel" name="boatInfos.contactPhoneNumber" value="%{boatDetails.boatInfos.contactPhoneNumber}" label="%{getText('wao.ui.field.BoatInfos.contactPhoneNumber')}" readonly="true" cssClass="input-large" /> - <s:textfield type="number" name="boatInfos.dup" value="%{boatDetails.boatInfos.dup}" label="%{getText('wao.ui.field.BoatInfos.dup')}" readonly="true" cssClass="input-small" /> - <s:textfield name="boatInfos.contactAddress1" value="%{boatDetails.boatInfos.contactAddress1}" label="%{getText('wao.ui.field.BoatInfos.contactAddress1')}" readonly="true" cssClass="input-xxlarge" /> - <s:textfield name="boatInfos.contactAddress2" value="%{boatDetails.boatInfos.contactAddress2}" label="%{getText('wao.ui.field.BoatInfos.contactAddress2')}" readonly="true" cssClass="input-xxlarge" /> - <s:textfield name="boatInfos.contactPostalCode" value="%{boatDetails.boatInfos.contactPostalCode}" label="%{getText('wao.ui.field.BoatInfos.contactPostalCode')}" readonly="true" cssClass="input-small" /> - <s:textfield name="boatInfos.contactCity" value="%{boatDetails.boatInfos.contactCity}" label="%{getText('wao.ui.field.BoatInfos.contactCity')}" readonly="true" cssClass="input-large" /> - <s:textarea name="boatInfos.comment" value="%{boatDetails.boatInfos.comment}" label="%{getText('wao.ui.field.BoatInfos.comment')}" readonly="true" cssClass="input-xxlarge" /> - - <div class="form-actions"> - <button type="button" id="unlock-boat-infos-form" class="btn"> - <i class="icon-edit"></i> <s:text name="wao.ui.action.edit" /> - </button> - - <button type="button" id="save-boat-infos" class="btn" disabled="disabled"> - <i class="icon-hdd"></i> <s:text name="wao.ui.action.save" /> - </button> - </div> - -</s:form> \ No newline at end of file Deleted: branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-06-20 13:56:00 UTC (rev 2076) @@ -1,308 +0,0 @@ -<%-- - #%L - Wao :: Web - %% - Copyright (C) 2009 - 2014 Ifremer - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> -<%@taglib uri="/struts-tags" prefix="s" %> - -<html> - -<head> - <title> - <s:text name="wao.ui.page.Boats.title"/> - </title> - - <script> - - $(document).ready(function () { - - var boatFilterMappings = [ - - <s:if test="authenticatedWaoUser.authorizedToFilterOnBoats"> - { - filterName: 'boatIds', - filterLabel: "<s:text name="wao.ui.entity.Boat"/>", - filterValuesField: 'boats', - minimumInputLength: 3 - }, - </s:if> - { - filterName: 'elligibleForSampleRowsFilter.fishingZoneFacadeNames', - filterLabel: "<s:text name="wao.ui.field.FishingZone.facadeName"/>", - filterValuesField: 'elligibleForSampleRowsFilterValues.fishingZoneFacadeNames' - }, - { - filterName: 'elligibleForSampleRowsFilter.fishingZoneSectorNames', - filterLabel: "<s:text name="wao.ui.field.FishingZone.sectorName"/>", - filterValuesField: 'elligibleForSampleRowsFilterValues.fishingZoneSectorNames' - }, - { - filterName: 'elligibleForSampleRowsFilter.sampleRowCodes', - filterLabel: "<s:text name="wao.ui.field.SampleRow.code"/>", - filterValuesField: 'elligibleForSampleRowsFilterValues.sampleRowCodes' - }, - { - filterName: 'districtIds', - filterLabel: "<s:text name="wao.ui.field.Boat.district"/>", - filterValuesField: 'districts' - }, - { - filterName: 'shipOwnerIds', - filterLabel: "<s:text name="wao.ui.field.Boat.shipOwner"/>", - filterValuesField: 'shipOwners', - minimumInputLength: 3 - }, - { - filterName: 'portOfRegistryIds', - filterLabel: "<s:text name="wao.ui.field.Boat.portOfRegistry"/>", - filterValuesField: 'portsOfRegistry' - } - ]; - - filter = <s:property value="filter" escapeHtml="false"/>; - - boatsFilterController2 = new FilterController2(boatFilterMappings, filter, WAO.OBSMER_BOATS_FILTER_VALUES_JSON_URL, $('#boats-filters-form fieldset.extra-filters')); - boatsFilterController2.init(); - -// var $boatsFiltersForm = $('#boats-filters-form'); -// var boatsFilterController = new FilterController(WAO.OBSMER_BOATS_FILTER_VALUES_JSON_URL, $boatsFiltersForm); -// boatsFilterController.init(); - - var $boatDetails = $('#boat-details'); - var $companyId = $('#companyId'); - - var showBoatDetails = function (boatId) { - var companyId = $companyId.val(); - var successCallback = function (data) { - $boatDetails.html(data); - $('tr.boat-row').removeClass('highlight'); - $('tr[data-boat-id="' + boatId + '"]').addClass('highlight'); - $boatDetails.effect('highlight', 'slow'); - }; - var data = { - fragment: true, - boatId: boatId, - companyId: companyId - }; - WAO.get(WAO.OBSMER_BOAT_DETAILS_URL, data, successCallback); - } - $('a.boat-details-action').click(function (e) { - e.preventDefault(); - var boatId = $(this).parents('tr.boat-row').attr('data-boat-id'); - showBoatDetails(boatId); - }); - $companyId.change(function () { - var boatId = $('tr.boat-row.highlight').attr('data-boat-id'); - if (boatId) { - showBoatDetails(boatId); - } - }); - - }); - - </script> - -</head> - -<content tag="mainClass">large</content> -<content tag="boatsMenuItemClass">active</content> - -<s:if test="startBoatSelectionForSampleRow != null"> - <div class="alert alert-info"> - <s:text name="wao.ui.tip.boatSelectionForSampleRowStarted"> - <s:param value="startBoatSelectionForSampleRow.code"/> - <s:param value="startBoatSelectionForSampleRow.professionDescription"/> - </s:text> - <s:url action="cancel-boat-selection" id="cancelBoatSelectionUrl"/> - <s:a href="%{cancelBoatSelectionUrl}" cssClass="btn btn-link"> - <s:text name="wao.ui.action.cancel"/> - </s:a> - </div> -</s:if> - -<div id="boats-filters-list-details-layout"> - - <div> - <s:form method="GET" id="boats-filters-form" cssClass="filters-form"> - - <fieldset class="extra-filters"> - - </fieldset> - - <div class="form-actions"> - - <s:submit type="button" action="boats!applyFilter" cssClass="btn btn-primary"> - <i class="icon-filter"></i> <s:text name="wao.ui.action.filter"/> - </s:submit> - - <s:submit type="button" action="boats!resetFilter" cssClass="btn"> - <i class="icon-trash"></i> <s:text name="wao.ui.action.reset"/> - </s:submit> - - <s:submit action="export-boats" type="button" cssClass="btn"> - <i class="icon-download"></i> <s:text name="wao.ui.action.csvExport"/> - </s:submit> - - </div> - - </s:form> - - </div> - - <div> - <div class="arrow-right"></div> - <h2> - <s:text name="wao.ui.boats.title"> - <s:param value="%{pagination.count}"/> - </s:text> - </h2> - - <s:if test="authenticatedWaoUser.authorizedToViewBoatDetailsForAllCompanies"> - <s:select id="companyId" - name="companyId" - label="Vous devez sélectionner la société pour laquelle vous souhaitez consulter les informations" - list="allCompanies" - listKey="%{topiaId}" - listValue="%{name}" - value="%{authenticatedWaoUser.waoUser.company.topiaId}" - cssClass="input-xxlarge" /> - </s:if> - <s:else> - <s:hidden id="companyId" name="companyId" value="%{authenticatedWaoUser.waoUser.company.topiaId}"/> - </s:else> - - <table id="boats-list" class="table-condensed table-striped table-hover"> - <thead> - <tr> - <th> - <s:text name="wao.ui.boats.registrationCode"/> - </th> - <th> - <s:text name="wao.ui.boats.boatName"/> - </th> - <th> - <s:text name="wao.ui.boats.boatLength"/> (cm) - </th> - <th> - <s:text name="wao.ui.boats.buildYear"/> - </th> - <th> - <s:text name="wao.ui.boats.district"/> - </th> - <th> - <span data-original-title="<s:text name="wao.ui.boats.portOfRegistry.description"/>" data-toggle="tooltip" data-placement="bottom"> - <s:text name="wao.ui.boats.portOfRegistry"/> - </span> - </th> - </tr> - </thead> - <tbody> - <s:iterator value="boats" var="boat"> - <tr data-boat-id="<s:property value="topiaId"/>" class="boat-row"> - <td> - <s:if test="authenticatedWaoUser.authorizedToViewBoatDetails"> - <s:url action="boat-details" id="boatDetailsUrl"> - <s:param name="companyId" value="authenticatedWaoUser.waoUser.company.topiaId" /> - <s:param name="boatId" value="topiaId" /> - </s:url> - <s:a href="%{boatDetailsUrl}" cssClass="boat-details-action"> - <s:property value="%{'' + immatriculation}"/> - </s:a> - </s:if> - <s:else> - <s:property value="%{'' + immatriculation}"/> - </s:else> - </td> - <td<s:if test="!active"> class="inactive"</s:if>> - <s:property value="name"/> - </td> - <td><s:property value="boatLength"/></td> - <td><s:property value="%{'' + buildYear}"/></td> - <td><s:property value="district.districtCode"/></td> - <td> - <s:if test="portOfRegistry != null"> - <span data-original-title="<s:property value="portOfRegistry.description"/>" data-toggle="tooltip" data-placement="bottom"> - <s:property value="portOfRegistry.portCode"/> - </span> - </s:if> - </td> - </tr> - </s:iterator> - </todby> - </table> - - <%-- Pagination --%> - <div class="pagination"> - <ul> - <s:url var="fullUrl" includeParams="get"/> - <s:set var="paginationUrl" value="%{getPaginationUrl(#fullUrl)}"/> - <s:if test="firstRangePage > 2"> - <li> - <a href="${paginationUrl}0">1</a> - </li> - <li> - <a href="${paginationUrl}1">2</a> - </li> - <li> - <span>...</span> - </li> - </s:if> - - <s:iterator var="currentPage" begin="firstRangePage" end="lastRangePage"> - <li class="<s:if test="#currentPage - 1 == pagination.currentPage.pageNumber">active</s:if>"> - <a href="${paginationUrl}${currentPage - 1}"> - <s:property/> - </a> - </li> - </s:iterator> - - <s:if test="lastRangePage < pagination.pageCount - 1"> - <li> - <span>...</span> - </li> - <li> - <a href="${paginationUrl}${pagination.pageCount - 2}"> - <s:property value="pagination.pageCount - 1"/> - </a> - </li> - <li> - <a href="${paginationUrl}${pagination.pageCount - 1}"> - <s:property value="pagination.pageCount"/> - </a> - </li> - </s:if> - </ul> - </div> - </div> - - <s:if test="authenticatedWaoUser.authorizedToViewBoatDetails"> - - <div> - <div class="arrow-right"></div> - <div id="boat-details"> - <div class="alert alert-info"> - <s:text name="wao.ui.tip.youMustChooseBoat" /> - </div> - </div> - </div> - </s:if> - -</div> - -</html> Modified: branches/wao-4.0-obsvente/wao-web/src/main/webapp/endpoints-js.jsp =================================================================== --- branches/wao-4.0-obsvente/wao-web/src/main/webapp/endpoints-js.jsp 2014-06-20 13:09:06 UTC (rev 2075) +++ branches/wao-4.0-obsvente/wao-web/src/main/webapp/endpoints-js.jsp 2014-06-20 13:56:00 UTC (rev 2076) @@ -29,15 +29,15 @@ // json WAO.OBSMER_SAMPLE_ROWS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="sample-rows-filter-values-json"/>'; - WAO.OBSMER_UPDATE_BOAT_INFOS_JSON_URL = '<s:url namespace="/obsmer" action="update-boat-infos-json"/>'; - WAO.OBSMER_BOATS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="boats-filter-values-json"/>'; - WAO.OBSMER_GET_BOAT_CONTACTS_COUNT_JSON_URL = '<s:url namespace="/obsmer" action="get-boat-contacts-count-json"/>'; - WAO.OBSMER_SEARCH_BOAT_JSON_URL = '<s:url namespace="/obsmer" action="search-boat-json"/>'; + WAO.UPDATE_BOAT_INFOS_JSON_URL = '<s:url namespace="/" action="update-boat-infos-json"/>'; + WAO.BOATS_FILTER_VALUES_JSON_URL = '<s:url namespace="/" action="boats-filter-values-json"/>'; + WAO.GET_BOAT_CONTACTS_COUNT_JSON_URL = '<s:url namespace="/" action="get-boat-contacts-count-json"/>'; + WAO.SEARCH_BOAT_JSON_URL = '<s:url namespace="/" action="search-boat-json"/>'; WAO.OBSMER_CONTACTS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="contacts-filter-values-json"/>'; // fragments - WAO.OBSMER_BOAT_DETAILS_URL = '<s:url namespace="/obsmer" action="boat-details"/>'; + WAO.BOAT_DETAILS_URL = '<s:url namespace="/" action="boat-details"/>'; });
participants (1)
-
bleny@users.forge.codelutin.com