use of org.obiba.mica.micaConfig.domain.DataAccessAmendmentForm in project mica2 by obiba.
the class DataAccessAmendmentFormService method createDefaultDataAccessAmendmentForm.
private DataAccessAmendmentForm createDefaultDataAccessAmendmentForm() {
DataAccessAmendmentForm form = new DataAccessAmendmentForm();
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.DataAccessAmendmentForm in project mica2 by obiba.
the class DataAccessAmendmentFormService method findDraft.
@Override
public DataAccessAmendmentForm findDraft() {
DataAccessAmendmentForm form = dataAccessAmendmentFormRepository.findOne(DataAccessAmendmentForm.DEFAULT_ID);
if (form == null) {
createOrUpdate(createDefaultDataAccessAmendmentForm());
form = dataAccessAmendmentFormRepository.findOne(DataAccessAmendmentForm.DEFAULT_ID);
}
return form;
}
use of org.obiba.mica.micaConfig.domain.DataAccessAmendmentForm in project mica2 by obiba.
the class DataAccessAmendmentFormService method publish.
@Override
public void publish() {
DataAccessAmendmentForm draft = findDraft();
draft.setId(null);
Optional<DataAccessAmendmentForm> latest = findFirstSortByRevisionDesc();
draft.setRevision(latest.isPresent() ? latest.get().getRevision() + 1 : 1);
dataAccessAmendmentFormRepository.save(draft);
}
use of org.obiba.mica.micaConfig.domain.DataAccessAmendmentForm in project mica2 by obiba.
the class DataAccessController method addDataAccessAmendmentFormConfiguration.
private void addDataAccessAmendmentFormConfiguration(Map<String, Object> params, DataAccessAmendment amendment, boolean readOnly, String locale) {
DataAccessAmendmentForm dataAccessAmendmentForm = getDataAccessAmendmentForm(amendment);
params.put("formConfig", new SchemaFormConfig(micaConfigService, dataAccessAmendmentForm.getSchema(), dataAccessAmendmentForm.getDefinition(), amendment.getContent(), locale, readOnly));
params.put("accessConfig", dataAccessConfigervice.getOrCreateConfig());
}
Aggregations