Commit f1c960ce authored by PECQUOT's avatar PECQUOT
Browse files

Merge branch 'release/3.7.3'

parents 2ee714ac 15d44095
## Sprint 76 - v3.7.3
- Pas de mise à jour de modèle
- Le répertoire OLD contenant les anciennes versions de l'application est supprimé.
Si des fichiers autres que ceux de l'historique sont présents dans ce répertoire, ils seront supprimés également !
## Sprint 75 - v3.7.2
- Aucune mise à jour de base de données
......
......@@ -10,7 +10,7 @@
<groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId>
<version>3.7.2</version>
<version>3.7.3</version>
<packaging>pom</packaging>
<name>Reef DB</name>
......@@ -171,7 +171,7 @@
<maven.compiler.debug>true</maven.compiler.debug>
<!-- Quadrige3 Core version -->
<quadrige3-core.version>3.5.1</quadrige3-core.version>
<quadrige3-core.version>3.5.4</quadrige3-core.version>
<!-- Last ReefDb launcher version -->
<launcherVersion>3.0.3</launcherVersion>
......@@ -206,14 +206,10 @@
<dbunit.version>2.5.3</dbunit.version>
<junit.version>4.12</junit.version>
<!-- release config -->
<!-- <autoVersionSubmodules>true</autoVersionSubmodules>-->
<!-- <goals>deploy</goals>-->
<!-- <arguments>-Dliquibase.should.run=false</arguments>-->
<!-- <preparationGoals>verify</preparationGoals>-->
<!-- gitflow release plugin -->
<gitflowPluginVersion>1.12.0-EIS</gitflowPluginVersion>
<!-- to deploy with scpexe for maven 3 -->
<wagonSshVersion>3.3.3</wagonSshVersion>
<!--license-maven-plugin config -->
<maven.license.file>${project.basedir}/LICENSE.txt</maven.license.file>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId>
<version>3.7.2</version>
<version>3.7.3</version>
</parent>
<artifactId>reefdb-core</artifactId>
......
......@@ -320,6 +320,9 @@ public class ReefDbPhotoDaoImpl extends PhotoDaoImpl implements ReefDbPhotoDao {
result.setPhotoType(referentialDao.getPhotoTypeByCode(photoTypeCode));
}
// remote id for download purpose
result.setRemoteId((Integer) it.next());
return result;
}
......
......@@ -90,6 +90,7 @@ public interface ReefDbPmfmDao {
ALL_PMFMS_CACHE,
PMFM_BY_ID_CACHE,
PMFMS_BY_IDS_CACHE,
PMFMS_BY_CRITERIA_CACHE,
ReefDbQualitativeValueDao.QUALITATIVE_VALUES_BY_PMFM_ID_CACHE
}, allEntries = true)
void savePmfms(List<? extends PmfmDTO> pmfms);
......@@ -103,6 +104,7 @@ public interface ReefDbPmfmDao {
ALL_PMFMS_CACHE,
PMFM_BY_ID_CACHE,
PMFMS_BY_IDS_CACHE,
PMFMS_BY_CRITERIA_CACHE,
ReefDbQualitativeValueDao.QUALITATIVE_VALUES_BY_PMFM_ID_CACHE
}, allEntries = true)
void deletePmfms(List<Integer> pmfmIds);
......@@ -118,6 +120,7 @@ public interface ReefDbPmfmDao {
ALL_PMFMS_CACHE,
PMFM_BY_ID_CACHE,
PMFMS_BY_IDS_CACHE,
PMFMS_BY_CRITERIA_CACHE,
ReefDbQualitativeValueDao.QUALITATIVE_VALUES_BY_PMFM_ID_CACHE
}, allEntries = true)
void replaceTemporaryPmfm(Integer sourceId, Integer targetId, boolean delete);
......
......@@ -2220,7 +2220,7 @@
<![CDATA[
SELECT p.photoId, p.objectType.objectTypeCd, p.objectId,
p.photoNm, p.photoCm, p.photoDt, p.photoDirDc, p.photoLk,
p.photoType.photoTypeCd
p.photoType.photoTypeCd, p.remoteId
FROM PhotoImpl p
WHERE (p.objectType.objectTypeCd = :surveyObjectTypeCode AND p.objectId = :surveyId)
OR
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId>
<version>3.7.2</version>
<version>3.7.3</version>
</parent>
<artifactId>reefdb-ui-swing</artifactId>
......
......@@ -29,7 +29,6 @@ import fr.ifremer.quadrige3.synchro.service.client.SynchroClientService;
import fr.ifremer.quadrige3.synchro.service.client.vo.SynchroClientExportToFileResult;
import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
import fr.ifremer.quadrige3.ui.swing.action.AbstractReloadCurrentScreenAction;
import fr.ifremer.quadrige3.ui.swing.model.ProgressionUIModel;
import fr.ifremer.quadrige3.ui.swing.synchro.SynchroUIContext;
import fr.ifremer.quadrige3.ui.swing.synchro.SynchroUIHandler;
import fr.ifremer.reefdb.dto.ReefDbBeans;
......@@ -100,7 +99,7 @@ public class ExportDataToFileAction extends AbstractReloadCurrentScreenAction {
// Ask user to select program to import
programCodes = getSynchroUIContext().getExportDataProgramCodes();
{
ProgramSelectUI programSelectUI = new ProgramSelectUI((ApplicationUI) getUI(), StatusFilter.ALL, programCodes, true);
ProgramSelectUI programSelectUI = new ProgramSelectUI((ApplicationUI) getUI(), null, StatusFilter.ALL, programCodes, true, false);
handler.openDialog(programSelectUI, t("reefdb.action.synchro.export.dataProgramCodes.title"), new Dimension(800, 400));
List<ProgramDTO> programs = programSelectUI.getModel().getSelectedPrograms();
......@@ -150,14 +149,14 @@ public class ExportDataToFileAction extends AbstractReloadCurrentScreenAction {
SynchroClientService synchroService = ReefDbServiceLocator.instance().getSynchroClientService();
int userId = SecurityContextHelper.getQuadrigeUserId();
ProgressionUIModel mainProgressionModel = createProgressionUIModel(100);
createProgressionUIModel(100);
// Save the UI context
getSynchroUIContext().setExportDataProgramCodes(programCodes);
getSynchroUIContext().saveExportContext();
// build temp database and export local to temp
getProgressionUIModel().setMessage(t("reefdb.synchro.progress.export"));
getProgressionUIModel().setMessage(t("quadrige3.synchro.progress.export"));
// export directory is set by the synchronization service
SynchroClientExportToFileResult exportResult = synchroService.exportToFile(userId,
......@@ -180,7 +179,7 @@ public class ExportDataToFileAction extends AbstractReloadCurrentScreenAction {
getProgressionUIModel().setTotal(100);
// restore action progression model
setProgressionUIModel(mainProgressionModel);
setProgressionUIModel(getProgressionUIModel());
// do NOT reload screen if no data
setSkipScreenReload(!hasData);
......
......@@ -25,9 +25,11 @@ package fr.ifremer.reefdb.ui.swing.action;
import com.google.common.collect.Multimap;
import fr.ifremer.common.synchro.service.SynchroResult;
import fr.ifremer.quadrige3.core.dao.technical.ZipUtils;
import fr.ifremer.quadrige3.core.exception.QuadrigeTechnicalException;
import fr.ifremer.quadrige3.core.security.SecurityContextHelper;
import fr.ifremer.quadrige3.core.service.http.HttpNotFoundException;
import fr.ifremer.quadrige3.synchro.meta.data.DataSynchroTables;
import fr.ifremer.quadrige3.synchro.service.client.SynchroClientService;
import fr.ifremer.quadrige3.synchro.service.client.SynchroRejectedRowResolver;
import fr.ifremer.quadrige3.synchro.service.client.SynchroRestClientService;
......@@ -49,11 +51,11 @@ import fr.ifremer.reefdb.service.StatusFilter;
import fr.ifremer.reefdb.ui.swing.ReefDbUIContext;
import fr.ifremer.reefdb.ui.swing.content.ReefDbMainUIHandler;
import fr.ifremer.reefdb.ui.swing.content.synchro.program.ProgramSelectUI;
import fr.ifremer.reefdb.ui.swing.util.ReefDbUIs;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.jaxx.application.ApplicationIOUtil;
import org.nuiton.util.ZipUtil;
import javax.swing.JOptionPane;
import java.awt.Dimension;
......@@ -61,6 +63,7 @@ import java.io.File;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static org.nuiton.i18n.I18n.t;
......@@ -123,26 +126,32 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
// load actual export context
getSynchroUIContext().setDirection(SynchroDirection.EXPORT);
getSynchroUIContext().loadExportContext();
userId = SecurityContextHelper.getQuadrigeUserId();
// Ask user to select program to import
programCodes = getSynchroUIContext().getExportDataProgramCodes();
{
userId = SecurityContextHelper.getQuadrigeUserId();
ProgramSelectUI programSelectUI = new ProgramSelectUI((ApplicationUI) getUI(), userId, StatusFilter.NATIONAL_ACTIVE, programCodes);
handler.openDialog(programSelectUI, t("reefdb.action.synchro.export.dataProgramCodes.title"), new Dimension(800, 400));
// Hide photo option (Mantis #48536)
ProgramSelectUI programSelectUI = new ProgramSelectUI((ApplicationUI) getUI(), userId, StatusFilter.NATIONAL_ACTIVE, programCodes, false, false);
List<ProgramDTO> programs = programSelectUI.getModel().getSelectedPrograms();
// Force photo option to true (Mantis #48536)
programSelectUI.getModel().setEnablePhoto(true);
// If no programs selected (or user cancelled): exit
if (CollectionUtils.isEmpty(programs)) {
return false;
}
handler.openDialog(programSelectUI, t("reefdb.action.synchro.export.dataProgramCodes.title"), new Dimension(800, 400));
List<ProgramDTO> programs = programSelectUI.getModel().getSelectedPrograms();
// Get selected programs as code list
programCodes = new LinkedHashSet<>(ReefDbBeans.collectProperties(programs, ProgramDTO.PROPERTY_CODE));
// If no programs selected (or user cancelled): exit
if (CollectionUtils.isEmpty(programs)) {
return false;
}
// Get selected programs as code list
programCodes = new LinkedHashSet<>(ReefDbBeans.collectProperties(programs, ProgramDTO.PROPERTY_CODE));
// get photo option and set it in context
getSynchroUIContext().setExportPhoto(programSelectUI.getModel().isEnablePhoto());
return true;
}
......@@ -162,13 +171,12 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
getSynchroUIContext().setExportDataProgramCodes(programCodes);
getSynchroUIContext().saveExportContext();
ProgressionUIModel mainProgressionModel = createProgressionUIModel(100);
createProgressionUIModel(100);
getSynchroUIContext().setStatus(SynchroProgressionStatus.RUNNING);
getSynchroUIContext().saveExportContext();
// build temp database and export local to temp
getProgressionUIModel().setMessage(t("reefdb.synchro.progress.export"));
getProgressionUIModel().setMessage(t("quadrige3.synchro.progress.export"));
if (!getConfig().isSynchronizationUsingServer()) {
......@@ -188,10 +196,13 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
// Do a referential import if need (see mantis #25665)
doImportReferential();
// After potential user privilege updates, check write access (Mantis #39506)
if (!checkWriteAccess()) return;
// export directory is set by the synchronization service
SynchroClientExportResult exportResult = synchroService.exportDataToTempDb(userId,
programCodes,
false, // photo disable by default
getSynchroUIContext().isExportPhoto(),
getProgressionUIModel(),
100);
DataSynchroContext context = exportResult.getDataContext();
......@@ -203,12 +214,23 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
return;
}
// check photo volume
int nbPhoto = context.getResult().getNbRows(DataSynchroTables.PHOTO.name());
int threshold = getConfig().getSynchroPhotoMaxNumberThreshold();
if (threshold > 0 && nbPhoto > threshold) {
if (getContext().getDialogHelper().showConfirmDialog(
t("quadrige3.synchro.export.photo.overThreshold.message", nbPhoto),
t("reefdb.action.synchro.export.title"),
JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION)
return;
}
// compress the database
dbDirToExport = exportResult.getTempDbExportDirectory();
getProgressionUIModel().setMessage(t("reefdb.synchro.progress.compress"));
getProgressionUIModel().setMessage(t("quadrige3.synchro.progress.compress"));
String filename = dbDirToExport.getName() + ".zip";
File zipFile = new File(dbDirToExport.getParent(), filename);
ZipUtil.compress(zipFile, dbDirToExport);
ZipUtils.compressFilesInPath(dbDirToExport.toPath(), zipFile.toPath(), getProgressionUIModel(), false, true);
getSynchroUIContext().setExportFileName(zipFile.getName());
getSynchroUIContext().saveExportContext();
......@@ -265,7 +287,7 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
// Finish export
if (needDownloadResultAndFinish) {
try {
finishExportThenCleanFiles(exportResult, mainProgressionModel);
finishExportThenCleanFiles(exportResult, getProgressionUIModel());
break; // stop loop
}
......@@ -276,8 +298,7 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
throw new SynchroException(t("reefdb.action.synchro.export.failed.serverJobStarted.log", e.getMessage()), e); // stop
}
}
}
catch(QuadrigeTechnicalException e) {
} catch(QuadrigeTechnicalException e) {
retryCounter++;
log.debug(String.format("Error during export: %s", e.getMessage()), e);
getProgressionUIModel().setMessage(t("reefdb.action.synchro.export.retry.progression", retryCounter, getConfig().getSynchronizationMaxRetryCount()));
......@@ -285,12 +306,11 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
// Retry many times, or ask user to retry (mantis #35441)
if (retryCounter < getConfig().getSynchronizationMaxRetryCount()) {
Thread.sleep(getConfig().getSynchronizationRetryTimeout()); // Wait then loop (= retry)
}
else {
} else {
int result = getContext().getDialogHelper().showOptionDialog(null,
serverJobRunning
? t("reefdb.action.synchro.export.retry.ask.serverJobStarted", getConfig().getAdminEmail())
? t("reefdb.action.synchro.export.retry.ask.serverJobStarted",
getConfig().getAdminEmail())
: t("reefdb.action.synchro.export.retry.ask"),
t("reefdb.action.synchro.export.retry.title"), JOptionPane.ERROR_MESSAGE, JOptionPane.YES_NO_OPTION);
......@@ -366,8 +386,7 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
getSynchroUIContext().getSynchroExportContext(),
t("reefdb.action.synchro.export.failed.serverJobStarted.history",
error != null ? error.getMessage() : ""));
}
else {
} else {
getContext().getSynchroHandler().report(t("reefdb.action.synchro.export.failed"));
}
}
......@@ -398,17 +417,16 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
if (resultFileExists) {
exportResult.setServerResult(serverResult);
mainProgressionModel.setMessage(t("reefdb.synchro.progress.finishExport"));
mainProgressionModel.setMessage(t("quadrige3.synchro.progress.finishExport"));
SynchroRejectedRowResolver rejectResolver = new SynchroRejectedRowUIResolver(getContext().getDialogHelper(), false /*export*/);
SynchroClientService synchroService = ReefDbServiceLocator.instance().getSynchroClientService();
try {
hasRejectMessages = synchroService.finishExportData(userId, exportResult, rejectResolver, serverFailed, false /* do not revert PKs inside this method */);
}
catch(QuadrigeTechnicalException e) {
} catch(QuadrigeTechnicalException e) {
// Conversion to SynchroException is need, to avoid a retry
throw new SynchroException(t("reefdb.error.synchro.export.finish"), e);
throw new SynchroException(t("quadrige3.error.synchro.export.finish"), e);
}
// get Pks to revert, then apply revert
......@@ -429,7 +447,7 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
if (!resultFileExists || !hasRejectMessages) {
// If nothing was displayed yet, throw the exception (will display an error dialog)
throw new SynchroException(t("reefdb.error.synchro.status", serverErrorMessage));
throw new SynchroException(t("quadrige3.error.synchro.status", serverErrorMessage));
}
}
}
......@@ -441,6 +459,8 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
getSynchroUIContext().resetImportContext();
getSynchroUIContext().setImportData(true);
getSynchroUIContext().setImportReferential(false);
// always enable photo on this import (Mantis #48536 & #48479)
getSynchroUIContext().setImportPhoto(true);
getSynchroUIContext().setImportDataPkIncludes(pksToRevert);
getSynchroUIContext().setDirection(SynchroDirection.IMPORT);
getSynchroUIContext().setImportDataForceEditedRowOverride(true);
......@@ -469,13 +489,13 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
private void cleanFiles() throws Exception {
// clean local files
ApplicationIOUtil.forceDeleteOnExit(dbDirToExport, t("reefdb.error.delete.directory", dbDirToExport.getAbsolutePath()));
ApplicationIOUtil.forceDeleteOnExit(dbDirToExport, t("quadrige3.error.delete.directory", dbDirToExport.getAbsolutePath()));
File fileToDelete = new File(dbDirToExport.getParent(), dbDirToExport.getName() + ".zip");
ApplicationIOUtil.deleteFile(fileToDelete, t("reefdb.error.delete.directory", fileToDelete.getAbsolutePath()));
ApplicationIOUtil.deleteFile(fileToDelete, t("quadrige3.error.delete.directory", fileToDelete.getAbsolutePath()));
fileToDelete = new File(dbDirToExport.getParent(), dbDirToExport.getName() + ".json");
if (fileToDelete.exists()) {
ApplicationIOUtil.deleteFile(fileToDelete, t("reefdb.error.delete.directory", fileToDelete.getAbsolutePath()));
ApplicationIOUtil.deleteFile(fileToDelete, t("quadrige3.error.delete.directory", fileToDelete.getAbsolutePath()));
}
// send acknowledge
......@@ -500,4 +520,20 @@ public class ExportSynchroAction extends AbstractReloadCurrentScreenAction {
// Restore previous running status (fix mantis #39390)
getSynchroUIContext().setStatus(SynchroProgressionStatus.RUNNING);
}
private boolean checkWriteAccess() {
List<ProgramDTO> programs = getContext().getProgramStrategyService().getRemoteProgramsByUser(getContext().getAuthenticationInfo());
Set<String> allowedProgramCodes = programs.stream().map(ProgramDTO::getCode).collect(Collectors.toSet());
if (CollectionUtils.isEmpty(programs) || !allowedProgramCodes.containsAll(programCodes)) {
getContext().getDialogHelper().showWarningDialog(
t("reefdb.synchro.export.accessDenied.program.topMessage"),
ReefDbUIs.getHtmlString(CollectionUtils.removeAll(programCodes, allowedProgramCodes)),
t("reefdb.synchro.export.accessDenied.program.bottomMessage"),
t("reefdb.action.synchro.export.title")
);
return false;
}
return true;
}
}
......@@ -138,7 +138,7 @@ public class ImportFromFileSynchroAction extends AbstractReloadCurrentScreenActi
// If last synchronization has failedAction
if (getSynchroUIContext().getStatus() == SynchroProgressionStatus.FAILED) {
getSynchroHandler().report(t("reefdb.synchro.report.failed"));
getSynchroHandler().report(t("quadrige3.synchro.report.failed"));
return;
}
......@@ -287,7 +287,7 @@ public class ImportFromFileSynchroAction extends AbstractReloadCurrentScreenActi
// build temp database and export local to temp
getProgressionUIModel().setTotal(100);
getProgressionUIModel().setMessage(t("reefdb.synchro.progress.import"));
getProgressionUIModel().setMessage(t("quadrige3.synchro.progress.import"));
SynchroRejectedRowResolver rejectResolver = new SynchroRejectedRowUIResolver(getContext().getDialogHelper(), true /*isImport*/);
// export directory is set by the synchronization service
......@@ -307,7 +307,7 @@ public class ImportFromFileSynchroAction extends AbstractReloadCurrentScreenActi
if (log.isInfoEnabled()) {
log.info("Reset all caches.");
}
getProgressionUIModel().setMessage(t("reefdb.synchro.progress.resetCache"));
getProgressionUIModel().setMessage(t("quadrige3.synchro.progress.resetCache"));
getContext().reloadDbCache(getProgressionUIModel());
}
......@@ -375,7 +375,7 @@ public class ImportFromFileSynchroAction extends AbstractReloadCurrentScreenActi
public void postFailedAction(Throwable error) {
super.postFailedAction(error);
getSynchroHandler().report(t("reefdb.synchro.report.failed"), true);
getSynchroHandler().report(t("quadrige3.synchro.report.failed"), true);
getSynchroUIContext().setStatus(SynchroProgressionStatus.FAILED);
log.error("Synchronization import from file failed");
......
......@@ -12,12 +12,12 @@ package fr.ifremer.reefdb.ui.swing.action;
* 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%
......@@ -49,7 +49,7 @@ import static org.nuiton.i18n.I18n.t;
/**
* Main import synchro action
*
* <p>
* Created by Ludovic on 18/05/2015.
*/
public class ImportSynchroAction extends AbstractReefDbMainUIAction {
......@@ -58,8 +58,6 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
private boolean referentialOnly = false;
private boolean silentIfNoUpdate = false;
private boolean silentIfUpdate = false;
private boolean checkOnly = false;
private Set<String> programCodes;
/**
* <p>Constructor for ImportSynchroAction.</p>
......@@ -100,15 +98,9 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
this.silentIfUpdate = silentIfUpdate;
}
public void setCheckOnly(boolean checkOnly) {
this.checkOnly = checkOnly;
}
public void forceProgramCodes(Set<String> programCodes) {
this.programCodes = programCodes;
}
/** {@inheritDoc} */
/**
* {@inheritDoc}
*/
@Override
public boolean prepareAction() throws Exception {
......@@ -126,7 +118,9 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
return super.prepareAction();
}
/** {@inheritDoc} */
/**
* {@inheritDoc}
*/
@Override
public void doAction() throws Exception {
// test actual progression
......@@ -137,7 +131,7 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
// If last synchronization has failedAction
if (getSynchroUIContext().getStatus() == SynchroProgressionStatus.FAILED) {
getSynchroHandler().report(t("reefdb.synchro.report.failed"));
getSynchroHandler().report(t("quadrige3.synchro.report.failed"));
return;
}
......@@ -173,15 +167,11 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
if (isSynchronizationUsingServer
&& !getContext().getProgramStrategyService().hasRemoteAccessRightOnProgram(getContext().getAuthenticationInfo())) {
referentialOnly = true;
}
else {
if (CollectionUtils.isEmpty(programCodes)) {
} else {
// Ask for programs
// Ask for programs
Set<String> programCodes = getSynchroUIContext().getImportDataProgramCodes();
ProgramSelectUI programSelectUI = new ProgramSelectUI(getUI(), StatusFilter.NATIONAL_ACTIVE, programCodes);
ProgramSelectUI programSelectUI = new ProgramSelectUI(getUI(), null, StatusFilter.NATIONAL_ACTIVE, programCodes, false, true);
handler.openDialog(programSelectUI, t("reefdb.action.synchro.import.programCodes.title"), new Dimension(800, 400));
......@@ -195,16 +185,13 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
// Transform selected programs into a code list
else {
programCodes = Sets.newHashSet(ReefDbBeans.<String, ProgramDTO>collectProperties(programs, ProgramDTO.PROPERTY_CODE));
getSynchroUIContext().setImportDataProgramCodes(programCodes);
}
} else {
// apply provided program code directly
programCodes = Sets.newHashSet(ReefDbBeans.<String, ProgramDTO>collectProperties(programs, ProgramDTO.PROPERTY_CODE));
getSynchroUIContext().setImportDataProgramCodes(programCodes);
}
// get photo option and set it in context
getSynchroUIContext().setImportPhoto(programSelectUI.getModel().isEnablePhoto());
}
}
......@@ -230,12 +217,6 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
checkAction.setSilentIfNoUpdate(silentIfNoUpdate);
checkAction.setSilentIfUpdate(silentIfUpdate);
nextSynchroAction = checkAction;
// if check only, just call the synchro action, wait for it and terminate this action normally
if (checkOnly) {
nextSynchroAction.executeAndWait();
nextSynchroAction = null;
}
}
// run apply direct synchro action
......@@ -248,7 +229,9 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
}
}
/** {@inheritDoc} */
/**
* {@inheritDoc}
*/
@Override
public void postSuccessAction() {
super.postSuccessAction();
......@@ -261,15 +244,15 @@ public class ImportSynchroAction extends AbstractReefDbMainUIAction {
}
/** {@inheritDoc} */
/**
* {@inheritDoc}
*/
@Override
protected void releaseAction() {
super.releaseAction();