#23544 Integrated with the fieldId

This commit is contained in:
Francesco Mangiacrapa 2022-07-07 17:49:22 +02:00
parent 0710f44269
commit fc23e553f7
4 changed files with 70 additions and 24 deletions

View File

@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- [#23188] Overloaded the method getProfilesInTheScope(forName)
- [#22890] Including the set/get currentValue for Update facility
- [#23188] Advanced the MultipleDilaogUpload with a more complex object
- [#23544] Integrated with the fieldId added to gCube Metadata Profile
## [v1.0.1-SNAPSHOT] - 2020-10-08

View File

@ -921,8 +921,16 @@ public class MetaDataFieldSkeleton extends Composite {
*/
public String getFieldNameQualified() {
if (field.getFieldNameFromCategory() != null)
//see https://support.d4science.org/issues/23544
if (field.getFieldId() != null) {
return field.getFieldId();
}
//Using the getFieldNameFromCategory if the category is present in the model as cateogory:fieldName
if (field.getFieldNameFromCategory() != null && field.getFieldNameFromCategory().compareTo(field.getFieldName())!=0) {
return field.getFieldNameFromCategory();
}
return field.getFieldName();
}

View File

@ -298,6 +298,7 @@ public class MetadataDiscovery {
wrapperObj.setType(DataTypeWrapper.String);
}
wrapperObj.setDefaultValue(metadataField.getDefaultValue());
wrapperObj.setFieldId(metadataField.getFieldId());
wrapperObj.setFieldName(metadataField.getFieldName());
wrapperObj.setMandatory(metadataField.getMandatory());
wrapperObj.setNote(metadataField.getNote());

View File

@ -13,6 +13,7 @@ import java.util.List;
public class MetadataFieldWrapper implements UpdatableField, Serializable {
private static final long serialVersionUID = -8476731365884466698L;
private String fieldId;
private String fieldName;
private String fieldNameFromCategory;
private Boolean mandatory = false;
@ -40,6 +41,8 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable {
/**
* Instantiates a new metadata field wrapper.
*
* @param fieldId the field id (optional) if present is used instead of
* fieldName as result
* @param fieldName the field name
* @param mandatory the mandatory
* @param type the type
@ -49,9 +52,10 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable {
* @param validator the validator
* @param category the category
*/
public MetadataFieldWrapper(String fieldName, Boolean mandatory, DataTypeWrapper type, String defaultValue,
String note, List<String> vocabulary, String validator, CategoryWrapper category) {
public MetadataFieldWrapper(String fieldId, String fieldName, Boolean mandatory, DataTypeWrapper type,
String defaultValue, String note, List<String> vocabulary, String validator, CategoryWrapper category) {
super();
this.fieldId = fieldId;
this.fieldName = fieldName;
this.mandatory = mandatory;
this.type = type;
@ -80,6 +84,24 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable {
this.maxOccurs = maxOccurs;
}
/**
* Gets the field id.
*
* @return the field id
*/
public String getFieldId() {
return fieldId;
}
/**
* Sets the field id.
*
* @param fieldId the new field id
*/
public void setFieldId(String fieldId) {
this.fieldId = fieldId;
}
/**
* Gets the field name.
*
@ -327,29 +349,43 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable {
return currentValue;
}
/**
* To string.
*
* @return the string
*/
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "MetadataFieldWrapper [" + (fieldName != null ? "serviceFieldName=" + fieldName + ", " : "")
+ (fieldNameFromCategory != null ? "fieldNameFromCategory=" + fieldNameFromCategory + ", " : "")
+ (mandatory != null ? "mandatory=" + mandatory + ", " : "")
+ (maxOccurs != null ? "maxOccurs=" + maxOccurs + ", " : "")
+ (type != null ? "type=" + type + ", " : "")
+ (defaultValue != null ? "defaultValue=" + defaultValue + ", " : "")
+ (note != null ? "note=" + note + ", " : "")
+ (vocabulary != null ? "vocabulary=" + vocabulary + ", " : "") + "multiSelection=" + multiSelection
+ ", " + (validator != null ? "validator=" + validator + ", " : "")
+ (ownerCategory != null ? "ownerCategory=" + ownerCategory.getId() + ", " : "")
+ (asGroup != null ? "asGroup=" + asGroup + ", " : "") + (asTag != null ? "asTag=" + asTag : "") + "]";
StringBuilder builder = new StringBuilder();
builder.append("MetadataFieldWrapper [fieldId=");
builder.append(fieldId);
builder.append(", fieldName=");
builder.append(fieldName);
builder.append(", fieldNameFromCategory=");
builder.append(fieldNameFromCategory);
builder.append(", mandatory=");
builder.append(mandatory);
builder.append(", type=");
builder.append(type);
builder.append(", defaultValue=");
builder.append(defaultValue);
builder.append(", note=");
builder.append(note);
builder.append(", vocabulary=");
builder.append(vocabulary);
builder.append(", multiSelection=");
builder.append(multiSelection);
builder.append(", validator=");
builder.append(validator);
builder.append(", ownerCategory=");
builder.append(ownerCategory);
builder.append(", asGroup=");
builder.append(asGroup);
builder.append(", asTag=");
builder.append(asTag);
builder.append(", maxOccurs=");
builder.append(maxOccurs);
builder.append(", currentValue=");
builder.append(currentValue);
builder.append("]");
return builder.toString();
}
}