DS-4224 Catch up with master

This commit is contained in:
Andrew Wood
2019-10-07 13:23:37 -04:00
parent a15ceb71e8
commit c2aa03d9f5
7 changed files with 20 additions and 16 deletions

View File

@@ -172,18 +172,18 @@ public class EntityServiceImpl implements EntityService {
}
@Override
public List<RelationshipType> getRelationshipTypesByLabel(Context context, String label) throws SQLException {
public List<RelationshipType> getRelationshipTypesByTypeName(Context context, String type) throws SQLException {
return getRelationshipTypesByLabel(context, label, -1, -1);
return getRelationshipTypesByTypeName(context, type, -1, -1);
}
@Override
public List<RelationshipType> getRelationshipTypesByTypeName(Context context, String label,
public List<RelationshipType> getRelationshipTypesByTypeName(Context context, String type,
Integer limit, Integer offset) throws SQLException {
List<RelationshipType> listToReturn = new LinkedList<>();
for (RelationshipType relationshipType : relationshipTypeService.findAll(context, limit, offset)) {
if (StringUtils.equals(relationshipType.getLeftwardType(),label) ||
StringUtils.equals(relationshipType.getRightwardType(),label)) {
if (StringUtils.equals(relationshipType.getLeftwardType(),type) ||
StringUtils.equals(relationshipType.getRightwardType(),type)) {
listToReturn.add(relationshipType);
}
}

View File

@@ -65,13 +65,14 @@ public class RelationshipTypeServiceImpl implements RelationshipTypeService {
@Override
public List<RelationshipType> findByLeftwardOrRightwardTypeName(Context context, String label) throws SQLException {
return findByLeftOrRightLabel(context, label, -1, -1);
return findByLeftwardOrRightwardTypeName(context, label, -1, -1);
}
@Override
public List<RelationshipType> findByLeftwardOrRightwardTypeName(Context context, String label, Integer limit, Integer offset)
public List<RelationshipType> findByLeftwardOrRightwardTypeName(Context context, String label, Integer limit,
Integer offset)
throws SQLException {
return relationshipTypeDAO.findByLeftOrRightLabel(context, label, limit, offset);
return relationshipTypeDAO.findByLeftwardOrRightwardTypeName(context, label, limit, offset);
}
@Override

View File

@@ -60,7 +60,8 @@ public interface RelationshipTypeDAO extends GenericDAO<RelationshipType> {
* @return A list of RelationshipType objects that have the given label as either the leftLabel or rightLabel
* @throws SQLException If something goes wrong
*/
List<RelationshipType> findByLeftwardOrRightwardTypeName(Context context, String type, Integer limit, Integer offset)
List<RelationshipType> findByLeftwardOrRightwardTypeName(Context context, String type, Integer limit,
Integer offset)
throws SQLException;
/**

View File

@@ -46,7 +46,8 @@ public class RelationshipTypeDAOImpl extends AbstractHibernateDAO<RelationshipTy
}
@Override
public List<RelationshipType> findByLeftwardOrRightwardTypeName(Context context, String type, Integer limit, Integer offset)
public List<RelationshipType> findByLeftwardOrRightwardTypeName(Context context, String type, Integer limit,
Integer offset)
throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);

View File

@@ -190,25 +190,25 @@ public interface EntityService {
* Retrieves a list of RelationshipType objects for which either their left or right label is equal to the
* label parameter that's being passed along
* @param context The relevant DSpace context
* @param label The label for which the relationshiptype's labels must be checked
* @param type The label for which the relationshiptype's labels must be checked
* @return The list of relationshiptypes that each contain a left or right label that is equal
* to the given label parameter
* @throws SQLException If something goes wrong
*/
List<RelationshipType> getRelationshipTypesByTypeName(Context context, String label) throws SQLException;
List<RelationshipType> getRelationshipTypesByTypeName(Context context, String type) throws SQLException;
/**
* Retrieves a list of RelationshipType objects for which either their left or right label is equal to the
* label parameter that's being passed along
* @param context The relevant DSpace context
* @param label The label for which the relationshiptype's labels must be checked
* @param type The label for which the relationshiptype's labels must be checked
* @param limit paging limit
* @param offset paging offset
* @return The list of relationshiptypes that each contain a left or right label that is equal
* to the given label parameter
* @throws SQLException If something goes wrong
*/
List<RelationshipType> getRelationshipTypesByLabel(Context context, String label,
List<RelationshipType> getRelationshipTypesByTypeName(Context context, String type,
Integer limit, Integer offset) throws SQLException;
}

View File

@@ -85,7 +85,8 @@ public interface RelationshipTypeService extends DSpaceCRUDService<RelationshipT
* that is equal to the given label param
* @throws SQLException If something goes wrong
*/
List<RelationshipType> findByLeftOrRightLabel(Context context, String label, Integer limit, Integer offset)
List<RelationshipType> findByLeftwardOrRightwardTypeName(Context context, String label, Integer limit,
Integer offset)
throws SQLException;
/**

View File

@@ -144,7 +144,7 @@ public class RelationshipTypeDAOImplTest extends AbstractIntegrationTest {
@Test
public void testFindByLeftOrRightLabel() throws Exception {
assertEquals("TestFindByLeftOrRightLabel 0", relationshipTypeList, relationshipTypeService.
findByLeftOrRightLabel(context, "isAuthorOfPublication", -1, -1));
findByLeftwardOrRightwardTypeName(context, "isAuthorOfPublication", -1, -1));
}
/**