use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class CodeListImportService method start.
@Secured("ROLE_ADMIN")
public CodeListImportStatusProxy start(int codeListId, String tempFileName, CSVFileOptions fileOptions, boolean overwriteData) throws DataImportExeption {
if (importProcess == null || !importProcess.getStatus().isRunning()) {
File importFile = new File(tempFileName);
SessionStatus designerSessionStatus = sessionManager.getDesignerSessionStatus();
CollectSurvey survey = designerSessionStatus.getSurvey();
String langCode = designerSessionStatus.getCurrentLanguageCode();
CodeList codeList = survey.getCodeListById(codeListId);
importProcess = new CodeListImportProcess(codeListManager, codeList, langCode, importFile, fileOptions, overwriteData);
importProcess.init();
CodeListImportStatus status = importProcess.getStatus();
if (status != null && !importProcess.getStatus().isError()) {
startProcessThread();
}
}
return getStatus();
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class BaseVM method getSessionStatus.
protected SessionStatus getSessionStatus() {
Session session = getSession();
String key = SessionStatus.SESSION_KEY;
SessionStatus sessionStatus = (SessionStatus) session.getAttribute(key);
if (sessionStatus == null) {
sessionStatus = new SessionStatus();
session.setAttribute(key, sessionStatus);
}
return sessionStatus;
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SchemaLayoutVM method setFormVersion.
public void setFormVersion(ModelVersion formVersion) {
SessionStatus sessionStatus = getSessionStatus();
sessionStatus.setLayoutFormVersion(formVersion);
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SurveyEditVM method languageCodeSelected.
@Command
@NotifyChange({ "currentLanguageCode" })
public void languageCodeSelected(@BindingParam("code") final String selectedLanguageCode) {
final SessionStatus sessionStatus = getSessionStatus();
checkCanLeaveForm(new CanLeaveFormConfirmHandler() {
@Override
public void onOk(boolean confirmed) {
sessionStatus.setCurrentLanguageCode(selectedLanguageCode);
BindUtils.postGlobalCommand(null, null, SurveyLanguageVM.CURRENT_LANGUAGE_CHANGED_COMMAND, null);
currentLanguageCode = sessionStatus.getCurrentLanguageCode();
}
});
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SurveyLanguageVM method applyChanges.
@Command
public void applyChanges() {
final SessionStatus sessionStatus = getSessionStatus();
final CollectSurvey survey = sessionStatus.getSurvey();
final List<String> newLanguageCodes = getSelectedLanguageCodes();
final List<String> removedLanguages = calculateRemovedLanguages();
if (removedLanguages.isEmpty()) {
performLanguageUpdate(survey, newLanguageCodes);
} else {
ConfirmParams confirmParams = new ConfirmParams(new MessageUtil.ConfirmHandler() {
@Override
public void onOk() {
performLanguageUpdate(survey, newLanguageCodes);
}
}, "survey.language.remove.confirm");
confirmParams.setOkLabelKey("global.remove_item");
confirmParams.setMessageArgs(new String[] { StringUtils.join(removedLanguages, ", ") });
MessageUtil.showConfirm(confirmParams);
}
}
Aggregations