Package it.eng.spagobi.behaviouralmodel.lov.bo

Examples of it.eng.spagobi.behaviouralmodel.lov.bo.ModalitiesValue


    logger.debug("IN");
    List<String> toReturn = new ArrayList<String>();
    try {
      IParameterDAO pardao = DAOFactory.getParameterDAO();
      Parameter par = pardao.loadForExecutionByParameterIDandRoleName(parId, roleToBeUsed);
      ModalitiesValue modVal = par.getModalityValue();
      // get the lov provider
      String looProvider = modVal.getLovProvider();
      // get from the request the type of lov
      ILovDetail lovDetail = LovDetailFactory.getLovFromXML(looProvider);
      IEngUserProfile profile = GeneralUtilities.createNewUserProfile(userIndentifierToBeUsed);
      String result = lovDetail.getLovResult(profile, null, null);
      SourceBean rowsSourceBean = SourceBean.fromXMLString(result);
View Full Code Here


    // define variable for value column name
    String valColName = "";
    // recover lov object 
    IParameterDAO pardao = DAOFactory.getParameterDAO();
    Parameter par = pardao.loadForExecutionByParameterIDandRoleName(parId, roleName);
    ModalitiesValue modVal = par.getModalityValue();
    // get the lov provider
    String looProvider = modVal.getLovProvider();
    // get from the request the type of lov
    String typeLov = LovDetailFactory.getLovTypeCode(looProvider);
    // get the user profile
    IEngUserProfile profile = null;
    SessionContainer permanentSession = session.getPermanentContainer();
View Full Code Here

     *
     * @see it.eng.spagobi.behaviouralmodel.lov.dao.IModalitiesValueDAO#loadModalitiesValueByID(Integer)
     */
    public ModalitiesValue loadModalitiesValueByID(Integer modalitiesValueID) throws EMFUserError {
  logger.debug("IN");
  ModalitiesValue modVal = null;
  Session aSession = null;
  Transaction tx = null;
  try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

     *
     * @see it.eng.spagobi.behaviouralmodel.lov.dao.IModalitiesValueDAO#loadModalitiesValueByID(Integer)
     */
    public ModalitiesValue loadModalitiesValueByLabel(String label) throws EMFUserError {
  logger.debug("IN");
  ModalitiesValue modVal = null;
  Session aSession = null;
  Transaction tx = null;
  try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

     *                The hybernate LOV
     * @return The corrispondent <code>ModalitiesValue</code> object
     */
    private ModalitiesValue toModalityValue(SbiLov hibLov) {
  logger.debug("IN");
  ModalitiesValue modVal = new ModalitiesValue();
  modVal.setDescription(hibLov.getDescr());
  modVal.setId(hibLov.getLovId());
  modVal.setITypeCd(hibLov.getInputTypeCd());
  modVal.setITypeId(String.valueOf(hibLov.getInputType().getValueId()));
  modVal.setLovProvider(hibLov.getLovProvider());
  modVal.setName(hibLov.getName());
  modVal.setLabel(hibLov.getLabel());
  logger.debug("OUT");
  return modVal;
    }
View Full Code Here

    PaginatorIFace paginator = new GenericPaginator();
    ListIFace list = new GenericList();
    // recover lov object 
    RequestContainer requestContainer = getRequestContainer();
    SessionContainer session = requestContainer.getSessionContainer();
    ModalitiesValue modVal = (ModalitiesValue) session.getAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT);
    // get the lov provider
    String looProvider = modVal.getLovProvider();
    // get from the request the type of lov
    String typeLov = LovDetailFactory.getLovTypeCode(looProvider);
    // get the usser profile
    IEngUserProfile profile = null;
    profile = (IEngUserProfile)session.getAttribute(SpagoBIConstants.USER_PROFILE_FOR_TEST);
View Full Code Here

   * @param response The response Source Bean
   * @throws EMFUserError If an exception occurs
   */
  private void getDetailModValue(String key, SourceBean response) throws EMFUserError {
    try {
      ModalitiesValue modVal = DAOFactory.getModalitiesValueDAO().loadModalitiesValueByID(new Integer(key));
      prepareDetailModalitiesValuePage(modVal, AdmintoolsConstants.DETAIL_MOD, response);
      session.setAttribute(SpagoBIConstants.LOV_MODIFIED, "false");
      session.setAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT, modVal);
    } catch (Exception ex) {
      logger.error("Cannot fill response container", ex);
View Full Code Here

    }
  }
 
  private void testLovAfterAttributesFilling(SourceBean request,   SourceBean response) throws EMFUserError, SourceBeanException  {
    try {
      ModalitiesValue modVal = null;
      modVal = (ModalitiesValue) session.getAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT);
      String lovProv = modVal.getLovProvider();
        ILovDetail lovDet = LovDetailFactory.getLovFromXML(lovProv);
      List profAttrToFill = getProfileAttributesToFill(lovDet);
      if(profAttrToFill.size()!=0) {
        //  create a fake user profile
          UserProfile userProfile=new UserProfile((String)((UserProfile)profile).getUserId());
View Full Code Here

   * @throws EMFUserError If an exception occurs
   * @throws SourceBeanException If a SourceBean exception occurs
   */
  private void modDetailModValue(SourceBean request, String mod, SourceBean response) throws EMFUserError, SourceBeanException {
    try {
      ModalitiesValue modVal = null;
      modVal = (ModalitiesValue) session.getAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT);
      // to rember that the lov has been modified
      // necessary to show a confirm if the user change the lov and then go back without saving
      String lovProviderModified = (String) request.getAttribute("lovProviderModified");
      if(lovProviderModified != null && !lovProviderModified.trim().equals(""))
        session.setAttribute(SpagoBIConstants.LOV_MODIFIED, lovProviderModified);
     
      // check if we are coming from the test
      String returnFromTestMsg = (String) request.getAttribute("RETURN_FROM_TEST_MSG");
      if(returnFromTestMsg!=null) {
        // save after the test
        if ("SAVE".equalsIgnoreCase(returnFromTestMsg)) {   
         
          // validate data
          ValidationCoordinator.validate("PAGE", "LovTestColumnSelector", this);
          // if there are some validation errors return to test page
          Collection errors = errorHandler.getErrors();
          if (errors != null && errors.size() > 0) {
            Iterator iterator = errors.iterator();
            while (iterator.hasNext()) {
              Object error = iterator.next();
              if(error instanceof EMFValidationError) {
                response.setAttribute("testLov", "true");
                return;
              }
            }
          }
          String valueColumn = (String)request.getAttribute("valueColumn");
          String descriptionColumn = (String)request.getAttribute("descriptionColumn");
          List visibleColumns = (List)request.getAttributeAsList("visibleColumn");
          List columns = (List)request.getAttributeAsList("column");
         
          String lovProvider = modVal.getLovProvider();
          ILovDetail lovDetail = LovDetailFactory.getLovFromXML(lovProvider);
          lovDetail.setDescriptionColumnName(descriptionColumn);
          List invisCols = getInvisibleColumns(columns, visibleColumns);
          lovDetail.setInvisibleColumnNames(invisCols);
          lovDetail.setValueColumnName(valueColumn);
          lovDetail.setVisibleColumnNames(visibleColumns);
          String newLovProvider = lovDetail.toXML();
          modVal.setLovProvider(newLovProvider);
         
          session.delAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT);
          session.delAttribute(SpagoBIConstants.MODALITY);
        }
       
       
        // don't save after the test
        else if ("DO_NOT_SAVE".equalsIgnoreCase(returnFromTestMsg)) {
          modVal = (ModalitiesValue) session.getAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT);
          //session.delAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT);
          //session.delAttribute(SpagoBIConstants.MODALITY);
          prepareDetailModalitiesValuePage(modVal, mod, response);
          // exits without writing into DB and without loop
          return;
        }
      }
      // if we are not coming from the test result page, the Lov objects fields are in request
      else {
        String idStr = (String) request.getAttribute("id");
        Integer id = new Integer(idStr);
        String description = (String) request.getAttribute("description");
        String name = (String) request.getAttribute("name");
        String label = (String) request.getAttribute("label");
        String input_type = (String) request.getAttribute("input_type");
        String input_type_cd = input_type.substring(0, input_type.indexOf(","));
        String input_type_id = input_type.substring(input_type.indexOf(",") + 1);
        if(mod.equalsIgnoreCase(AdmintoolsConstants.DETAIL_INS)) {
          modVal.setId(id);
        }
        // check if lov type has been changed and in that case reset the lovprovider
        String oldTypeId = modVal.getITypeId();
        if((oldTypeId!=null) && (!oldTypeId.trim().equals(""))) {
          if(!oldTypeId.equals(input_type_id)) {
            modVal.setLovProvider("");
          }
        }
        // set the properties of the lov object
        modVal.setDescription(description);
        modVal.setName(name);
        modVal.setLabel(label);
        modVal.setITypeCd(input_type_cd);
        modVal.setITypeId(input_type_id);
                // check label and validation
        labelControl(request, mod);
        ValidationCoordinator.validate("PAGE", "ModalitiesValueValidation", this);
        // based on the type of lov set special properties
        Object objectToTest = null;
       
       
        if(input_type_cd.equalsIgnoreCase("QUERY")) {
          String lovProv = modVal.getLovProvider();
          QueryDetail query = null;
          if( (lovProv==null) || (lovProv.trim().equals("")) ) {
            query = new QueryDetail();
          } else {
            query = (QueryDetail)LovDetailFactory.getLovFromXML(lovProv);
          }
          recoverQueryWizardValues(request, query);
          String lovProvider = query.toXML();
          modVal.setLovProvider(lovProvider);
          ValidationCoordinator.validate("PAGE", "QueryWizardValidation", this);
          objectToTest = query;
        }
       
        else if (input_type_cd.equalsIgnoreCase("JAVA_CLASS")) {
          String lovProv = modVal.getLovProvider();
          JavaClassDetail javaClassDet =  null;
          if( (lovProv==null) || (lovProv.trim().equals("")) ) {
            javaClassDet = new JavaClassDetail();
          } else {
            javaClassDet = (JavaClassDetail)LovDetailFactory.getLovFromXML(lovProv);
          }
              recoverJavaClassWizardValues(request, javaClassDet);
          String lovProvider = javaClassDet.toXML();
          modVal.setLovProvider(lovProvider);
          ValidationCoordinator.validate("PAGE", "JavaClassWizardValidation", this);
          objectToTest = javaClassDet;
        }
       
        else if (input_type_cd.equalsIgnoreCase("SCRIPT")) {         
          String lovProv = modVal.getLovProvider();
          ScriptDetail scriptDet =  null;
          if( (lovProv==null) || (lovProv.trim().equals("")) ) {
            scriptDet = new ScriptDetail();
          } else {
            scriptDet = (ScriptDetail)LovDetailFactory.getLovFromXML(lovProv);
          }
          recoverScriptWizardValues(request, scriptDet);
          String lovProvider = scriptDet.toXML();
          modVal.setLovProvider(lovProvider);
          ValidationCoordinator.validate("PAGE", "ScriptWizardValidation", this);
          objectToTest = scriptDet;
        }
       
        else  if (input_type_cd.equalsIgnoreCase("FIX_LOV")) {
          String lovProv = modVal.getLovProvider();
          FixedListDetail fixlistDet = null;
          if( (lovProv==null) || (lovProv.trim().equals("")) ) {
            fixlistDet = new FixedListDetail();
          } else {
            fixlistDet = (FixedListDetail)LovDetailFactory.getLovFromXML(lovProv);
          }
          boolean itemTaskDone = doFixListItemTask(modVal, fixlistDet, request);
          if(itemTaskDone) {
            prepareDetailModalitiesValuePage(modVal, mod, response);
            session.setAttribute(SpagoBIConstants.LOV_MODIFIED, "true");
            session.setAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT, modVal);
            // exits without writing into DB and without loop
            return;
          } else {
            List items = fixlistDet.getItems();
            if(items.size()==0) {
              modVal.setLovProvider("<LOV/>");
            }
            objectToTest = fixlistDet;
         
        }
        // if there are some validation errors into the errorHandler does not write into DB
        Collection errors = errorHandler.getErrors();
        if (errors != null && errors.size() > 0) {
          Iterator iterator = errors.iterator();
          while (iterator.hasNext()) {
            Object error = iterator.next();
            if (error instanceof EMFValidationError) {
              prepareDetailModalitiesValuePage(modVal, mod, response);
              return;
            }
          }
        }
        // check if user wants to test
        Object test = request.getAttribute("testLovBeforeSave");
        if (test != null) {
          session.setAttribute(SpagoBIConstants.MODALITY, mod);
          session.setAttribute(SpagoBIConstants.MODALITY_VALUE_OBJECT, modVal);
          boolean needProfAttrFill = checkProfileAttributes(response, (ILovDetail)objectToTest);
          if(!needProfAttrFill) {
            response.setAttribute("testLov", "true");
          }
          // exits without writing into DB
          return;
        }
      }
   
     
     
      // 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());
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.behaviouralmodel.lov.bo.ModalitiesValue

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.