mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 05:53:08 +00:00
[Task 65568] updated javadoc and comments
This commit is contained in:
@@ -250,7 +250,8 @@ public abstract class DSpaceObjectServiceImpl<T extends DSpaceObject> implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
MetadataValue metadataValue = metadataValueService.create(context, dso, metadataField);
|
MetadataValue metadataValue = metadataValueService.create(context, dso, metadataField);
|
||||||
//Set place to list length
|
//Set place to list length of all metadatavalues for the given schema.element.qualifier combination.
|
||||||
|
// Subtract one to adhere to the 0 as first element rule
|
||||||
metadataValue.setPlace(
|
metadataValue.setPlace(
|
||||||
this.getMetadata(dso, metadataField.getMetadataSchema().getName(), metadataField.getElement(),
|
this.getMetadata(dso, metadataField.getMetadataSchema().getName(), metadataField.getElement(),
|
||||||
metadataField.getQualifier(), Item.ANY).size() - 1);
|
metadataField.getQualifier(), Item.ANY).size() - 1);
|
||||||
|
@@ -82,6 +82,8 @@ public class RelationshipServiceImpl implements RelationshipService {
|
|||||||
if (isRelationshipValidToCreate(context, relationship)) {
|
if (isRelationshipValidToCreate(context, relationship)) {
|
||||||
if (authorizeService.authorizeActionBoolean(context, relationship.getLeftItem(), Constants.WRITE) ||
|
if (authorizeService.authorizeActionBoolean(context, relationship.getLeftItem(), Constants.WRITE) ||
|
||||||
authorizeService.authorizeActionBoolean(context, relationship.getRightItem(), Constants.WRITE)) {
|
authorizeService.authorizeActionBoolean(context, relationship.getRightItem(), Constants.WRITE)) {
|
||||||
|
// This order of execution should be handled in the creation (create, updateplace, update relationship)
|
||||||
|
// for a proper place allocation
|
||||||
Relationship relationshipToReturn = relationshipDAO.create(context, relationship);
|
Relationship relationshipToReturn = relationshipDAO.create(context, relationship);
|
||||||
updatePlaceInRelationship(context, relationshipToReturn);
|
updatePlaceInRelationship(context, relationshipToReturn);
|
||||||
update(context, relationshipToReturn);
|
update(context, relationshipToReturn);
|
||||||
@@ -100,6 +102,8 @@ public class RelationshipServiceImpl implements RelationshipService {
|
|||||||
public void updatePlaceInRelationship(Context context, Relationship relationship)
|
public void updatePlaceInRelationship(Context context, Relationship relationship)
|
||||||
throws SQLException, AuthorizeException {
|
throws SQLException, AuthorizeException {
|
||||||
Item leftItem = relationship.getLeftItem();
|
Item leftItem = relationship.getLeftItem();
|
||||||
|
// Max value is used to ensure that these will get added to the back of the list and thus receive the highest
|
||||||
|
// (last) place as it's set to a -1 for creation
|
||||||
if (relationship.getLeftPlace() == -1) {
|
if (relationship.getLeftPlace() == -1) {
|
||||||
relationship.setLeftPlace(Integer.MAX_VALUE);
|
relationship.setLeftPlace(Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
@@ -37,23 +37,23 @@ public interface RelationshipDAO extends GenericDAO<Relationship> {
|
|||||||
List<Relationship> findByItem(Context context,Item item) throws SQLException;
|
List<Relationship> findByItem(Context context,Item item) throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the highest leftplace integer for all the relationships where this
|
* This method returns the next leftplace integer to use for a relationship with this item as the leftItem
|
||||||
* item is the leftitem so that we can set a proper leftplace attribute on the next relationship
|
*
|
||||||
* @param context The relevant DSpace context
|
* @param context The relevant DSpace context
|
||||||
* @param item The item to be matched on leftItem
|
* @param item The item to be matched on leftItem
|
||||||
* @return The integer for the highest leftPlace value for all the relatonship objects
|
* @return The next integer to be used for the leftplace of a relationship with the given item
|
||||||
* that have the given item as leftItem
|
* as a left item
|
||||||
* @throws SQLException If something goes wrong
|
* @throws SQLException If something goes wrong
|
||||||
*/
|
*/
|
||||||
int findNextLeftPlaceByLeftItem(Context context, Item item) throws SQLException;
|
int findNextLeftPlaceByLeftItem(Context context, Item item) throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the highest rightplace integer for all the relationships where this
|
* This method returns the next rightplace integer to use for a relationship with this item as the rightItem
|
||||||
* item is the rightitem so that we can set a proper rightplace attribute on the next relationship
|
*
|
||||||
* @param context The relevant DSpace context
|
* @param context The relevant DSpace context
|
||||||
* @param item The item to be matched on rightItem
|
* @param item The item to be matched on rightItem
|
||||||
* @return The integer for the highest rightPlace value for all the relatonship objects
|
* @return The next integer to be used for the rightplace of a relationship with the given item
|
||||||
* that have the given item as rightItem
|
* as a right item
|
||||||
* @throws SQLException If something goes wrong
|
* @throws SQLException If something goes wrong
|
||||||
*/
|
*/
|
||||||
int findNextRightPlaceByRightItem(Context context, Item item) throws SQLException;
|
int findNextRightPlaceByRightItem(Context context, Item item) throws SQLException;
|
||||||
|
@@ -52,23 +52,23 @@ public interface RelationshipService extends DSpaceCRUDService<Relationship> {
|
|||||||
public Relationship create(Context context, Relationship relationship) throws SQLException, AuthorizeException;
|
public Relationship create(Context context, Relationship relationship) throws SQLException, AuthorizeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the highest integer value for the leftplace property of a Relationship for all relationships
|
* This method returns the next leftplace integer to use for a relationship with this item as the leftItem
|
||||||
* that have the given item as a left item
|
*
|
||||||
* @param context The relevant DSpace context
|
* @param context The relevant DSpace context
|
||||||
* @param item The item that has to be the leftItem of a relationship for it to qualify
|
* @param item The item that has to be the leftItem of a relationship for it to qualify
|
||||||
* @return The integer value of the highest left place property of all relationships
|
* @return The next integer to be used for the leftplace of a relationship with the given item
|
||||||
* that have the given item as a leftitem property
|
* as a left item
|
||||||
* @throws SQLException If something goes wrong
|
* @throws SQLException If something goes wrong
|
||||||
*/
|
*/
|
||||||
int findNextLeftPlaceByLeftItem(Context context, Item item) throws SQLException;
|
int findNextLeftPlaceByLeftItem(Context context, Item item) throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the highest integer value for the rightplace property of a Relationship for all relationships
|
* This method returns the next rightplace integer to use for a relationship with this item as the rightItem
|
||||||
* that have the given item as a right item
|
*
|
||||||
* @param context The relevant DSpace context
|
* @param context The relevant DSpace context
|
||||||
* @param item The item that has to be the rightitem of a relationship for it to qualify
|
* @param item The item that has to be the rightitem of a relationship for it to qualify
|
||||||
* @return The integer value of the highest right place property of all relationships
|
* @return The next integer to be used for the rightplace of a relationship with the given item
|
||||||
* that have the given item as a rightitem property
|
* as a right item
|
||||||
* @throws SQLException If something goes wrong
|
* @throws SQLException If something goes wrong
|
||||||
*/
|
*/
|
||||||
int findNextRightPlaceByRightItem(Context context, Item item) throws SQLException;
|
int findNextRightPlaceByRightItem(Context context, Item item) throws SQLException;
|
||||||
|
Reference in New Issue
Block a user