Commit 4a4f16a5 authored by PECQUOT's avatar PECQUOT

[enh] In programs and rule lists UIs, opening the 'add' elements screen now...

[enh] In programs and rule lists UIs, opening the 'add' elements screen now open the generic SelectFilterUI (instead of specific UI), and show already selected elements but not removable (Mantis #47998)
[enh] Use the new quadrige3-ui-core-common module with many model refactoring
Signed-off-by: PECQUOT's avatarlp1ee9d <ludovic.pecquot@e-is.pro>
parent a17afe1c
......@@ -178,7 +178,7 @@
<maven.compiler.debug>true</maven.compiler.debug>
<!-- Quadrige3 Core version -->
<quadrige3-core.version>3.4.2</quadrige3-core.version>
<quadrige3-core.version>3.4.3-SNAPSHOT</quadrige3-core.version>
<!-- Last ReefDb launcher version -->
<launcherVersion>3.0.3</launcherVersion>
......@@ -315,7 +315,7 @@
</dependency>
<dependency>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core-client</artifactId>
<artifactId>quadrige3-ui-core-common</artifactId>
<version>${quadrige3-core.version}</version>
</dependency>
......
......@@ -27,7 +27,7 @@
<!--quadrige3 -->
<dependency>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-core-client</artifactId>
<artifactId>quadrige3-ui-core-common</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
......@@ -60,7 +60,11 @@
<artifactId>quadrige3-test-shared</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-ui-core-common</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -124,7 +124,7 @@ public class ReefDbProgramDaoImpl extends ProgramDaoImpl implements ReefDbProgra
cacheByCode.put(program.getCode(), program);
}
return result;
return ImmutableList.copyOf(result);
}
private void getProgramPrivileges(ProgramDTO program) {
......@@ -429,7 +429,7 @@ public class ReefDbProgramDaoImpl extends ProgramDaoImpl implements ReefDbProgra
target.setIsDepartmentHermetic(Daos.convertToString(source.isDepartmentHermetic()));
// Set update date (only if local program)
if (Daos.isLocalStatus(source.getStatus())) {
if (ReefDbBeans.isLocalStatus(source.getStatus())) {
target.setUpdateDt(newUpdateTimestamp());
}
......
......@@ -39,11 +39,11 @@ import fr.ifremer.quadrige3.core.dao.referential.pmfm.PmfmImpl;
import fr.ifremer.quadrige3.core.dao.technical.Assert;
import fr.ifremer.quadrige3.core.dao.technical.Dates;
import fr.ifremer.quadrige3.core.dao.technical.hibernate.TemporaryDataHelper;
import fr.ifremer.quadrige3.ui.core.dto.QuadrigeBeanComparator;
import fr.ifremer.reefdb.config.ReefDbConfiguration;
import fr.ifremer.reefdb.dao.administration.user.ReefDbDepartmentDao;
import fr.ifremer.reefdb.dao.referential.pmfm.ReefDbPmfmDao;
import fr.ifremer.reefdb.dao.technical.Daos;
import fr.ifremer.reefdb.dto.ReefDbBeanComparator;
import fr.ifremer.reefdb.dto.ReefDbBeanFactory;
import fr.ifremer.reefdb.dto.ReefDbBeans;
import fr.ifremer.reefdb.dto.configuration.programStrategy.*;
......@@ -109,7 +109,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
result.add(toStrategyDTO(Arrays.asList(row).iterator()));
}
return result;
return ImmutableList.copyOf(result);
}
......@@ -126,7 +126,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
result.add(toAppliedStrategyDTO(row));
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -142,7 +142,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
result.add(toAppliedStrategyDTO(row));
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -159,7 +159,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
result.add(toAppliedPeriod(row, dbTimezone));
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -218,7 +218,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
result.add(previousDTO);
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -238,7 +238,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
}
}
return pmfmStrategies;
return ImmutableSet.copyOf(pmfmStrategies);
}
/** {@inheritDoc} */
......@@ -373,7 +373,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
Map<String, AppliedStrategy> remainingAppliedStrategyByKey = buildAppliedStrategyMap(remainingAppliedStrategies.values(), dbTimezone);
AppliedStrategy previousAppliedStrategy = null;
// sort AppliedStrategyDTO by natural Id = monitoringLocation.Id
strategy.getAppliedStrategies().sort(new ReefDbBeanComparator());
strategy.getAppliedStrategies().sort(new QuadrigeBeanComparator());
for (AppliedStrategyDTO appliedStrategy : strategy.getAppliedStrategies()) {
// save an applied strategy only if dates are valid or department set
......@@ -923,7 +923,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
target.setStratDc(source.getComment());
// Set update date on strategy (only for local strategy)
if (Daos.isLocalStatus(program.getStatus())) {
if (ReefDbBeans.isLocalStatus(program.getStatus())) {
target.setUpdateDt(newUpdateTimestamp());
}
......
......@@ -23,10 +23,7 @@ package fr.ifremer.reefdb.dao.administration.user;
* #L%
*/
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.*;
import fr.ifremer.quadrige3.core.dao.administration.user.Department;
import fr.ifremer.quadrige3.core.dao.administration.user.DepartmentDaoImpl;
import fr.ifremer.quadrige3.core.dao.administration.user.DepartmentImpl;
......@@ -38,6 +35,7 @@ import fr.ifremer.quadrige3.core.dao.technical.hibernate.TemporaryDataHelper;
import fr.ifremer.quadrige3.core.service.technical.CacheService;
import fr.ifremer.reefdb.dao.technical.Daos;
import fr.ifremer.reefdb.dto.ReefDbBeanFactory;
import fr.ifremer.reefdb.dto.ReefDbBeans;
import fr.ifremer.reefdb.dto.referential.DepartmentDTO;
import fr.ifremer.reefdb.dto.referential.PersonDTO;
import fr.ifremer.reefdb.service.StatusFilter;
......@@ -159,7 +157,7 @@ public class ReefDbDepartmentDaoImpl extends DepartmentDaoImpl implements ReefDb
}
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -215,7 +213,7 @@ public class ReefDbDepartmentDaoImpl extends DepartmentDaoImpl implements ReefDb
result.add(toDepartmentDTO(Arrays.asList(source).iterator(), true));
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -227,7 +225,7 @@ public class ReefDbDepartmentDaoImpl extends DepartmentDaoImpl implements ReefDb
if (source.getStatus() == null) {
source.setStatus(Daos.getStatus(StatusCode.LOCAL_ENABLE));
}
Assert.isTrue(Daos.isLocalStatus(source.getStatus()), "source must have local status");
Assert.isTrue(ReefDbBeans.isLocalStatus(source.getStatus()), "source must have local status");
Status status = load(StatusImpl.class, source.getStatus().getCode());
......@@ -240,7 +238,7 @@ public class ReefDbDepartmentDaoImpl extends DepartmentDaoImpl implements ReefDb
target = create(target);
} else {
target = get(source.getId());
Assert.isTrue(Daos.isLocalStatus(target.getStatus()), "target must have local status");
Assert.isTrue(ReefDbBeans.isLocalStatus(target.getStatus()), "target must have local status");
Status oldStatus = target.getStatus();
target.setStatus(status);
......
......@@ -23,6 +23,7 @@ package fr.ifremer.reefdb.dao.administration.user;
* #L%
*/
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
......@@ -160,7 +161,7 @@ public class ReefDbQuserDaoImpl extends QuserDaoImpl implements ReefDbQuserDao {
result.add(target);
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......
......@@ -290,7 +290,9 @@ public class ReefDbSurveyDaoImpl extends SurveyDaoImpl implements ReefDbSurveyDa
"locationId", IntegerType.INSTANCE, locationId,
"appliedStrategyId", IntegerType.INSTANCE, appliedStrategyId,
"startDate", DateType.INSTANCE, startDate,
"endDate", DateType.INSTANCE, endDate);
"endDate", DateType.INSTANCE, endDate,
"synchronizationStatusToIgnore", StringType.INSTANCE, SynchronizationStatus.DELETED.getValue()
);
}
@Override
......@@ -301,7 +303,9 @@ public class ReefDbSurveyDaoImpl extends SurveyDaoImpl implements ReefDbSurveyDa
"locationId", IntegerType.INSTANCE, locationId,
"appliedStrategyId", IntegerType.INSTANCE, appliedStrategyId,
"startDate", DateType.INSTANCE, startDate,
"endDate", DateType.INSTANCE, endDate);
"endDate", DateType.INSTANCE, endDate,
"synchronizationStatusToIgnore", StringType.INSTANCE, SynchronizationStatus.DELETED.getValue()
);
}
/** {@inheritDoc} */
......
......@@ -23,10 +23,7 @@ package fr.ifremer.reefdb.dao.referential;
* #L%
*/
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.*;
import fr.ifremer.quadrige3.core.dao.referential.AnalysisInstrument;
import fr.ifremer.quadrige3.core.dao.referential.AnalysisInstrumentDaoImpl;
import fr.ifremer.quadrige3.core.dao.referential.StatusCode;
......@@ -36,6 +33,7 @@ import fr.ifremer.quadrige3.core.dao.technical.hibernate.TemporaryDataHelper;
import fr.ifremer.quadrige3.core.service.technical.CacheService;
import fr.ifremer.reefdb.dao.technical.Daos;
import fr.ifremer.reefdb.dto.ReefDbBeanFactory;
import fr.ifremer.reefdb.dto.ReefDbBeans;
import fr.ifremer.reefdb.dto.referential.AnalysisInstrumentDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.hibernate.Query;
......@@ -102,7 +100,7 @@ public class ReefDbAnalysisInstrumentDaoImpl extends AnalysisInstrumentDaoImpl i
cacheById.put(analysisInstrument.getId(), analysisInstrument);
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -120,7 +118,7 @@ public class ReefDbAnalysisInstrumentDaoImpl extends AnalysisInstrumentDaoImpl i
result.add(toAnalysisInstrumentDTO(Arrays.asList(source).iterator()));
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -137,7 +135,7 @@ public class ReefDbAnalysisInstrumentDaoImpl extends AnalysisInstrumentDaoImpl i
result.add(toAnalysisInstrumentDTO(Arrays.asList(source).iterator()));
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -251,7 +249,7 @@ public class ReefDbAnalysisInstrumentDaoImpl extends AnalysisInstrumentDaoImpl i
if (analysisInstrument.getStatus() == null) {
analysisInstrument.setStatus(Daos.getStatus(StatusCode.LOCAL_ENABLE));
}
Assert.isTrue(Daos.isLocalStatus(analysisInstrument.getStatus()), "source must have local status");
Assert.isTrue(ReefDbBeans.isLocalStatus(analysisInstrument.getStatus()), "source must have local status");
AnalysisInstrument target;
if (analysisInstrument.getId() == null) {
......@@ -259,7 +257,7 @@ public class ReefDbAnalysisInstrumentDaoImpl extends AnalysisInstrumentDaoImpl i
target.setAnalInstId(TemporaryDataHelper.getNewNegativeIdForTemporaryData(getSession(), target.getClass()));
} else {
target = get(analysisInstrument.getId());
Assert.isTrue(Daos.isLocalStatus(target.getStatus()), "target must have local status");
Assert.isTrue(ReefDbBeans.isLocalStatus(target.getStatus()), "target must have local status");
}
target.setAnalInstNm(analysisInstrument.getName());
......
......@@ -23,6 +23,7 @@ package fr.ifremer.reefdb.dao.referential;
* #L%
*/
import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
import fr.ifremer.reefdb.dto.referential.*;
import org.springframework.cache.annotation.Cacheable;
......@@ -148,7 +149,7 @@ public interface ReefDbReferentialDao {
* @return a {@link java.util.List} object.
*/
@Cacheable(value = "all_citations")
List<BaseReferentialDTO> getAllCitations();
List<CitationDTO> getAllCitations();
/**
* <p>getAllPhotoTypes.</p>
......
......@@ -23,11 +23,13 @@ package fr.ifremer.reefdb.dao.referential;
* #L%
*/
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import fr.ifremer.quadrige3.core.dao.referential.StatusCode;
import fr.ifremer.quadrige3.core.dao.technical.Assert;
import fr.ifremer.quadrige3.core.dao.technical.hibernate.HibernateDaoSupport;
import fr.ifremer.quadrige3.core.service.technical.CacheService;
import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
import fr.ifremer.reefdb.config.ReefDbConfiguration;
import fr.ifremer.reefdb.dao.referential.pmfm.ReefDbPmfmDao;
import fr.ifremer.reefdb.dao.technical.Daos;
......@@ -103,7 +105,7 @@ public class ReefDbReferentialDaoImpl extends HibernateDaoSupport implements Ree
cacheById.put(depthLevel.getId(), depthLevel);
}
return result;
return ImmutableList.copyOf(result);
}
/** {@inheritDoc} */
......@@ -146,7 +148,7 @@ public class ReefDbReferentialDaoImpl extends HibernateDaoSupport implements Ree
values = pmfm.getQualitativeValues();
}
return ReefDbBeans.transformCollection(values,
return ImmutableList.copyOf(ReefDbBeans.transformCollection(values,
input -> {
DepthDTO result = ReefDbBeanFactory.newDepthDTO();
result.setId(input.getId());
......@@ -155,7 +157,7 @@ public class ReefDbReferentialDaoImpl extends HibernateDaoSupport implements Ree
// add to cache
cacheById.put(result.getId(), result);
return result;
});
}));