public class RelationshipServiceImpl extends Object implements RelationshipService
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected ItemService |
itemService |
protected RelationshipDAO |
relationshipDAO |
protected RelationshipTypeService |
relationshipTypeService |
| Constructor and Description |
|---|
RelationshipServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
Relationship |
create(Context context) |
Relationship |
create(Context c,
Item leftItem,
Item rightItem,
RelationshipType relationshipType,
int leftPlace,
int rightPlace)
This method is used to construct a Relationship object with all it's variables
|
Relationship |
create(Context context,
Relationship relationship)
This method creates a relationship object in the database equal to the given relationship param
if this is a valid relationship
|
void |
delete(Context context,
Relationship relationship) |
Relationship |
find(Context context,
int id) |
List<Relationship> |
findAll(Context context)
Retrieves the full list of relationships currently in the system
|
List<Relationship> |
findByItem(Context context,
Item item)
Retrieves the list of Relationships currently in the system for which the given Item is either
a leftItem or a rightItem object
|
List<Relationship> |
findByItemAndRelationshipType(Context context,
Item item,
RelationshipType relationshipType)
This method returns a list of Relationships for which the leftItem or rightItem is equal to the given
Item object and for which the RelationshipType object is equal to the relationshipType property
|
List<Relationship> |
findByItemAndRelationshipType(Context context,
Item item,
RelationshipType relationshipType,
boolean isLeft) |
List<Relationship> |
findByRelationshipType(Context context,
RelationshipType relationshipType)
This method returns a list of Relationship objets for which the relationshipType property is equal to the given
RelationshipType object
|
int |
findLeftPlaceByLeftItem(Context context,
Item item)
Retrieves the highest integer value for the leftplace property of a Relationship for all relationships
that have the given item as a left item
|
int |
findRightPlaceByRightItem(Context context,
Item item)
Retrieves the highest integer value for the rightplace property of a Relationship for all relationships
that have the given item as a right item
|
void |
update(Context context,
List<Relationship> relationships) |
void |
update(Context context,
Relationship relationship) |
void |
updateItem(Context context,
Item relatedItem)
This method will update the given item's metadata order.
|
void |
updatePlaceInRelationship(Context context,
Relationship relationship,
boolean isCreation)
This method will update the place for the Relationship and all other relationships found by the items and
relationship type of the given Relatonship.
|
@Autowired(required=true) protected RelationshipDAO relationshipDAO
@Autowired(required=true) protected AuthorizeService authorizeService
@Autowired(required=true) protected ItemService itemService
@Autowired(required=true) protected RelationshipTypeService relationshipTypeService
public Relationship create(Context context) throws SQLException, AuthorizeException
create in interface DSpaceCRUDService<Relationship>SQLExceptionAuthorizeExceptionpublic Relationship create(Context c, Item leftItem, Item rightItem, RelationshipType relationshipType, int leftPlace, int rightPlace) throws AuthorizeException, SQLException
RelationshipServicecreate in interface RelationshipServicec - The relevant DSpace contextleftItem - The leftItem Item object for the relationshiprightItem - The rightItem Item object for the relationshiprelationshipType - The RelationshipType object for the relationshipleftPlace - The leftPlace integer for the relationshiprightPlace - The rightPlace integer for the relationshipAuthorizeException - If something goes wrongSQLException - If something goes wrongpublic Relationship create(Context context, Relationship relationship) throws SQLException, AuthorizeException
RelationshipServicecreate in interface RelationshipServicecontext - The relevant DSpace contextrelationship - The relationship that will be created in the database if it is validSQLException - If something goes wrongAuthorizeException - If something goes wrong with authorizationspublic void updatePlaceInRelationship(Context context, Relationship relationship, boolean isCreation) throws SQLException, AuthorizeException
RelationshipServiceupdatePlaceInRelationship in interface RelationshipServicecontext - The relevant DSpace contextrelationship - The Relationship object that will have it's place updated and that will be used
to retrieve the other relationships whose place might need to be updatedisCreation - Is the relationship new or did it already existSQLException - If something goes wrongAuthorizeExceptionpublic void updateItem(Context context, Item relatedItem) throws SQLException, AuthorizeException
RelationshipServiceupdateItem in interface RelationshipServicecontext - The relevant DSpace contextrelatedItem - The Item for which the list of Relationship location is calculated
based on a metadata fieldSQLException - If something goes wrongAuthorizeException - If the user is not authorized to update the itempublic int findLeftPlaceByLeftItem(Context context, Item item) throws SQLException
RelationshipServicefindLeftPlaceByLeftItem in interface RelationshipServicecontext - The relevant DSpace contextitem - The item that has to be the leftItem of a relationship for it to qualifySQLException - If something goes wrongpublic int findRightPlaceByRightItem(Context context, Item item) throws SQLException
RelationshipServicefindRightPlaceByRightItem in interface RelationshipServicecontext - The relevant DSpace contextitem - The item that has to be the rightitem of a relationship for it to qualifySQLException - If something goes wrongpublic Relationship find(Context context, int id) throws SQLException
find in interface DSpaceCRUDService<Relationship>SQLExceptionpublic List<Relationship> findByItem(Context context, Item item) throws SQLException
RelationshipServicefindByItem in interface RelationshipServicecontext - The relevant DSpace contextitem - The Item that has to be the left or right item for the relationship to be included in the listSQLException - If something goes wrongpublic List<Relationship> findAll(Context context) throws SQLException
RelationshipServicefindAll in interface RelationshipServicecontext - The relevant DSpace contextSQLException - If something goes wrongpublic void update(Context context, Relationship relationship) throws SQLException, AuthorizeException
update in interface DSpaceCRUDService<Relationship>SQLExceptionAuthorizeExceptionpublic void update(Context context, List<Relationship> relationships) throws SQLException, AuthorizeException
update in interface DSpaceCRUDService<Relationship>SQLExceptionAuthorizeExceptionpublic void delete(Context context, Relationship relationship) throws SQLException, AuthorizeException
delete in interface DSpaceCRUDService<Relationship>SQLExceptionAuthorizeExceptionpublic List<Relationship> findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType, boolean isLeft) throws SQLException
SQLExceptionpublic List<Relationship> findByItemAndRelationshipType(Context context, Item item, RelationshipType relationshipType) throws SQLException
RelationshipServicefindByItemAndRelationshipType in interface RelationshipServicecontext - The relevant DSpace contextitem - The Item object to be matched on the leftItem or rightItem for the relationshiprelationshipType - The RelationshipType object that will be used to check the Relationship onSQLException - If something goes wrongpublic List<Relationship> findByRelationshipType(Context context, RelationshipType relationshipType) throws SQLException
RelationshipServicefindByRelationshipType in interface RelationshipServicecontext - The relevant DSpace contextrelationshipType - The RelationshipType object that will be used to check the Relationship onSQLException - If something goes wrongCopyright © 2019 DuraSpace. All rights reserved.