@Override public Boolean isLatestVersion(String versionIndId, Long versionSequenceNumber) throws Exception { //Perform a search to see if there are any new versions of the course that are approved, draft, etc. //We don't want to version if there are try { SearchRequestInfo request = new SearchRequestInfo("lu.search.isVersionable"); request.addParam("lu.queryParam.versionIndId", versionIndId); request.addParam("lu.queryParam.sequenceNumber", versionSequenceNumber.toString()); List<String> states = new ArrayList<String>(); states.add("Approved"); states.add("Active"); states.add("Draft"); states.add("Superseded"); request.addParam("lu.queryParam.luOptionalState", states); SearchResultInfo result = cluService.search(request, ContextUtils.getContextInfo()); String resultString = result.getRows().get(0).getCells().get(0).getValue(); return "0".equals(resultString); } catch (Exception e) { LOG.error("IS LATEST VERSION ERROR"); return false; } }
@Override public Boolean isLatestVersion(String versionIndId, Long versionSequenceNumber) throws Exception { try { //Perform a search to see if there are any new versions of the course that are approved, draft, etc. //We don't want to version if there are SearchRequestInfo request = new SearchRequestInfo("lu.search.isVersionable"); request.addParam("lu.queryParam.versionIndId", versionIndId); request.addParam("lu.queryParam.sequenceNumber", versionSequenceNumber.toString()); List<String> states = new ArrayList<String>(); states.add("Approved"); states.add("Active"); states.add("Draft"); states.add("Superseded"); request.addParam("lu.queryParam.luOptionalState", states); SearchResultInfo result = cluService.search(request, ContextUtils.getContextInfo()); String resultString = result.getRows().get(0).getCells().get(0).getValue(); return "0".equals(resultString); } catch (Exception ex) { // Log exception ex.printStackTrace(); throw new RuntimeException(ex); } }
private List<String> getDepartmentRelatedColleges(List<String> departmentIds, ContextInfo contextInfo) throws MissingParameterException, PermissionDeniedException, OperationFailedException, InvalidParameterException { List<String> departmentRelatedCollegeIds = new ArrayList<String>(); SearchRequestInfo searchRequest = new SearchRequestInfo("org.search.orgQuickViewByRelationTypeOrgTypeRelatedOrgIds"); List<String> orgTypes = new ArrayList<String>(); orgTypes.add("kuali.org.College"); searchRequest.addParam("org.queryParam.optionalOrgTypeList", orgTypes); searchRequest.addParam("org.queryParam.optionalRelationType", "kuali.org.Contain"); searchRequest.addParam("org.queryParam.relatedOrgIds", departmentIds); SearchResultInfo searchResult = getSearchDispatcher().search(searchRequest, contextInfo); if (null != searchResult) { for (SearchResultRowInfo row : searchResult.getRows()) { for (SearchResultCellInfo cell : row.getCells()) { if ("org.resultColumn.orgId".equals(cell.getKey())) { departmentRelatedCollegeIds.add(cell.getValue()); } } } } return departmentRelatedCollegeIds; }
private List<String> getDepartments(List<String> departmentIds, ContextInfo contextInfo) throws MissingParameterException, PermissionDeniedException, OperationFailedException, InvalidParameterException { List<String> departments = new ArrayList<String>(); SearchRequestInfo searchRequest = new SearchRequestInfo("org.search.generic"); List<String> orgTypes = new ArrayList<String>(); orgTypes.add("kuali.org.Department"); searchRequest.addParam("org.queryParam.orgOptionalType", orgTypes); searchRequest.addParam("org.queryParam.orgOptionalIds", departmentIds); SearchResultInfo searchResult = getSearchDispatcher().search(searchRequest, contextInfo); if (null != searchResult) { for (SearchResultRowInfo result : searchResult.getRows()) { for (SearchResultCellInfo resultCell : result.getCells()) { if ("org.resultColumn.orgOptionalLongName".equals(resultCell.getKey())) { departments.add(resultCell.getValue()); } } } } return departments; } }
private String getCollegeName(String collegeId, ContextInfo contextInfo) throws MissingParameterException, PermissionDeniedException, OperationFailedException, InvalidParameterException { String collegeName = ""; SearchRequestInfo searchRequest = new SearchRequestInfo("org.search.generic"); List<String> orgTypes = new ArrayList<String>(); orgTypes.add("kuali.org.College"); searchRequest.addParam("org.queryParam.orgOptionalType", orgTypes); searchRequest.addParam("org.queryParam.orgOptionalId", collegeId); SearchResultInfo searchResult = getSearchDispatcher().search(searchRequest, contextInfo); if (null != searchResult) { for (SearchResultRowInfo result : searchResult.getRows()) { for (SearchResultCellInfo resultCell : result.getCells()) { if ("org.resultColumn.orgOptionalLongName".equals(resultCell.getKey())) { collegeName = resultCell.getValue(); } } } } return collegeName; }
lrcSearchRequest.addParam("lrc.queryParam.resultComponent.idRestrictionList", new ArrayList<String>(rcIdToRowMapping.keySet())); SearchResultInfo lrcSearchResults = searchDispatcher.search(lrcSearchRequest, contextInfo);
sr.addParam("lu.queryParam.luOptionalCode", courseCode); sr.addParam("lu.queryParam.luOptionalType","kuali.lu.type.CreditCourse"); SearchResultInfo results = search(sr, contextInfo); Map<String,String> cluIdToCodeMap = new HashMap<String,String>(); sr.addParam("proposal.queryParam.proposalOptionalReferenceIds", new ArrayList<String>(cluIdToCodeMap.keySet())); results = searchDispatcher.search(sr, contextInfo); for(SearchResultRowInfo row:results.getRows()){
atpSearchRequest.addParam("atp.advancedAtpSearchParam.optionalAtpIds", new ArrayList<String>(atpIdToCellMapping.keySet())); SearchResultInfo atpSearchResults = searchDispatcher.search(atpSearchRequest, contextInfo); for(SearchResultRowInfo row:atpSearchResults.getRows()){
resultComponentSearchRequest.addParam("lrc.queryParam.resultComponent.type", "kuali.result.values.group.type.fixed"); resultComponentSearchRequest.addParam("lrc.queryParam.resultComponent.resultScaleId", "kuali.result.scale.degree"); orgIdTranslationSearchRequest.addParam("org.queryParam.orgOptionalIds", new ArrayList<String>( orgIdToCellMapping.keySet())); orgIdTranslationSearchRequest.setSortColumn("org.resultColumn.orgShortName");
searchRequest.addParam("subjectCode.queryParam.code", course.getSubjectArea());
searchRequest.addParam("org.queryParam.orgOptionalType",orgType); searchRequest.setSortColumn("org.resultColumn.orgOptionalLongName"); searchRequest.setSortDirection(SortDirection.ASC);
orgIdTranslationSearchRequest.addParam("org.queryParam.orgOptionalIds", new ArrayList<String>(orgIdToRowMapping.keySet())); SearchResultInfo orgIdTranslationSearchResult = getOrganizationService().search(orgIdTranslationSearchRequest, contextInfo);
statementSearchRequest.addParam("stmt.queryParam.cluSetIds", new ArrayList<String>(cluSetMap.keySet())); statementSearchRequest.addParam("stmt.queryParam.cluVersionIndIds", cluVersionIndIds); orgIdTranslationSearchRequest.addParam("org.queryParam.orgOptionalIds", new ArrayList<String>( orgIdToCellMapping.keySet())); SearchResultInfo orgIdTranslationSearchResult = searchDispatcher.search(orgIdTranslationSearchRequest, contextInfo);