Remove deprecated setMetadata of CommunityService, CollectionService #2956

This introduces a new class:  a holder for metadata field names.
This commit is contained in:
Mark H. Wood
2020-09-22 20:16:13 -04:00
parent f8221f54ce
commit 6569089228
15 changed files with 209 additions and 116 deletions

View File

@@ -7,6 +7,8 @@
*/
package org.dspace.content;
import static org.dspace.content.service.DSpaceObjectService.MD_LICENSE;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.HashSet;
@@ -47,7 +49,6 @@ import org.hibernate.proxy.HibernateProxyHelper;
* effect.
*
* @author Robert Tansley
* @version $Revision$
*/
@Entity
@Table(name = "collection")
@@ -88,7 +89,7 @@ public class Collection extends DSpaceObject implements DSpaceObjectLegacySuppor
joinColumns = {@JoinColumn(name = "collection_id")},
inverseJoinColumns = {@JoinColumn(name = "community_id")}
)
private Set<Community> communities = new HashSet<>();
private final Set<Community> communities = new HashSet<>();
@Transient
private transient CollectionService collectionService;
@@ -230,7 +231,7 @@ public class Collection extends DSpaceObject implements DSpaceObjectLegacySuppor
* @throws SQLException if database error
*/
public void setLicense(Context context, String license) throws SQLException {
getCollectionService().setMetadata(context, this, "license", license);
getCollectionService().setMetadataSingleValue(context, this, MD_LICENSE, Item.ANY, license);
}
/**