Search in sources :

Example 1 with DataAccessFeasibilityForm

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

Example 2 with DataAccessFeasibilityForm

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

Example 3 with DataAccessFeasibilityForm

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

Example 4 with DataAccessFeasibilityForm

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

Aggregations

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