/** * @see * org.kuali.kra.questionnaire.print.QuestionnairePrintingService#getQuestionnairePrintable(org.kuali.kra.bo.KraPersistableBusinessObjectBase, * java.util.List) */ public List<Printable> getQuestionnairePrintable( KraPersistableBusinessObjectBase printableBusinessObject, List<QuestionnairePrintOption> questionnairesToPrints) { List<Printable> printables = new ArrayList<Printable>(); for (QuestionnairePrintOption printOption : questionnairesToPrints) { if (printOption.isSelected()) { // AbstractPrint printable = getQuestionnairePrint(); AbstractPrint printable = new QuestionnairePrint(); printable.setXmlStream(getQuestionnairePrint().getXmlStream()); Map<String, Object> reportParameters = new HashMap<String, Object>(); Questionnaire questionnaire = getQuestionnaire(printOption.getQuestionnaireRefId()); reportParameters.put("questionnaireId", questionnaire.getQuestionnaireIdAsInteger()); reportParameters.put("template", questionnaire.getTemplate()); // will be used by amendquestionnaire reportParameters.put("moduleSubItemCode", printOption.getSubItemCode()); if (CoeusSubModule.PROTOCOL_SUBMISSION.equals(printOption.getSubItemCode())) { reportParameters.put(PROTOCOL_NUMBER, printOption.getItemKey()); reportParameters.put(SUBMISSION_NUMBER, printOption.getSubItemKey()); } if (printable != null) { printable.setPrintableBusinessObject(getProtocolPrintable(printOption)); printable.setReportParameters(reportParameters); printables.add(printable); } } } return printables; }
/* * get the appropriate protocol as printable. * need further work for requestion submission questionnaire printables * which should be retrieved from protocolsubmission ? */ private Protocol getProtocolPrintable(QuestionnairePrintOption printOption) { if (CoeusSubModule.PROTOCOL_SUBMISSION.equals(printOption.getSubItemCode())) { Map keyValues = new HashMap(); keyValues.put("protocolNumber", printOption.getItemKey()); keyValues.put("submissionNumber", printOption.getSubItemKey()); return (Protocol) ((List<ProtocolSubmission>) businessObjectService.findMatchingOrderBy( ProtocolSubmission.class, keyValues, "submissionId", false)) .get(0) .getProtocol(); } else { Map keyValues = new HashMap(); keyValues.put("protocolNumber", printOption.getItemKey()); keyValues.put("sequenceNumber", printOption.getSubItemKey()); return ((List<Protocol>) businessObjectService.findMatching(Protocol.class, keyValues)) .get(0); } }