use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class ModelService method isActiveSurveyRecordsLocked.
public boolean isActiveSurveyRecordsLocked() {
CollectSurvey survey = sessionManager.getActiveSurvey();
boolean result = survey != null && survey.isPublished() && surveyManager.isRecordValidationInProgress(survey.getId());
return result;
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class RDBReportingRepositories method process.
@Override
public void process(final RecordTransaction recordTransaction) {
final RelationalSchema rdbSchema = getRelatedRelationalSchema(recordTransaction);
final CollectSurvey survey = (CollectSurvey) rdbSchema.getSurvey();
RecordStep step = recordTransaction.getRecordStep();
withConnection(survey.getName(), step, new Callback() {
public void execute(Connection connection) {
RDBUpdater rdbUpdater = createRDBUpdater(rdbSchema, connection);
for (RecordEvent recordEvent : recordTransaction.getEvents()) {
EventHandler handler = new EventHandler(recordEvent, rdbSchema, survey, rdbUpdater);
handler.handle();
}
}
});
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class RDBReportingRepositories method initializeSchemaDefinitions.
private void initializeSchemaDefinitions() {
List<CollectSurvey> surveys = surveyManager.getAll();
for (CollectSurvey survey : surveys) {
initializeRelationalSchemaDefinition(survey);
initializeMondrianSchemaDefinition(survey, survey.getDefaultLanguage());
}
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class CSVDataImportService method start.
@Secured("ROLE_ADMIN")
public DataImportStatusProxy start(String tempFileName, int parentEntityId, Step step, boolean transactional, boolean validateRecords, boolean insertNewRecords, String newRecordVersionName, boolean deleteExistingEntities) throws DataImportExeption {
if (importJob == null || !importJob.isRunning()) {
File importFile = new File(tempFileName);
SessionState sessionState = sessionManager.getSessionState();
CollectSurvey survey = sessionState.getActiveSurvey();
if (transactional) {
importJob = jobManager.createJob(TransactionalCSVDataImportJob.class);
} else {
importJob = jobManager.createJob(CSVDataImportJob.BEAN_NAME, CSVDataImportJob.class);
}
CSVDataImportSettings settings = new CSVDataImportSettings();
settings.setRecordValidationEnabled(validateRecords);
settings.setInsertNewRecords(insertNewRecords);
settings.setNewRecordVersionName(newRecordVersionName);
settings.setDeleteExistingEntities(deleteExistingEntities);
Step[] steps = step == null ? Step.values() : new Step[] { step };
CSVDataImportInput input = new CSVDataImportInput(importFile, survey, steps, parentEntityId, settings);
importJob.setInput(input);
jobManager.start(importJob);
}
return getStatus();
}
use of org.openforis.collect.model.CollectSurvey 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();
}
Aggregations