use of org.obiba.mica.micaConfig.domain.DataAccessFeasibilityForm in project mica2 by obiba.
the class DataAccessFeasibilityFormService method publish.
@Override
public void publish() {
DataAccessFeasibilityForm draft = findDraft();
draft.setId(null);
Optional<DataAccessFeasibilityForm> latest = findFirstSortByRevisionDesc();
draft.setRevision(latest.isPresent() ? latest.get().getRevision() + 1 : 1);
dataAccessFeasibilityFormRepository.save(draft);
}
use of org.obiba.mica.micaConfig.domain.DataAccessFeasibilityForm in project mica2 by obiba.
the class DataAccessFeasibilityFormService method createDefaultDataAccessFeasibilityForm.
private DataAccessFeasibilityForm createDefaultDataAccessFeasibilityForm() {
DataAccessFeasibilityForm form = new DataAccessFeasibilityForm();
form.setDefinition(getDefaultDataAccessFormResourceAsString("definition.json"));
form.setSchema(getDefaultDataAccessFormResourceAsString("schema.json"));
form.setTitleFieldPath("projectTitle");
form.setSummaryFieldPath("summary");
form.setEndDateFieldPath("endDate");
form.setRevision(0);
return form;
}
use of org.obiba.mica.micaConfig.domain.DataAccessFeasibilityForm in project mica2 by obiba.
the class DataAccessFeasibilityFormService method findDraft.
@Override
public DataAccessFeasibilityForm findDraft() {
DataAccessFeasibilityForm form = dataAccessFeasibilityFormRepository.findOne(DataAccessFeasibilityForm.DEFAULT_ID);
if (form == null) {
createOrUpdate(createDefaultDataAccessFeasibilityForm());
form = dataAccessFeasibilityFormRepository.findOne(DataAccessFeasibilityForm.DEFAULT_ID);
}
return form;
}
use of org.obiba.mica.micaConfig.domain.DataAccessFeasibilityForm in project mica2 by obiba.
the class DataAccessController method addDataAccessFeasibilityFormConfiguration.
private void addDataAccessFeasibilityFormConfiguration(Map<String, Object> params, DataAccessFeasibility feasibility, boolean readOnly, String locale) {
DataAccessFeasibilityForm dataAccessFeasibilityForm = dataAccessFeasibilityFormService.findByRevision("latest").get();
params.put("formConfig", new SchemaFormConfig(micaConfigService, dataAccessFeasibilityForm.getSchema(), dataAccessFeasibilityForm.getDefinition(), feasibility.getContent(), locale, readOnly));
params.put("accessConfig", dataAccessConfigervice.getOrCreateConfig());
}
Aggregations