protected SearchResultRowInfo createSearchResultRowFromTypeInfo(TypeInfo typeInfo, String idKey, String nameKey, String descKey){ if (typeInfo==null){ return null; } SearchResultRowInfo row = new SearchResultRowInfo(); row.addCell(idKey, typeInfo.getKey()); row.addCell(nameKey, typeInfo.getName()); if (descKey != null){ row.addCell(descKey, typeInfo.getDescr().getPlain()); } return row; } }
@Override public SearchResultInfo search(SearchRequestInfo searchRequestInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws MissingParameterException, OperationFailedException, PermissionDeniedException { if("appt.search.appointmentCountForWindowId".equals(searchRequestInfo.getSearchKey())){ //This is a hardwired search for AppointmentWindows //It gets the count of appointments for a given window Id String windowId = searchRequestInfo.getParams().get(0).getValues().get(0); Object[] result = (Object[]) enrollmentDao.getEm(). createQuery("SELECT w.createTime, MIN(s.startDate), MAX(s.startDate), COUNT(*), COUNT(DISTINCT s.id) " + "FROM AppointmentWindowEntity w, AppointmentSlotEntity s, AppointmentEntity a " + "WHERE w.id= :windowId AND s.apptWinEntity.id = w.id AND a.slotEntity.id = s.id GROUP BY w.createTime"). setParameter("windowId", windowId). getSingleResult(); SearchResultInfo searchResult = new SearchResultInfo(); SearchResultRowInfo row = new SearchResultRowInfo(); row.addCell("createTime", DateFormatters.MONTH_DAY_YEAR_TIME_DATE_FORMATTER.format(result[0].toString())); row.addCell("firstSlot",DateFormatters.MONTH_DAY_YEAR_TIME_DATE_FORMATTER.format(result[1].toString())); row.addCell("lastSlot",DateFormatters.MONTH_DAY_YEAR_TIME_DATE_FORMATTER.format(result[2].toString())); row.addCell("numAppts",result[3].toString()); row.addCell("numSlots",result[4].toString()); searchResult.getRows().add(row); return searchResult; } throw new OperationFailedException("The requested search key is not configured: "+searchRequestInfo.getSearchKey()); }
protected SearchResultInfo doSubjectCodeGenericSearch(Map<String, Object> paramMap) { SearchResultInfo searchResult = new SearchResultInfo(); Map<String,String> queryMap = new HashMap<String,String>(); String code = (String) paramMap.get("subjectCode.queryParam.code"); if(code!=null){ code = "%" + code.toUpperCase() + "%"; } //Use built in KNS lookup to perform the search List<SubjectCode> subjectCodes = subjectCodeDao.getBySubjectCode(code); //Default sort by code Collections.sort(subjectCodes,new Comparator<SubjectCode>(){ @Override public int compare(SubjectCode o1, SubjectCode o2) { if(o1==null && o2==null){ return 0; } return o1.getCode().compareTo(o2.getCode()); }}); //Convert to a KS search result for(SubjectCode subjectCode:subjectCodes){ SearchResultRowInfo row = new SearchResultRowInfo(); row.addCell("subjectCode.resultColumn.id", subjectCode.getId()); row.addCell("subjectCode.resultColumn.code", subjectCode.getCode()); row.addCell("subjectCode.resultColumn.name", subjectCode.getName()); row.addCell("subjectCode.resultColumn.type", subjectCode.getType().getId()); searchResult.getRows().add(row); } return searchResult; }
private SearchResultInfo doSearchProposalsForReferenceIds( SearchRequestInfo searchRequest) { List<String> referenceIds = null; for(SearchParamInfo param: searchRequest.getParams()){ if("proposal.queryParam.proposalOptionalReferenceIds".equals(param.getKey())){ referenceIds = param.getValues(); } } List<Proposal> proposals = proposalDao.getProposalsByRefernceIds(referenceIds); SearchResultInfo result = new SearchResultInfo(); for(Proposal proposal:proposals){ for(ProposalReference reference:proposal.getProposalReference()){ SearchResultRowInfo row = new SearchResultRowInfo(); row.addCell("proposal.resultColumn.proposalId", proposal.getId()); row.addCell("proposal.resultColumn.proposalOptionalName", proposal.getName()); row.addCell("proposal.resultColumn.proposalOptionalReferenceId", reference.getObjectReferenceId()); result.getRows().add(row); } } return result; }
row.addCell("subjectCode.resultColumn.code", subjectCodeJoinOrg.getSubjectCode().getCode()); row.addCell("subjectCode.resultColumn.type", subjectCodeJoinOrg.getSubjectCode().getType().getId()); row.addCell("subjectCode.resultColumn.activeFrom", subjectCodeJoinOrg.getActiveFromDate()==null?null: DateFormatThread.format(new Date(subjectCodeJoinOrg.getActiveFromDate().getTime()))); row.addCell("subjectCode.resultColumn.activeTo", subjectCodeJoinOrg.getActiveToDate()==null?null:format.format(new Date(subjectCodeJoinOrg.getActiveToDate().getTime()))); row.addCell("subjectCode.resultColumn.orgId", subjectCodeJoinOrg.getOrgId()); rowToUpdate.addCell("subjectCode.resultColumn.orgShortName", orgShortName); rowToUpdate.addCell("subjectCode.resultColumn.orgLongName", orgLongName); rowToUpdate.addCell("subjectCode.resultColumn.orgType", orgType);
row.addCell("stmt.resultColumn.refObjId",relation.getRefObjectId()); row.addCell("stmt.resultColumn.rootId",statement.getId()); row.addCell("stmt.resultColumn.requirementComponentIds",rootToRequirementComponentList.get(statement.getId())); row.addCell("stmt.resultColumn.statementTypeId",statement.getStatementType().getId()); row.addCell("stmt.resultColumn.statementTypeName",statement.getStatementType().getName()); searchResult.getRows().add(row);
row.addCell("enumeration.resultColumn.code", enumValue.getCode()); row.addCell("enumeration.resultColumn.abbrevValue", enumValue.getAbbrevValue()); row.addCell("enumeration.resultColumn.value", enumValue.getValue()); row.addCell("enumeration.resultColumn.sortKey", enumValue.getSortKey()); searchResult.getRows().add(row);
resultRow.addCell("lu.resultColumn.resultComponentName",lrcName);
resultRow.addCell("lu.resultColumn.cluId", clu.getId()); resultRow.addCell("lu.resultColumn.cluType", clu.getLuType().getId()); resultRow.addCell("lu.resultColumn.luOptionalCode", clu.getOfficialIdentifier().getCode()); resultRow.addCell("lu.resultColumn.luOptionalShortName", clu.getOfficialIdentifier().getShortName()); resultRow.addCell("lu.resultColumn.luOptionalLongName", clu.getOfficialIdentifier().getLongName()); resultRow.addCell("lu.resultColumn.luOptionalDependencyType", statementType); resultRow.addCell("lu.resultColumn.luOptionalDependencyTypeName", statementTypeName); resultRow.addCell("lu.resultColumn.luOptionalDependencyRootId", rootId); resultRow.addCell("lu.resultColumn.luOptionalDependencyRequirementComponentIds", requirementComponentIds); resultRow.addCell("lu.resultColumn.luOptionalDependencyRequirementDifferentAdminOrg", String.valueOf(differentAdminOrg)); resultRow.addCell("lu.resultColumn.cluId", cluSet.getId()); resultRow.addCell("lu.resultColumn.luOptionalShortName", cluSet.getName()); resultRow.addCell("lu.resultColumn.luOptionalLongName", cluSet.getName()); resultRow.addCell("lu.resultColumn.luOptionalDependencyType", "cluSet"); resultRow.addCell("lu.resultColumn.luOptionalDependencyTypeName", "Course Set"); resultRow.addCell("lu.resultColumn.cluId", clu.getId()); resultRow.addCell("lu.resultColumn.luOptionalCode", clu.getOfficialIdentifier().getCode()); resultRow.addCell("lu.resultColumn.luOptionalShortName", clu.getOfficialIdentifier().getShortName()); resultRow.addCell("lu.resultColumn.luOptionalLongName", clu.getOfficialIdentifier().getLongName()); resultRow.addCell("lu.resultColumn.luOptionalDependencyType", "joint"); resultRow.addCell("lu.resultColumn.luOptionalDependencyTypeName", "jointly offered"); resultRow.addCell("lu.resultColumn.luOptionalCode", altId.getCode()); resultRow.addCell("lu.resultColumn.luOptionalShortName", altId.getShortName());