refactor description template xml
This commit is contained in:
parent
6a0d1a7c8b
commit
7e63abca50
|
@ -6,7 +6,7 @@ import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public enum FieldType implements DatabaseEnum<String> {
|
public enum FieldType implements DatabaseEnum<String> {
|
||||||
AUTO_COMPLETE(Names.ExternalSelect),
|
EXTERNAL_SELECT(Names.ExternalSelect),
|
||||||
SELECT(Names.Select),
|
SELECT(Names.Select),
|
||||||
BOOLEAN_DECISION(Names.BooleanDecision),
|
BOOLEAN_DECISION(Names.BooleanDecision),
|
||||||
RADIO_BOX(Names.RadioBox),
|
RADIO_BOX(Names.RadioBox),
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class DescriptionFieldDepositBuilder extends BaseDepositBuilder<Descripti
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (field.getData().getFieldType()) {
|
switch (field.getData().getFieldType()) {
|
||||||
case AUTO_COMPLETE -> m.setFieldType(FieldType.AUTO_COMPLETE);
|
case EXTERNAL_SELECT -> m.setFieldType(FieldType.AUTO_COMPLETE);
|
||||||
case SELECT -> m.setFieldType(FieldType.WORD_LIST);
|
case SELECT -> m.setFieldType(FieldType.WORD_LIST);
|
||||||
case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION);
|
case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION);
|
||||||
case RADIO_BOX -> m.setFieldType(FieldType.RADIO_BOX);
|
case RADIO_BOX -> m.setFieldType(FieldType.RADIO_BOX);
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class FieldDataHelperServiceProvider {
|
||||||
item = this.applicationContext.getBean(SelectFieldDataHelperService.class);
|
item = this.applicationContext.getBean(SelectFieldDataHelperService.class);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AUTO_COMPLETE: {
|
case EXTERNAL_SELECT: {
|
||||||
item = this.applicationContext.getBean(ExternalSelectFieldDataHelperService.class);
|
item = this.applicationContext.getBean(ExternalSelectFieldDataHelperService.class);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,7 +282,7 @@ public class PrefillingServiceImpl implements PrefillingService {
|
||||||
Field field = new Field();
|
Field field = new Field();
|
||||||
field.setKey(id);
|
field.setKey(id);
|
||||||
switch (fieldEntity.getData().getFieldType()) {
|
switch (fieldEntity.getData().getFieldType()) {
|
||||||
case AUTO_COMPLETE:
|
case EXTERNAL_SELECT:
|
||||||
case SELECT: {
|
case SELECT: {
|
||||||
if (!parsedValues.stream().allMatch(Objects::isNull)) {
|
if (!parsedValues.stream().allMatch(Objects::isNull)) {
|
||||||
field.setValue(this.jsonHandlingService.toJsonSafe(parseComboBoxValues(fieldEntity, parsedValues)));
|
field.setValue(this.jsonHandlingService.toJsonSafe(parseComboBoxValues(fieldEntity, parsedValues)));
|
||||||
|
@ -364,7 +364,7 @@ public class PrefillingServiceImpl implements PrefillingService {
|
||||||
private Object parseComboBoxValues(FieldEntity fieldEntity, List<String> parsedValues) {
|
private Object parseComboBoxValues(FieldEntity fieldEntity, List<String> parsedValues) {
|
||||||
List<String> normalizedValues = new ArrayList<>();
|
List<String> normalizedValues = new ArrayList<>();
|
||||||
boolean isMultiSelect;
|
boolean isMultiSelect;
|
||||||
if(fieldEntity.getData().getFieldType().equals(FieldType.AUTO_COMPLETE)) {
|
if(fieldEntity.getData().getFieldType().equals(FieldType.EXTERNAL_SELECT)) {
|
||||||
ExternalSelectDataEntity autoCompleteData = (ExternalSelectDataEntity)fieldEntity.getData();
|
ExternalSelectDataEntity autoCompleteData = (ExternalSelectDataEntity)fieldEntity.getData();
|
||||||
isMultiSelect = autoCompleteData.getMultipleSelect();
|
isMultiSelect = autoCompleteData.getMultipleSelect();
|
||||||
for (String format : parsedValues) {
|
for (String format : parsedValues) {
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class PrefillingMapper {
|
||||||
String renderStyle = node.isArray() ? node.get(0).get("viewStyle").get("renderStyle").asText() : node.get("viewStyle").get("renderStyle").asText();
|
String renderStyle = node.isArray() ? node.get(0).get("viewStyle").get("renderStyle").asText() : node.get("viewStyle").get("renderStyle").asText();
|
||||||
|
|
||||||
switch (FieldType.of(renderStyle)) {
|
switch (FieldType.of(renderStyle)) {
|
||||||
case AUTO_COMPLETE:
|
case EXTERNAL_SELECT:
|
||||||
case SELECT:
|
case SELECT:
|
||||||
if (parsedValues.isEmpty())
|
if (parsedValues.isEmpty())
|
||||||
parsedValues.add(parsedValue);
|
parsedValues.add(parsedValue);
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class ExportXmlBuilderDatasetProfile {
|
||||||
Element dataOut = element.createElement("data");
|
Element dataOut = element.createElement("data");
|
||||||
switch (field.getViewStyle().getFieldType()) {
|
switch (field.getViewStyle().getFieldType()) {
|
||||||
case SELECT:
|
case SELECT:
|
||||||
case AUTO_COMPLETE:
|
case EXTERNAL_SELECT:
|
||||||
// ComboBoxDataEntity comboBoxDataEntityObject = (ComboBoxDataEntity) field.getData();
|
// ComboBoxDataEntity comboBoxDataEntityObject = (ComboBoxDataEntity) field.getData();
|
||||||
// if (comboBoxDataEntityObject.getFieldType().equals("wordlist")) {
|
// if (comboBoxDataEntityObject.getFieldType().equals("wordlist")) {
|
||||||
// SelectDataEntity selectDataEntityObject = (SelectDataEntity) field.getData();
|
// SelectDataEntity selectDataEntityObject = (SelectDataEntity) field.getData();
|
||||||
|
|
Loading…
Reference in New Issue