コード例 #1
0
 private void newConfiguredDocumentHandler(SourceBean request, SourceBean response)
     throws SourceBeanException, EMFUserError {
   logger.debug("IN");
   String tempFolder = (String) request.getAttribute(DossierConstants.DOSSIER_TEMP_FOLDER);
   Object objIdObj = request.getAttribute(DossierConstants.DOSSIER_CONFIGURED_BIOBJECT_ID);
   if (!(objIdObj instanceof String)) {
     Map errBackPars = new HashMap();
     errBackPars.put("PAGE", DossierConstants.DOSSIER_MANAGEMENT_PAGE);
     errBackPars.put(DossierConstants.DOSSIER_TEMP_FOLDER, tempFolder);
     errBackPars.put(LightNavigationManager.LIGHT_NAVIGATOR_DISABLED, "true");
     errBackPars.put(SpagoBIConstants.OPERATION, DossierConstants.OPERATION_DETAIL_DOSSIER);
     throw new EMFUserError(
         EMFErrorSeverity.ERROR, "102", null, errBackPars, "component_dossier_messages");
   }
   String objIdStr = (String) objIdObj;
   Integer objId = new Integer(objIdStr);
   BIObject obj = null;
   List params = null;
   List roleList = null;
   try {
     IBIObjectDAO biobjdao = DAOFactory.getBIObjectDAO();
     obj = biobjdao.loadBIObjectById(objId);
     Integer id = obj.getId();
     IBIObjectParameterDAO biobjpardao = DAOFactory.getBIObjectParameterDAO();
     params = biobjpardao.loadBIObjectParametersById(id);
     IRoleDAO roleDao = DAOFactory.getRoleDAO();
     roleList = roleDao.loadAllRoles();
   } catch (Exception e) {
     SpagoBITracer.major(
         DossierConstants.NAME_MODULE,
         this.getClass().getName(),
         "newConfiguredDocumentHandler",
         "Error while loading biobje parameters and roles",
         e);
   }
   Integer id = obj.getId();
   String descr = obj.getDescription();
   String label = obj.getLabel();
   String name = obj.getName();
   Iterator iterParams = params.iterator();
   HashMap parNamesMap = new HashMap();
   HashMap parValueMap = new HashMap();
   while (iterParams.hasNext()) {
     BIObjectParameter par = (BIObjectParameter) iterParams.next();
     String parLabel = par.getLabel();
     String parUrlName = par.getParameterUrlName();
     parNamesMap.put(parLabel, parUrlName);
     parValueMap.put(parUrlName, "");
   }
   response.setAttribute("parnamemap", parNamesMap);
   response.setAttribute("parvaluemap", parValueMap);
   response.setAttribute("idobj", id);
   response.setAttribute("description", descr);
   response.setAttribute("label", label);
   response.setAttribute("name", name);
   response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierConfiguredDocumentDetail");
   logger.debug("OUT");
 }
コード例 #2
0
  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");
  }