@Override public List<String> getTermIdsForAcademicCalendar(String acalId, ContextInfo context) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException { // Perform an atp search to get the search results List<String> includedTermIds = new ArrayList<String>(); // Get a list of term types List<TypeTypeRelationInfo> typeRelations = typeService.getTypeTypeRelationsByOwnerAndType( AtpServiceConstants.ATP_PARENT_TERM_GROUPING_TYPE_KEY, TypeServiceConstants.TYPE_TYPE_RELATION_GROUP_TYPE_KEY, context); List<String> termTypeIds = new ArrayList<String>(); for (TypeTypeRelationInfo typeRelation : typeRelations) { termTypeIds.add(typeRelation.getRelatedTypeKey()); } SearchRequestInfo searchRequestInfo = new SearchRequestInfo(AtpSearchServiceConstants.ATP_SEARCH_RELATED_ATP_IDS_BY_ATP_ID); searchRequestInfo.addParam(AtpSearchServiceConstants.ATP_QUERYPARAM_PARENT_ATP_ID, acalId); searchRequestInfo.addParam( AtpSearchServiceConstants.ATP_QUERYPARAM_RELATED_ATP_TYPES, termTypeIds); SearchResultInfo results = atpService.search(searchRequestInfo, context); for (SearchResultRowInfo row : results.getRows()) { for (SearchResultCellInfo cell : row.getCells()) { if (AtpSearchServiceConstants.ATP_RESULTCOLUMN_RELATED_ATP_ID.equals(cell.getKey())) { includedTermIds.add(cell.getValue()); } } } return includedTermIds; }
@Override public List<String> getRelatedAtpIdsForParentAtpIdAndRelationType( String atpId, String relationTypeKey, ContextInfo context) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException { // Perform an atp search to get the search results List<String> includedTermIds = new ArrayList<String>(); SearchRequestInfo searchRequestInfo = new SearchRequestInfo(AtpSearchServiceConstants.ATP_SEARCH_RELATED_ATP_IDS_BY_ATP_ID); searchRequestInfo.addParam(AtpSearchServiceConstants.ATP_QUERYPARAM_PARENT_ATP_ID, atpId); searchRequestInfo.addParam( AtpSearchServiceConstants.ATP_QUERYPARAM_RELATION_TYPE, relationTypeKey); SearchResultInfo results = atpService.search(searchRequestInfo, context); if (results != null && !results.getRows().isEmpty()) { for (SearchResultRowInfo row : results.getRows()) { for (SearchResultCellInfo cell : row.getCells()) { if (AtpSearchServiceConstants.ATP_RESULTCOLUMN_RELATED_ATP_ID.equals(cell.getKey())) { includedTermIds.add(cell.getValue()); } } } } return includedTermIds; }