mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-08 10:34:25 +00:00
Remove deprecated setMetadata of CommunityService, CollectionService #2956
This introduces a new class: a holder for metadata field names.
This commit is contained in:
@@ -175,10 +175,10 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMetadata(Context context, Community community, String field, String value)
|
||||
throws MissingResourceException, SQLException {
|
||||
if ((field.trim()).equals("name")
|
||||
&& (value == null || value.trim().equals(""))) {
|
||||
public void setMetadataSingleValue(Context context, Community community,
|
||||
MetadataFieldName field, String language, String value)
|
||||
throws MissingResourceException, SQLException {
|
||||
if (field.equals(MD_NAME) && (value == null || value.trim().equals(""))) {
|
||||
try {
|
||||
value = I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled");
|
||||
} catch (MissingResourceException e) {
|
||||
@@ -186,19 +186,19 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
}
|
||||
}
|
||||
|
||||
String[] MDValue = getMDValueByLegacyField(field);
|
||||
|
||||
/*
|
||||
* Set metadata field to null if null
|
||||
* and trim strings to eliminate excess
|
||||
* whitespace.
|
||||
*/
|
||||
if (value == null) {
|
||||
clearMetadata(context, community, MDValue[0], MDValue[1], MDValue[2], Item.ANY);
|
||||
clearMetadata(context, community, field.SCHEMA, field.ELEMENT, field.QUALIFIER, Item.ANY);
|
||||
community.setMetadataModified();
|
||||
} else {
|
||||
setMetadataSingleValue(context, community, MDValue[0], MDValue[1], MDValue[2], null, value);
|
||||
super.setMetadataSingleValue(context, community, field, null, value);
|
||||
}
|
||||
community.addDetails(field);
|
||||
|
||||
community.addDetails(field.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user