Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion dspace-api/src/main/java/org/dspace/app/util/DCInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ public class DCInput {
*/
private String autocompleteCustom = null;

/**
* the custom field for the type bind
*/
private String typeBindField = null;

/**
* the dropdown input type could have defined a default value
*/
Expand Down Expand Up @@ -259,7 +264,7 @@ public DCInput(Map<String, String> fieldMap, Map<String, List<String>> listMap,
typeBind = new ArrayList<String>();
String typeBindDef = fieldMap.get("type-bind");
this.insertToTypeBind(typeBindDef);
String typeBindField = fieldMap.get(DCInputsReader.TYPE_BIND_FIELD_ATTRIBUTE);
typeBindField = fieldMap.get(DCInputsReader.TYPE_BIND_FIELD_ATTRIBUTE);
this.insertToTypeBind(typeBindField);


Expand Down Expand Up @@ -741,6 +746,14 @@ public void setAutocompleteCustom(String autocompleteCustom) {
this.autocompleteCustom = autocompleteCustom;
}

public String getTypeBindField() {
return typeBindField;
}

public void setTypeBindField(String typeBindField) {
this.typeBindField = typeBindField;
}

/**
* Class representing a Map of the ComplexDefinition object
* Class is copied from UFAL/CLARIN-DSPACE (https://github.com/ufal/clarin-dspace) and modified by
Expand Down
34 changes: 21 additions & 13 deletions dspace-api/src/main/java/org/dspace/app/util/DCInputsReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,11 @@ private void processField(String formName, Node n, Map<String, String> field)
handleInputTypeTagName(formName, field, nestedNode, nestedValue);
}
}
} else if (StringUtils.equals(tagName, "type-bind")) {
String customField = getAttribute(nd, TYPE_BIND_FIELD_ATTRIBUTE);
if (customField != null) {
field.put(TYPE_BIND_FIELD_ATTRIBUTE, customField);
}
}
}
}
Expand Down Expand Up @@ -547,20 +552,23 @@ private void handleInputTypeTagName(String formName, Map<String, String> field,
} else {
field.put(PAIR_TYPE_NAME, pairTypeName);
}
} else if (value.equals("complex")) {
String definitionName = getAttribute(nd, COMPLEX_DEFINITION_REF);
if (definitionName == null) {
throw new SAXException("Form " + formName
+ ", field " + field.get("dc-element")
+ "." + field.get("dc-qualifier")
+ " has no linked definition");
} else {
field.put(COMPLEX_DEFINITION_REF, definitionName);
} else {
if (value.equals("complex")) {
String definitionName = getAttribute(nd, COMPLEX_DEFINITION_REF);
if (definitionName == null) {
throw new SAXException("Form " + formName
+ ", field " + field.get("dc-element")
+ "." + field.get("dc-qualifier")
+ " has no linked definition");
} else {
field.put(COMPLEX_DEFINITION_REF, definitionName);
}
}
} else if (value.equals("autocomplete")) {
String definitionName = getAttribute(nd, AUTOCOMPLETE_CUSTOM);
if (definitionName != null) {
field.put(AUTOCOMPLETE_CUSTOM, definitionName);
if (value.equals("autocomplete")) {
String definitionName = getAttribute(nd, AUTOCOMPLETE_CUSTOM);
if (definitionName != null) {
field.put(AUTOCOMPLETE_CUSTOM, definitionName);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ private SubmissionFormFieldRest getField(DCInput dcinput, String formName) {
if (dcinput.isMetadataField()) {
inputField.setSelectableMetadata(selectableMetadata);
inputField.setTypeBind(dcinput.getTypeBindList());
inputField.setTypeBindField(dcinput.getTypeBindField());
inputField.setComplexDefinition(dcinput.getComplexDefinitionJSONString());
inputField.setAutocompleteCustom(dcinput.getAutocompleteCustom());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ public class SubmissionFormFieldRest {
*/
private String autocompleteCustom;

/**
* The custom field to type bind. It is used to check that the custom type bind field is defined when
* it is defined in the configuration property `submit.type-bind.field`
*/
private String typeBindField;


/**
* Getter for {@link #selectableMetadata}
Expand Down Expand Up @@ -313,4 +319,12 @@ public String getAutocompleteCustom() {
public void setAutocompleteCustom(String autocompleteCustom) {
this.autocompleteCustom = autocompleteCustom;
}

public String getTypeBindField() {
return typeBindField;
}

public void setTypeBindField(String typeBindField) {
this.typeBindField = typeBindField;
}
}