diff --git a/dspace-api/src/main/java/org/dspace/content/EntityServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/EntityServiceImpl.java index 5a00616229..07b2b3062d 100644 --- a/dspace-api/src/main/java/org/dspace/content/EntityServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/EntityServiceImpl.java @@ -35,12 +35,14 @@ public class EntityServiceImpl implements EntityService { @Autowired(required = true) protected ItemService itemService; + @Override public Entity findByItemId(Context context, UUID itemId) throws SQLException { Item item = itemService.find(context, itemId); List relationshipList = relationshipService.findByItem(context, item); return new Entity(item, relationshipList); } + @Override public EntityType getType(Context context, Entity entity) throws SQLException { Item item = entity.getItem(); List list = itemService.getMetadata(item, "relationship", "type", null, Item.ANY); @@ -51,12 +53,9 @@ public class EntityServiceImpl implements EntityService { } } - public List getAllRelations(Context context, Entity entity) { - return entity.getRelationships(); - } - + @Override public List getLeftRelations(Context context, Entity entity) { - List fullList = this.getAllRelations(context, entity); + List fullList = entity.getRelationships(); List listToReturn = new LinkedList<>(); for (Relationship relationship : fullList) { if (relationship.getLeftItem().getID() == entity.getItem().getID()) { @@ -66,8 +65,9 @@ public class EntityServiceImpl implements EntityService { return listToReturn; } + @Override public List getRightRelations(Context context, Entity entity) { - List fullList = this.getAllRelations(context, entity); + List fullList = entity.getRelationships(); List listToReturn = new LinkedList<>(); for (Relationship relationship : fullList) { if (relationship.getRightItem().getID() == entity.getItem().getID()) { @@ -77,6 +77,7 @@ public class EntityServiceImpl implements EntityService { return listToReturn; } + @Override public List getRelationsByLabel(Context context, String label) throws SQLException { List listToReturn = new LinkedList<>(); List relationshipList = relationshipService.findAll(context); @@ -90,6 +91,7 @@ public class EntityServiceImpl implements EntityService { return listToReturn; } + @Override public List getAllRelationshipTypes(Context context, Entity entity) throws SQLException { EntityType entityType = this.getType(context, entity); List listToReturn = new LinkedList<>(); @@ -102,6 +104,7 @@ public class EntityServiceImpl implements EntityService { return listToReturn; } + @Override public List getLeftRelationshipTypes(Context context, Entity entity) throws SQLException { EntityType entityType = this.getType(context, entity); List listToReturn = new LinkedList<>(); @@ -113,6 +116,7 @@ public class EntityServiceImpl implements EntityService { return listToReturn; } + @Override public List getRightRelationshipTypes(Context context, Entity entity) throws SQLException { EntityType entityType = this.getType(context, entity); List listToReturn = new LinkedList<>(); @@ -124,6 +128,7 @@ public class EntityServiceImpl implements EntityService { return listToReturn; } + @Override public List getRelationshipTypesByLabel(Context context, String label) throws SQLException { List listToReturn = new LinkedList<>(); for (RelationshipType relationshipType : relationshipTypeService.findAll(context)) { diff --git a/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java index be289826d8..ae020c537e 100644 --- a/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java @@ -1355,6 +1355,7 @@ prevent the generation of resource policy entry values with null dspace_object a return fullMetadataValueList; } + @Override public List getMetadata(Item item, String schema, String element, String qualifier, String lang, boolean enableVirtualMetadata) { //Fields of the relation schema are virtual metadata diff --git a/dspace-api/src/main/java/org/dspace/content/RelationshipTypeServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/RelationshipTypeServiceImpl.java index d505c3df12..1900de8777 100644 --- a/dspace-api/src/main/java/org/dspace/content/RelationshipTypeServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/RelationshipTypeServiceImpl.java @@ -27,6 +27,7 @@ public class RelationshipTypeServiceImpl implements RelationshipTypeService { @Autowired(required = true) protected AuthorizeService authorizeService; + @Override public RelationshipType create(Context context) throws SQLException, AuthorizeException { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( @@ -84,15 +85,17 @@ public class RelationshipTypeServiceImpl implements RelationshipTypeService { return create(context, relationshipType); } - + @Override public RelationshipType find(Context context,int id) throws SQLException { return relationshipTypeDAO.findByID(context, RelationshipType.class, id); } + @Override public void update(Context context,RelationshipType relationshipType) throws SQLException, AuthorizeException { update(context,Collections.singletonList(relationshipType)); } + @Override public void update(Context context,List relationshipTypes) throws SQLException, AuthorizeException { if (CollectionUtils.isNotEmpty(relationshipTypes)) { @@ -109,6 +112,7 @@ public class RelationshipTypeServiceImpl implements RelationshipTypeService { } + @Override public void delete(Context context,RelationshipType relationshipType) throws SQLException, AuthorizeException { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( diff --git a/dspace-api/src/main/java/org/dspace/content/service/EntityService.java b/dspace-api/src/main/java/org/dspace/content/service/EntityService.java index b5c42421d0..ec603d7690 100644 --- a/dspace-api/src/main/java/org/dspace/content/service/EntityService.java +++ b/dspace-api/src/main/java/org/dspace/content/service/EntityService.java @@ -47,14 +47,6 @@ public interface EntityService { */ EntityType getType(Context context, Entity entity) throws SQLException; - /** - * Returns the list of relations for the given Entity object - * @param context The relevant DSpace context - * @param entity The Entity object for which the list of relationships will be returned - * @return The list of relationships for the given Entity object - */ - List getAllRelations(Context context, Entity entity); - /** * Retrieves the list of relationships, which are attached to the Entity object that is passed along, where the * left item object of each relationship is equal to the Item object of the Entity object that is passed along