w2p-65570 - Configuring whether name variants should be used

This commit is contained in:
Marie Verdonck
2019-10-14 13:49:55 +02:00
parent f65c8523a8
commit 9994dd8d7c
5 changed files with 34 additions and 4 deletions

View File

@@ -89,6 +89,11 @@ public class DCInput {
*/
private boolean repeatable = false;
/**
* should name-variants be used?
*/
private boolean nameVariants = false;
/**
* 'hint' text to display
*/
@@ -183,6 +188,9 @@ public class DCInput {
String repStr = fieldMap.get("repeatable");
repeatable = "true".equalsIgnoreCase(repStr)
|| "yes".equalsIgnoreCase(repStr);
String nameVariantsString = fieldMap.get("name-variants");
nameVariants = (StringUtils.isNotBlank(nameVariantsString)) ?
nameVariantsString.equalsIgnoreCase("true") : false;
label = fieldMap.get("label");
inputType = fieldMap.get("input-type");
// these types are list-controlled
@@ -269,6 +277,15 @@ public class DCInput {
return isRepeatable();
}
/**
* Get the nameVariants flag for this row
*
* @return the nameVariants flag
*/
public boolean areNameVariantsAllowed() {
return nameVariants;
}
/**
* Get the input type for this row
*

View File

@@ -14,11 +14,12 @@
<!-- Each form set contains an ordered set of pages; each page defines -->
<!-- one submission metadata entry screen. Each page has an ordered list -->
<!-- of field definitions, Each field definition corresponds to one -->
<!-- metadata entry (a so-called row), which has a DC element name, a -->
<!-- metadata entry (a so-called row), which has a DC element name, a -->
<!-- displayed label, a text string prompt which is called a hint, and -->
<!-- an input-type. Each field also may hold optional elements: DC -->
<!-- qualifier name, a repeatable flag, and a text string whose presence -->
<!-- serves as a 'this field is required' flag. -->
<!-- qualifier name, a repeatable flag, an optional name-variants allowed -->
<!-- flag, and a text string whose presence &ndash;&gt; serves as a -->
<!-- 'this field is required' flag. -->
<form-definitions>
<form name="bitstream-metadata">
@@ -53,6 +54,7 @@
<relationship-type>isAuthorOfPublication</relationship-type>
<search-configuration>personConfiguration</search-configuration>
<repeatable>true</repeatable>
<name-variants>true</name-variants>
<label>Author</label>
<hint>Add an author</hint>
<linked-metadata-field>

View File

@@ -170,6 +170,7 @@ public class SubmissionFormConverter implements DSpaceConverter<DCInputSet, Subm
selectableRelationship.setRelationshipType(dcinput.getRelationshipType());
selectableRelationship.setFilter(dcinput.getFilter());
selectableRelationship.setSearchConfiguration(dcinput.getSearchConfiguration());
selectableRelationship.setNameVariants(String.valueOf(dcinput.areNameVariantsAllowed()));
return selectableRelationship;
}

View File

@@ -23,6 +23,7 @@ public class SelectableRelationship {
private String relationshipType;
private String filter;
private String searchConfiguration;
private String nameVariants;
public void setRelationshipType(String relationshipType) {
this.relationshipType = relationshipType;
@@ -47,4 +48,12 @@ public class SelectableRelationship {
public String getSearchConfiguration() {
return searchConfiguration;
}
public void setNameVariants(String nameVariants) {
this.nameVariants = nameVariants;
}
public String getNameVariants() {
return nameVariants;
}
}

View File

@@ -22,6 +22,7 @@
<!ELEMENT hint (#PCDATA) >
<!ELEMENT required (#PCDATA)>
<!ELEMENT name-variants (#PCDATA)>
<!ELEMENT regex (#PCDATA) >
<!ELEMENT form-value-pairs (value-pairs)* >
@@ -59,5 +60,5 @@
<!ELEMENT relationship-type (#PCDATA) >
<!ELEMENT search-configuration (#PCDATA) >
<!ELEMENT filter (#PCDATA) >
<!ELEMENT relation-field (relationship-type, search-configuration, filter?, repeatable?, label, type-bind?, hint, linked-metadata-field?, required?, visibility?)>
<!ELEMENT relation-field (relationship-type, search-configuration, filter?, repeatable?, name-variants?, label, type-bind?, hint, linked-metadata-field?, required?, visibility?)>
<!ELEMENT linked-metadata-field (dc-schema, dc-element, dc-qualifier?, input-type)>