Skip to content

Commit

Permalink
odpi#5399 set max pagesize on query for relationships for parent Cate…
Browse files Browse the repository at this point in the history
…gory

Signed-off-by: David Radley <david_radley@uk.ibm.com>
  • Loading branch information
davidradl committed Jul 21, 2021
1 parent c183158 commit d6877cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ public SubjectAreaOMASAPIResponse<Category> getCategoryByGuid(String userId, Str
methodName);
CategoryMapper categoryMapper = mappersFactory.get(CategoryMapper.class);
Category category = categoryMapper.map(entityDetail);
setGlossary(userId, category, methodName);
setParentCategory(userId, category, methodName);
populateGlossarySummaryFromOMRS(userId, category, methodName);
populateParentCategoryFromOMRS(userId, category, methodName);
response.addResult(category);

} catch (InvalidParameterException | UserNotAuthorizedException | PropertyServerException | SubjectAreaCheckedException e) {
Expand Down Expand Up @@ -237,8 +237,8 @@ public SubjectAreaOMASAPIResponse<Category> findCategory(String userId, FindRequ

if (foundCategories != null) {
for (Category category : foundCategories) {
setGlossary(userId, category, methodName);
setParentCategory(userId, category, methodName);
populateGlossarySummaryFromOMRS(userId, category, methodName);
populateParentCategoryFromOMRS(userId, category, methodName);
response.addResult(category);
}
}
Expand All @@ -249,10 +249,10 @@ public SubjectAreaOMASAPIResponse<Category> findCategory(String userId, FindRequ
return response;
}

private void setGlossary(String userId, Category category, String methodName) throws SubjectAreaCheckedException,
PropertyServerException,
UserNotAuthorizedException,
InvalidParameterException {
private void populateGlossarySummaryFromOMRS(String userId, Category category, String methodName) throws SubjectAreaCheckedException,
PropertyServerException,
UserNotAuthorizedException,
InvalidParameterException {
final String guid = category.getSystemAttributes().getGUID();
List<Relationship> relationships =
getRelationshipsForEntityByType(methodName,
Expand All @@ -275,14 +275,13 @@ private void setGlossary(String userId, Category category, String methodName) th
}
}
}
// return the Term without a Glossary summary as we have not got one.
}


private void setParentCategory(String userId, Category category, String methodName) throws SubjectAreaCheckedException,
PropertyServerException,
UserNotAuthorizedException,
InvalidParameterException {
private void populateParentCategoryFromOMRS(String userId, Category category, String methodName) throws SubjectAreaCheckedException,
PropertyServerException,
UserNotAuthorizedException,
InvalidParameterException {
final String currentCategoryGuid = category.getSystemAttributes().getGUID();
List<EntityDetail> foundEntities = genericHandler.getAttachedFilteredEntities(userId,
currentCategoryGuid,
Expand All @@ -296,7 +295,7 @@ private void setParentCategory(String userId, Category category, String methodNa
0,
false,
false,
0,
maxPageSize,
methodName);

if (CollectionUtils.isNotEmpty(foundEntities)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2222,11 +2222,6 @@ public List<Relationship> formatRelationshipResults(List<Relationship> fullRe
return null;
}

if (pageSize == 0)
{
return fullResults;
}

int fullResultsSize = fullResults.size();

if (fromElement >= fullResultsSize)
Expand Down

0 comments on commit d6877cb

Please sign in to comment.