private void detailConfiguredDocumentHandler(SourceBean request, SourceBean response) throws Exception { logger.debug("IN"); String tempFolder = (String) request.getAttribute(DossierConstants.DOSSIER_TEMP_FOLDER); String confDocIdent = (String) request.getAttribute("configureddocumentidentifier"); // get configured document IDossierDAO dossierDao = new DossierDAOHibImpl(); ConfiguredBIDocument confDoc = dossierDao.getConfiguredDocument(confDocIdent, tempFolder); // get parameter value map Map paramValueMap = confDoc.getParameters(); // create parameter name map // Integer idobj = confDoc.getId(); String label = confDoc.getLabel(); BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(label); Integer idobj = obj.getId(); IBIObjectParameterDAO biobjpardao = DAOFactory.getBIObjectParameterDAO(); List params = biobjpardao.loadBIObjectParametersById(idobj); Iterator iterParams = params.iterator(); Map paramNameMap = new HashMap(); while (iterParams.hasNext()) { BIObjectParameter par = (BIObjectParameter) iterParams.next(); String parLabel = par.getLabel(); String parUrlName = par.getParameterUrlName(); paramNameMap.put(parLabel, parUrlName); } // set attribute into response response.setAttribute("parnamemap", paramNameMap); response.setAttribute("parvaluemap", paramValueMap); // response.setAttribute("idobj", confDoc.getId()); response.setAttribute("description", confDoc.getDescription()); response.setAttribute("label", confDoc.getLabel()); response.setAttribute("name", confDoc.getName()); response.setAttribute("logicalname", confDoc.getLogicalName()); response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierConfiguredDocumentDetail"); logger.debug("OUT"); }
private void saveConfiguredDocumentHandler(SourceBean request, SourceBean response) throws Exception { logger.debug("IN"); String tempFolder = (String) request.getAttribute(DossierConstants.DOSSIER_TEMP_FOLDER); String label = (String) request.getAttribute("biobject_label"); // get logical name assigned to the configured document String logicalName = (String) request.getAttribute("logicalname"); if ((logicalName == null) || logicalName.trim().equalsIgnoreCase("")) { logicalName = ""; // throw new EMFUserError(EMFErrorSeverity.ERROR, 103, "component_dossier_messages"); } // load biobject using label // Integer id = new Integer(idobj); IBIObjectDAO biobjdao = DAOFactory.getBIObjectDAO(); BIObject obj = biobjdao.loadBIObjectByLabel(label); IBIObjectParameterDAO biobjpardao = DAOFactory.getBIObjectParameterDAO(); // gets parameters of the biobject List params = biobjpardao.loadBIObjectParametersById(obj.getId()); Iterator iterParams = params.iterator(); // get map of the param url name and value assigned boolean findOutFormat = false; Map paramValueMap = new HashMap(); Map paramNameMap = new HashMap(); while (iterParams.hasNext()) { BIObjectParameter par = (BIObjectParameter) iterParams.next(); String parUrlName = par.getParameterUrlName(); if (parUrlName.equalsIgnoreCase("outputType")) findOutFormat = true; String value = (String) request.getAttribute(parUrlName); paramValueMap.put(parUrlName, value); paramNameMap.put(par.getLabel(), par.getParameterUrlName()); } if (!findOutFormat) { paramValueMap.put("outputType", "JPGBASE64"); } // fill a configured document bo with data retrived ConfiguredBIDocument confDoc = new ConfiguredBIDocument(); confDoc.setDescription(obj.getDescription()); // confDoc.setId(obj.getId()); confDoc.setLabel(obj.getLabel()); confDoc.setParameters(paramValueMap); confDoc.setName(obj.getName()); confDoc.setLogicalName(logicalName); // check if the error handler contains validation errors EMFErrorHandler errorHandler = getResponseContainer().getErrorHandler(); if (errorHandler.isOKByCategory(EMFErrorCategory.VALIDATION_ERROR)) { // store the configured document IDossierDAO dossierDao = new DossierDAOHibImpl(); dossierDao.addConfiguredDocument(confDoc, tempFolder); response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierLoopbackDossierDetail"); } else { // set attribute into response response.setAttribute("parnamemap", paramNameMap); response.setAttribute("parvaluemap", paramValueMap); // response.setAttribute("idobj", confDoc.getId()); response.setAttribute("description", confDoc.getDescription()); response.setAttribute("label", confDoc.getLabel()); response.setAttribute("name", confDoc.getName()); response.setAttribute("logicalname", confDoc.getLogicalName()); response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierConfiguredDocumentDetail"); } logger.debug("OUT"); }