Search in sources :

Example 1 with DataAccessAmendmentForm

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;
}
Also used : DataAccessAmendmentForm(org.obiba.mica.micaConfig.domain.DataAccessAmendmentForm)

Example 2 with DataAccessAmendmentForm

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;
}
Also used : DataAccessAmendmentForm(org.obiba.mica.micaConfig.domain.DataAccessAmendmentForm)

Example 3 with DataAccessAmendmentForm

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);
}
Also used : DataAccessAmendmentForm(org.obiba.mica.micaConfig.domain.DataAccessAmendmentForm)

Example 4 with DataAccessAmendmentForm

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());
}
Also used : DataAccessAmendmentForm(org.obiba.mica.micaConfig.domain.DataAccessAmendmentForm) SchemaFormConfig(org.obiba.mica.web.controller.domain.SchemaFormConfig)

Aggregations

DataAccessAmendmentForm (org.obiba.mica.micaConfig.domain.DataAccessAmendmentForm)4 SchemaFormConfig (org.obiba.mica.web.controller.domain.SchemaFormConfig)1