SearchResultRowInfo result = new SearchResultRowInfo(); int i=0; for (ResultColumnInfo resultColumn : searchTypeInfo.getSearchResultTypeInfo().getResultColumns()) { result.getCells().add(resultCell); i++;
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; } }
SearchResultRowInfo row = new SearchResultRowInfo(); 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()); String orgLongName = null; String orgType = null; for(SearchResultCellInfo cell:row.getCells()){ if("org.resultColumn.orgId".equals(cell.getKey())){ orgId = cell.getValue(); rowToUpdate.addCell("subjectCode.resultColumn.orgShortName", orgShortName); rowToUpdate.addCell("subjectCode.resultColumn.orgLongName", orgLongName); rowToUpdate.addCell("subjectCode.resultColumn.orgType", orgType);
for (int i = startAt; (i < persons.size() && i < maxResult); i++) { Person person = persons.get(i); final SearchResultRowInfo resultRow = new SearchResultRowInfo(); resultRow.setCells(new ArrayList<SearchResultCellInfo>()); resultRow.getCells().add(cell); resultRow.getCells().add(cell); resultRow.getCells().add(cell); resultRow.getCells().add(cell); resultRow.getCells().add(cell);
for(SearchResultCellInfo cell:row.getCells()){ if(cell.getValue()!=null && "lu.resultColumn.resultComponentId".equals(cell.getKey())) { String lrcId = null; String lrcName = null; for(SearchResultCellInfo cell:row.getCells()){ if("lrc.resultColumn.resultComponent.id".equals(cell.getKey())){ lrcId = cell.getValue(); resultRow.addCell("lu.resultColumn.resultComponentName",lrcName);
for (SearchResultCellInfo stmtCell : stmtRow.getCells()) { if ("stmt.resultColumn.refObjId".equals(stmtCell.getKey())) { refObjId = stmtCell.getValue(); SearchResultRowInfo resultRow = new SearchResultRowInfo(); 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.getCells().add(orgIdsCell); resultRow.getCells().add(orgNamesCell); resultRow.addCell("lu.resultColumn.luOptionalDependencyRequirementDifferentAdminOrg", String.valueOf(differentAdminOrg)); for (SearchResultCellInfo cell : row.getCells()) { if ("org.resultColumn.orgId".equals(cell.getKey())) { orgId = cell.getValue(); SearchResultRowInfo resultRow = new SearchResultRowInfo();
/** * @see org.kuali.student.common.ui.client.widgets.list.ListItems#getItemIds() */ @Override public List<String> getItemIds() { List<String> ids = new ArrayList<String>(); for (SearchResultRowInfo s:resultDataMap){ ids.add(s.getCells().get(keyAttrNdx).getValue()); } return ids; }
private SearchResultRowInfo mapResultRow( String subSearchKey, SearchResultRowInfo row, CrossSearchTypeInfo crossSearchType) { SearchResultRowInfo resultRow = new SearchResultRowInfo(); for(JoinResultMappingInfo resultMapping: crossSearchType.getJoinResultMappings()){ if(subSearchKey.equals(resultMapping.getSubSearchKey())){ for(SearchResultCellInfo cell: row.getCells()){ if(resultMapping.getSubSearchResultParam().equals(cell.getKey())){ SearchResultCellInfo mappedCell = new SearchResultCellInfo(); mappedCell.setKey(resultMapping.getResultParam()); mappedCell.setValue(cell.getValue()); resultRow.getCells().add(mappedCell); break;//FIXME breaks are bad... but there is no map in the cells } } } } return resultRow; } /**
@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()); }
private SearchResultRowInfo getListItem(String id) { for (SearchResultRowInfo s : resultDataMap) { if (s.getCells().get(keyAttrNdx).getValue().equals(id)) { return s; } } return null; }
/** * Maps results from multiple searches into a single result row * * @param permutation * @param crossSearchType * @return a mapped SearchResultRowInfo */ private SearchResultRowInfo mapResultRow( Map<String, SearchResultRowInfo> permutation, CrossSearchTypeInfo crossSearchType) { //FIXME this is pretty inefficient to loop through everything... a map structure for the cells might be better SearchResultRowInfo resultRow = new SearchResultRowInfo(); for(JoinResultMappingInfo resultMapping: crossSearchType.getJoinResultMappings()){ for(SearchResultCellInfo cell: permutation.get(resultMapping.getSubSearchKey()).getCells()){ if(resultMapping.getSubSearchResultParam().equals(cell.getKey())){ SearchResultCellInfo mappedCell = new SearchResultCellInfo(); mappedCell.setKey(resultMapping.getResultParam()); mappedCell.setValue(cell.getValue()); resultRow.getCells().add(mappedCell); break;//FIXME breaks are bad... but there is no map in the cells } } } return resultRow; }
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; }
public void setResults(List<SearchResultRowInfo> results) { resultDataMap.clear(); if (results != null){ resultDataMap = new ArrayList<SearchResultRowInfo>(results); //Default keys for column attributes if (results.size() > 0){ SearchResultRowInfo r = results.get(0); if (attrKeys == null){ attrKeys = new ArrayList<String>(); for (int i=0; i < r.getCells().size(); i ++){ attrKeys.add("attr" + String.valueOf(i)); } } } } }
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; }
@Override public String getItemAttribute(String id, String attrKey) { SearchResultRowInfo r = getListItem(id); int attrIndex = attrKeys.indexOf(attrKey); if (attrIndex >= 0 && r != null){ return r.getCells().get(attrIndex + attrOffset).getValue(); } return null; }
SearchResultRowInfo row = new SearchResultRowInfo(); 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);
/** * @see org.kuali.student.common.ui.client.widgets.list.ListItems#getItemText(java.lang.String) */ @Override public String getItemText(String id) { if(getListItem(id)!=null){ return getListItem(id).getCells().get(itemTextAttrNdx).getValue(); } return ""; }
SearchResultRowInfo row = new SearchResultRowInfo(); 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);
protected List<Map<String,String>> attributeSetFromSearchResult(List<SearchResultRowInfo> results, String orgIdKey) { List<Map<String,String>> returnAttrSetList = new ArrayList<Map<String,String>>(); if (results != null) { for (SearchResultRowInfo result : results) { Map<String,String> attributeSet = new LinkedHashMap<String,String>(); String resolvedOrgId = ""; String resolvedOrgShortName = ""; for (SearchResultCellInfo resultCell : result.getCells()) { if ("org.resultColumn.orgId".equals(resultCell.getKey())) { resolvedOrgId = resultCell.getValue(); } else if ("org.resultColumn.orgShortName".equals(resultCell.getKey())) { resolvedOrgShortName = resultCell.getValue(); } } if (orgIdKey != null) { attributeSet.put(orgIdKey, resolvedOrgId); } attributeSet.put(KualiStudentKimAttributes.QUALIFICATION_ORG_ID, resolvedOrgId); returnAttrSetList.add(attributeSet); } } return returnAttrSetList; }