private int getMaxEmptyOccurrences(BIObjectParameter biParameter, List docs) { int toReturn = 0; logger.debug("IN"); Iterator it = docs.iterator(); while (it.hasNext()) { ConfiguredBIDocument configuredBIDocument = (ConfiguredBIDocument) it.next(); Map parameters = configuredBIDocument.getParameters(); BIObject configuredDocument = configuredBIDocument.loadBIObjectDetails(); List configuredDocumentParameters = configuredDocument.getBiObjectParameters(); int emptyOccurrences = getAnalyticalDriverEmptyOccurrences( biParameter, configuredDocumentParameters, parameters); if (emptyOccurrences > toReturn) { toReturn = emptyOccurrences; } } logger.debug("OUT: " + toReturn); return toReturn; }
private void addEmptyAnalyticalDrivers( BIObject dossier, ConfiguredBIDocument configuredBIDocument) { logger.debug("IN"); Map parameters = configuredBIDocument.getParameters(); BIObject configuredDocument = configuredBIDocument.loadBIObjectDetails(); List configuredDocumentParameters = configuredDocument.getBiObjectParameters(); Iterator configuredBIObjectParametersIt = configuredDocumentParameters.iterator(); while (configuredBIObjectParametersIt.hasNext()) { BIObjectParameter biParameter = (BIObjectParameter) configuredBIObjectParametersIt.next(); int emptyOccurrences = getAnalyticalDriverEmptyOccurrences( biParameter, configuredDocumentParameters, parameters); if (emptyOccurrences > 0) { int occurrenciesInDossier = getAnalyticalDriverOccurrenciesInDossier(dossier, biParameter.getParID()); for (int c = occurrenciesInDossier; c < emptyOccurrences; c++) { BIObjectParameter parameterToBeAdded = getEmptyOccurrence(biParameter, configuredDocumentParameters, parameters, c); addBIObjectParameterToDossier(dossier, parameterToBeAdded); } } } logger.debug("OUT"); }
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"); }