/** * listDocuments */ public ims.admin.vo.PrintAgentDocumentsVoCollection listDocuments(Integer jobId, ims.framework.utils.DateTime startDate, ims.framework.utils.DateTime endDate) { DomainFactory factory = getDomainFactory(); List list = factory.find("from PrintAgentDocuments pad where pad.printAgent.id = :ID and pad.systemInformation.creationDateTime between :DATE1 and :DATE2 order by pad.systemInformation.creationDateTime desc", new String[] {"ID", "DATE1", "DATE2"}, new Object[] {jobId, startDate.getJavaDate(), endDate.getJavaDate()}); PrintAgentDocumentsVoCollection coll = PrintAgentDocumentsVoAssembler.createPrintAgentDocumentsVoCollectionFromPrintAgentDocuments(list); for(int i = 0; i < coll.size(); i++) { Iterator it = list.iterator(); while(it.hasNext()) { PrintAgentDocuments obj = (PrintAgentDocuments)it.next(); if(coll.get(i).getID_PrintAgentDocuments().equals(obj.getId())) { coll.get(i).setLastUpdateDateTime(new DateTime(obj.getSystemInformation().getCreationDateTime())); break; } } } return coll.sort(SortOrder.DESCENDING); }
private void searchDocuments(boolean firstSearch) { form.grdDocuments().getRows().clear();// WDEV-15152 if(isSearchCriteriaValid())// WDEV-15152 { PrintAgentDocumentsVoCollection coll = null; coll = domain.listDocuments(form.getGlobalContext().getJobId(), form.dtimStart().getValue(), form.dtimEnd().getValue()); displayDocuments(coll); if(form.grdDocuments().getRows().size() == 0 && !firstSearch)// WDEV-15152 engine.showMessage("No documents found."); } }
private void displayDocuments(PrintAgentDocumentsVoCollection coll) { String letters; form.grdDocuments().getRows().clear(); for(int i = 0; i < coll.size(); i++) { grdDocumentsRow row = form.grdDocuments().getRows().newRow(); if(coll.get(i).getPrintedLettersIsNotNull() && coll.get(i).getPrintedLetters().intValue() > 0) { if(coll.get(i).getPrintedLetters().intValue() == 1) letters = "1 letter created"; else letters = coll.get(i).getPrintedLetters().toString() + " letters created"; } else { letters = "No data to print"; row.setTextColor(Color.Brown); } row.setValue(coll.get(i)); row.setColumnDateTime((coll.get(i).getDescriptionIsNotNull() ? coll.get(i).getDescription() + " - " : "") + (coll.get(i).getLastUpdateDateTimeIsNotNull() ? coll.get(i).getLastUpdateDateTime().toString() : "")); row.setColumnLetters(letters); } }