mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 04:53:16 +00:00
override
This commit is contained in:
@@ -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<Relationship> 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<MetadataValue> list = itemService.getMetadata(item, "relationship", "type", null, Item.ANY);
|
||||
@@ -51,12 +53,9 @@ public class EntityServiceImpl implements EntityService {
|
||||
}
|
||||
}
|
||||
|
||||
public List<Relationship> getAllRelations(Context context, Entity entity) {
|
||||
return entity.getRelationships();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Relationship> getLeftRelations(Context context, Entity entity) {
|
||||
List<Relationship> fullList = this.getAllRelations(context, entity);
|
||||
List<Relationship> fullList = entity.getRelationships();
|
||||
List<Relationship> 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<Relationship> getRightRelations(Context context, Entity entity) {
|
||||
List<Relationship> fullList = this.getAllRelations(context, entity);
|
||||
List<Relationship> fullList = entity.getRelationships();
|
||||
List<Relationship> 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<Relationship> getRelationsByLabel(Context context, String label) throws SQLException {
|
||||
List<Relationship> listToReturn = new LinkedList<>();
|
||||
List<Relationship> relationshipList = relationshipService.findAll(context);
|
||||
@@ -90,6 +91,7 @@ public class EntityServiceImpl implements EntityService {
|
||||
return listToReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RelationshipType> getAllRelationshipTypes(Context context, Entity entity) throws SQLException {
|
||||
EntityType entityType = this.getType(context, entity);
|
||||
List<RelationshipType> listToReturn = new LinkedList<>();
|
||||
@@ -102,6 +104,7 @@ public class EntityServiceImpl implements EntityService {
|
||||
return listToReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RelationshipType> getLeftRelationshipTypes(Context context, Entity entity) throws SQLException {
|
||||
EntityType entityType = this.getType(context, entity);
|
||||
List<RelationshipType> listToReturn = new LinkedList<>();
|
||||
@@ -113,6 +116,7 @@ public class EntityServiceImpl implements EntityService {
|
||||
return listToReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RelationshipType> getRightRelationshipTypes(Context context, Entity entity) throws SQLException {
|
||||
EntityType entityType = this.getType(context, entity);
|
||||
List<RelationshipType> listToReturn = new LinkedList<>();
|
||||
@@ -124,6 +128,7 @@ public class EntityServiceImpl implements EntityService {
|
||||
return listToReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RelationshipType> getRelationshipTypesByLabel(Context context, String label) throws SQLException {
|
||||
List<RelationshipType> listToReturn = new LinkedList<>();
|
||||
for (RelationshipType relationshipType : relationshipTypeService.findAll(context)) {
|
||||
|
@@ -1355,6 +1355,7 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
return fullMetadataValueList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MetadataValue> getMetadata(Item item, String schema, String element, String qualifier, String lang,
|
||||
boolean enableVirtualMetadata) {
|
||||
//Fields of the relation schema are virtual metadata
|
||||
|
@@ -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<RelationshipType> 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(
|
||||
|
@@ -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<Relationship> 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
|
||||
|
Reference in New Issue
Block a user