Package it.eng.spagobi.behaviouralmodel.lov.dao

Examples of it.eng.spagobi.behaviouralmodel.lov.dao.IModalitiesValueDAO


     
     
      // finally (if there are no error, if there is no request for test or to
      // add or delete a Fix Lov item) writes into DB
      if(mod.equalsIgnoreCase(AdmintoolsConstants.DETAIL_INS)) {
        IModalitiesValueDAO dao=DAOFactory.getModalitiesValueDAO();
        dao.setUserProfile(profile);
        dao.insertModalitiesValue(modVal);
      } else {
        // looks for dependencies associated to the previous lov
        Integer lovId = modVal.getId();
        ModalitiesValue initialLov = DAOFactory.getModalitiesValueDAO().loadModalitiesValueByID(lovId);
        IObjParuseDAO objParuseDAO = DAOFactory.getObjParuseDAO();
        IParameterUseDAO paruseDAO = DAOFactory.getParameterUseDAO();
        List paruses = paruseDAO.getParameterUsesAssociatedToLov(lovId);
        Iterator parusesIt = paruses.iterator();
        List documents = new ArrayList();
        List correlations = new ArrayList();
        while (parusesIt.hasNext()) {
          ParameterUse aParuse = (ParameterUse) parusesIt.next();
          documents.addAll(objParuseDAO.getDocumentLabelsListWithAssociatedDependencies(aParuse.getUseID()));
          correlations.addAll(objParuseDAO.getAllDependenciesForParameterUse(aParuse.getUseID()));
        }
        // if the document list is not empty means that the lov is in correlation in some documents
        if (documents.size() > 0) {
          if (!initialLov.getITypeCd().equals(modVal.getITypeCd())) {
            // the lov type was changed
            HashMap errparams = new HashMap();
            errparams.put(AdmintoolsConstants.PAGE, "DetailModalitiesValuePage");
            List params = new ArrayList();
            params.add(documents.toString());
            EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "input_type", "1058", params, errparams);
            errorHandler.addError(error);
            prepareDetailModalitiesValuePage(modVal, mod, response);
            return;
          } else {
            // the lov type was not changed, must verify that the dependency columns are still present
            // load all the columns returned by the lov
            String queryDetXML = modVal.getLovProvider();
            ILovDetail lovProvDet = LovDetailFactory.getLovFromXML(queryDetXML);
            List visColumns = lovProvDet.getVisibleColumnNames();
            List invisColumns = lovProvDet.getInvisibleColumnNames();
            List columns = new ArrayList();
            if( (visColumns!=null) && (visColumns.size()!=0) )
              columns.addAll(visColumns);
            if( (invisColumns!=null) && (invisColumns.size()!=0) )
              columns.addAll(invisColumns);
            // for each correlation column name chechs if the column is still present
            Iterator correlationsIt = correlations.iterator();
            boolean columnNoMorePresent = false;
            List columnsNoMorePresent = new ArrayList();
            while (correlationsIt.hasNext()) {
              ObjParuse aObjParuse = (ObjParuse) correlationsIt.next();
              String filterColumn = aObjParuse.getFilterColumn();
              // because spago put all sourcebean attribute to Uppercase
              //filterColumn = filterColumn.toUpperCase();
              if (!columns.contains(filterColumn)) {
                columnNoMorePresent = true;
                columnsNoMorePresent.add(filterColumn);
              }
            }
            // if there are some column no more present then generate an error and return to the detail page
            if (columnNoMorePresent) {
              HashMap errparams = new HashMap();
              errparams.put(AdmintoolsConstants.PAGE, "DetailModalitiesValuePage");
              List params = new ArrayList();
              params.add(documents.toString());
              params.add(columnsNoMorePresent.toString());
              EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, 1059, params, errparams);
              errorHandler.addError(error);
              prepareDetailModalitiesValuePage(modVal, mod, response);
              return;
            }
          }
        }
        IModalitiesValueDAO dao=DAOFactory.getModalitiesValueDAO();
        dao.setUserProfile(profile);
        dao.modifyModalitiesValue(modVal);
      }
     
    } catch (Exception ex) {     
      logger.error("Cannot fill response container", ex  );
      HashMap params = new HashMap();
View Full Code Here


      if (hasPar){
        EMFUserError error = new EMFUserError (EMFErrorSeverity.ERROR, "1023", new Vector(), null);
        getErrorHandler().addError(error);
        return;
        }
      IModalitiesValueDAO moddao = DAOFactory.getModalitiesValueDAO();
      ModalitiesValue modVal = moddao.loadModalitiesValueByID(new Integer(idStr));
      moddao.eraseModalitiesValue(modVal);
    } catch (Exception ex) {
      logger.error("Cannot fill response container", ex  );
      HashMap params = new HashMap();
      params.put(AdmintoolsConstants.PAGE, ListLovsModule.MODULE_PAGE);
      throw new EMFUserError(EMFErrorSeverity.ERROR, 1020, new Vector(), params);
View Full Code Here

    Iterator iterUses = paruses.iterator();
    while (iterUses.hasNext()) {
      ParameterUse paruse = (ParameterUse) iterUses.next();
      Integer idLov = paruse.getIdLov();
      if (idLov != null) {
        IModalitiesValueDAO lovDAO = DAOFactory.getModalitiesValueDAO();
        ModalitiesValue lov = lovDAO.loadModalitiesValueByID(idLov);
        checkDataSource(lov);
        exporter.insertLov(lov, session);
      }
      exporter.insertParUse(paruse, session);
      List checks = paruse.getAssociatedChecks();
View Full Code Here

TOP

Related Classes of it.eng.spagobi.behaviouralmodel.lov.dao.IModalitiesValueDAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.