Package it.eng.spago.validation

Examples of it.eng.spago.validation.EMFValidationError


        String label = aParameter.getLabel();
        if (label.equals(labelToCheck)) {
          HashMap params = new HashMap();
          params.put(AdmintoolsConstants.PAGE,
              ListParametersModule.MODULE_PAGE);
          EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "label", "1031",
              new Vector(), params);
          errorHandler.addError(error);
        }
      }
    } else {
      Integer currentId = parameter.getId();
      Iterator i = allparameters.iterator();
      while (i.hasNext()) {
        Parameter aParameter = (Parameter) i.next();
        String label = aParameter.getLabel();
        Integer id = aParameter.getId();
        if (label.equals(labelToCheck)
            && (!id.equals(currentId))) {
          HashMap params = new HashMap();
          params.put(AdmintoolsConstants.PAGE,
              ListParametersModule.MODULE_PAGE);
          EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "label", "1031",
              new Vector(), params);
          errorHandler.addError(error);
        }
      }
    }
View Full Code Here


        String label = aParameterUse.getLabel();
        if (label.equals(labelToCheck)) {
          HashMap params = new HashMap();
          params.put(AdmintoolsConstants.PAGE, ListParametersModule.MODULE_PAGE);
          params.put(AdmintoolsConstants.ID_DOMAIN, parId);
          EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "paruseLabel", "1025", new Vector(), params);
          errorHandler.addError(error);
        }
      }
    } else {
      Integer currentUseId = paruse.getUseID();
      Iterator i = allParametersUse.iterator();
      while (i.hasNext()) {
        ParameterUse aParameterUse = (ParameterUse) i.next();
        String label = aParameterUse.getLabel();
        Integer useId = aParameterUse.getUseID();
     
        if (label.equals(labelToCheck) && (!useId.equals(currentUseId))) {
          HashMap params = new HashMap();
          params.put(AdmintoolsConstants.PAGE, ListParametersModule.MODULE_PAGE);
          params.put(AdmintoolsConstants.ID_DOMAIN, parId);
          EMFValidationError error = new EMFValidationError (EMFErrorSeverity.ERROR, "paruseLabel", "1025", new Vector(), params);
          errorHandler.addError(error);
        }
      }
    }
  }
View Full Code Here

      HashMap params = new HashMap();
      params.put(AdmintoolsConstants.PAGE,
          DetailParameterModule.MODULE_PAGE);
      Vector v = new Vector();
      v.add(objectsLabels.toString());
      EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "", "1057", v, params);
      errorHandler.addError(error);
    }
   
  }
View Full Code Here

    while (i.hasNext()) {
      Check aCheck = (Check) i.next();
      if (aCheck.getLabel().equals(label) && !aCheck.getCheckId().equals(checkId)) {
        HashMap params = new HashMap();
        params.put(AdmintoolsConstants.PAGE, ListChecksModule.MODULE_PAGE);
        EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "label", "1029", new Vector(), params);
        getErrorHandler().addError(error);
      }
    }
  }
View Full Code Here

            currentValidator = (SourceBean)itValidators.next();
            validatorName = (String) currentValidator.getAttribute("validatorName");
            String arg0 = (String) currentValidator.getAttribute("arg0");
            String arg1 = (String) currentValidator.getAttribute("arg1");
            String arg2 = (String) currentValidator.getAttribute("arg2");
            EMFValidationError error = validateField(fieldName, fieldLabel, value, validatorName, arg0, arg1, arg2);
            errorHandler.addError(error);
          }//while (itValidators.hasNext())
        } // while
       
      } catch (Exception ex) {
View Full Code Here

    if (validatorName.equalsIgnoreCase("MANDATORY")){
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the MANDATORY VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      if (GenericValidator.isBlankOrNull(value)){
        params = new ArrayList();
        params.add(fieldLabel);
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_MANDATORY, params)
       
      }

    } else if (validatorName.equalsIgnoreCase("URL")){
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the URL VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      UrlValidator urlValidator = new SpagoURLValidator();
      if (!GenericValidator.isBlankOrNull(value) && !urlValidator.isValid(value)){
        params = new ArrayList();
        params.add(fieldLabel);
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_URL,params);
       
      }
    } else if (validatorName.equalsIgnoreCase("LETTERSTRING")){
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the LETTERSTRING VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.matchRegexp(value, LETTER_STRING_REGEXP)){
        params = new ArrayList();
        params.add(fieldLabel);
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_LETTERSTRING,params);
       
      }
    } else if (validatorName.equalsIgnoreCase("ALFANUMERIC")){
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the ALFANUMERIC VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.matchRegexp(value, ALPHANUMERIC_STRING_REGEXP)){
     
        params = new ArrayList();
        params.add(fieldLabel);
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_ALFANUMERIC,params);
       
      }
    } else if (validatorName.equalsIgnoreCase("NUMERIC")){
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the NUMERIC VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      if (!GenericValidator.isBlankOrNull(value) &&
              (!(GenericValidator.isInt(value)
        || GenericValidator.isFloat(value)
        || GenericValidator.isDouble(value)
        || GenericValidator.isShort(value)
        || GenericValidator.isLong(value)))){
       
        // The string is not a integer, not a float, not double, not short, not long
        // so is not a number
       
        params = new ArrayList();
        params.add(fieldLabel);
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_NUMERIC,params);
       
      }
     
    } else if (validatorName.equalsIgnoreCase("EMAIL")){
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the EMAIL VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isEmail(value)){
       
        // Generate errors
        params = new ArrayList();
        params.add(fieldLabel);
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_EMAIL,params);
       
      }
    } else if (validatorName.equalsIgnoreCase("BOOLEAN")){
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the MANDATORY VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      if (!GenericValidator.isBlankOrNull(value) && !value.equalsIgnoreCase("true") && !value.equalsIgnoreCase("false")){
        params = new ArrayList();
        params.add(fieldLabel);
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_BOOLEAN, params)
       
      }

    }
    else if (validatorName.equalsIgnoreCase("FISCALCODE")){
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the FISCALCODE VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.matchRegexp(value, FISCAL_CODE_REGEXP)){
       
//         Generate errors
        params = new ArrayList();
        params.add(fieldLabel);
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_FISCALCODE,params);
       
      }
    } else if (validatorName.equalsIgnoreCase("DECIMALS")){
      if (!GenericValidator.isBlankOrNull(value)) {
        SpagoBITracer.info("SpagoBI", "Validator",
            "automaticValidator",
            "Apply the DECIMALS VALIDATOR to field ["
                + fieldName + "] with value [" + value
                + "]");
        int maxNumberOfDecimalDigit = Integer.valueOf(arg0).intValue();
        SpagoBITracer.info("SpagoBI", "Validator",
            "automaticValidator",
            "Max Numbers of decimals is ["
                + maxNumberOfDecimalDigit + "]");
        String decimalSeparator = arg1;

        if (GenericValidator
            .isBlankOrNull(decimalSeparator)) {
          decimalSeparator = ".";
        }

        int pos = value.indexOf(decimalSeparator);
        String decimalCharacters = "";
        if (pos != -1)
          decimalCharacters = value.substring(pos + 1);

        if (decimalCharacters.length() > maxNumberOfDecimalDigit) {
          // Generate errors
          params = new ArrayList();
          params.add(fieldLabel);
          params.add(String
              .valueOf(maxNumberOfDecimalDigit));
          return new EMFValidationError(
              EMFErrorSeverity.ERROR, fieldName, ERROR_DECIMALS, params);
        }
      }
    } else if (validatorName.equalsIgnoreCase("NUMERICRANGE")){
      if (!GenericValidator.isBlankOrNull(value)) {
        SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the NUMERICRANGE VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
        String firstValueStr = arg0;
        String secondValueStr = arg1;
        SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Range is ["+firstValueStr+"< x <"+secondValueStr+"]");
        boolean syntaxCorrect = true;
        if (!GenericValidator.isDouble(value)){
          SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", " CANNOT APPLY THE NUMERICRANGE VALIDATOR  value ["+value+"] is not a Number");
          syntaxCorrect = false;
        }
        if (!GenericValidator.isDouble(firstValueStr)){
          SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", " CANNOT APPLY THE NUMERICRANGE VALIDATOR  first value of range ["+firstValueStr+"] is not a Number");
          syntaxCorrect = false;
        }
        if (!GenericValidator.isDouble(secondValueStr)){
          SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", " CANNOT APPLY THE NUMERICRANGE VALIDATOR  second value of range ["+secondValueStr+"] is not a Number");
          syntaxCorrect = false;
        }
        if (syntaxCorrect){
          double firstValue = Double.valueOf(firstValueStr).doubleValue();
          double secondValue = Double.valueOf(secondValueStr).doubleValue();
          double valueToCheckDouble = Double.valueOf(value).doubleValue();
          if (!(GenericValidator.isInRange(valueToCheckDouble, firstValue, secondValue))){
       
            params = new ArrayList();
            params.add(fieldLabel);
            params.add(firstValueStr);
            params.add(secondValueStr);
            return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_RANGE,params);
       
          }
        }else{
          return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_GENERIC);
        }
      }
    } else if (validatorName.equalsIgnoreCase("DATERANGE")){
     
      if (!GenericValidator.isBlankOrNull(value)) {
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the DATERANGE VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      String firstValueStr = arg0;
      String secondValueStr = arg1;
      String dateFormat = arg2;
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Range is ["+firstValueStr+"< x <"+secondValueStr+"]");
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Date Format is  ["+dateFormat+"]");
//      //boolean syntaxCorrect = false;
      boolean syntaxCorrect = true;
     
      //if (!GenericValidator.isDate(value,dateFormat,true)){
      if (!GenericValidator.isDate(value,dateFormat,true)){
        SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", " CANNOT APPLY THE DATERANGE VALIDATOR  value ["+value+"] is not a is not valid Date according to ["+dateFormat+"]");
        syntaxCorrect = false;
      }
      //if (!GenericValidator.isDate(firstValueStr,dateFormat,true)){
      if (!GenericValidator.isDate(firstValueStr,dateFormat,true)){
        SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", " CANNOT APPLY THE DATERANGE VALIDATOR  first value of range ["+firstValueStr+"] is not valid Date according to ["+dateFormat+"]");
        syntaxCorrect = false;
      }
      //if (!GenericValidator.isDate(secondValueStr,dateFormat, true)){
      if (!GenericValidator.isDate(secondValueStr,dateFormat,true)){
        SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", " CANNOT APPLY THE DATERANGE VALIDATOR  second value of range ["+secondValueStr+"] is not a valid Date according to ["+dateFormat+"]");
        syntaxCorrect = false;
      }
     
     
      if (syntaxCorrect){
        DateFormat df = new SimpleDateFormat(dateFormat);
     
        Date firstValueDate = df.parse(firstValueStr);
        Date secondValueDate = df.parse(secondValueStr);
        Date theValueDate = df.parse(value);
     
        if ((theValueDate.getTime() < firstValueDate.getTime()) || (theValueDate.getTime() > secondValueDate.getTime())){
          params = new ArrayList();
          params.add(fieldLabel);
          params.add(firstValueStr);
          params.add(secondValueStr);
          return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_RANGE,params);
        }
      }else {
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_GENERIC);
      }
      }
    } else if (validatorName.equalsIgnoreCase("STRINGRANGE")){
      if (!GenericValidator.isBlankOrNull(value)) {
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the STRINGRANGE VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
     
      String firstValueStr = arg0;
      String secondValueStr = arg1;
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Range is ["+firstValueStr+"< x <"+secondValueStr+"]");
      //if (firstValueStr.compareTo(secondValueStr) > 0){
      if ((value.compareTo(firstValueStr) < 0) || (value.compareTo(secondValueStr) > 0)){
        params = new ArrayList();
        params.add(fieldLabel);
        params.add(firstValueStr);
        params.add(secondValueStr);
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_RANGE,params);
      }
      }
    } else if (validatorName.equalsIgnoreCase("MAXLENGTH")){
      if (!GenericValidator.isBlankOrNull(value)) {
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the MAXLENGTH VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      int maxLength = Integer.valueOf(arg0).intValue();
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "maxLength is ["+maxLength+"]");
      if (!GenericValidator.maxLength(value, maxLength)){
       
        params = new ArrayList();
        params.add(fieldLabel);
        params.add(String.valueOf(maxLength));
       
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_MAXLENGTH,params);
     
      }
      }
    } else if (validatorName.equalsIgnoreCase("MINLENGTH")){
      if (!GenericValidator.isBlankOrNull(value)) {
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the MINLENGTH VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      int minLength = Integer.valueOf(arg0).intValue();
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "minLength is ["+minLength+"]");
      if (!GenericValidator.minLength(value, minLength)){
       
        // Generate Errors
        params = new ArrayList();
        params.add(fieldLabel);
        params.add(String.valueOf(minLength));
       
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_MINLENGTH,params);
     
      }
      }
    } else if (validatorName.equalsIgnoreCase("REGEXP")){
      if (!GenericValidator.isBlankOrNull(value)) {
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the REGEXP VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      String regexp  = arg0;
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "regexp is ["+regexp+"]");
      if (!(GenericValidator.matchRegexp(value, regexp))){
       
        // Generate Errors
        params = new ArrayList();
        params.add(fieldLabel);
        params.add(regexp);
       
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_REGEXP,params);
     
      }
      }
    }  else if (validatorName.equalsIgnoreCase("XSS")){
      if (!GenericValidator.isBlankOrNull(value)) {
        SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the XSS VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
        String toVerify = value.toUpperCase();
        if( toVerify.contains("<A") ||  toVerify.contains("<LINK") ||  toVerify.contains("<IMG") ||  toVerify.contains("<SCRIPT") ||
            toVerify.contains("&LT;A") ||  toVerify.contains("&LT;LINK") ||  toVerify.contains("&LT;IMG") ||  toVerify.contains("&LT;SCRIPT")  ){

          // Generate Errors
          params = new ArrayList();
          params.add(fieldLabel);
         
          return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_XSS,params);
       
        }
        }
    }else if (validatorName.equalsIgnoreCase("DATE")){
     
      if (!GenericValidator.isBlankOrNull(value)) {
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "Apply the DATE VALIDATOR to field ["+fieldName+"] with value ["+value+"]");
      String dateFormat = arg0;
      SpagoBITracer.info("SpagoBI", "Validator", "automaticValidator", "dateFormat is ["+dateFormat+"]");
      //if (!GenericValidator.isDate(value, dateFormat, true)){
      if (!GenericValidator.isDate(value, dateFormat, true)){
 
        //Generate Errors
        params = new ArrayList();
        params.add(fieldLabel);
        params.add(dateFormat);
       
        return new EMFValidationError(EMFErrorSeverity.ERROR, fieldName, ERROR_DATE,params);
      }
      }
     
    }
   
View Full Code Here

   
    // TRY TO LOAD ALL THE FUNCTIONALITIES ASSOCIATED (into request) TO THE BIOBEJCT
    List functionalities = new ArrayList();
    List functionalitiesStr = request.getAttributeAsList(ObjectsTreeConstants.FUNCT_ID);
    if (functionalitiesStr.size() == 0) {
      EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, ObjectsTreeConstants.FUNCT_ID, "1008");
      this.respCont.getErrorHandler().addError(error);
    } else {
      for (Iterator it = functionalitiesStr.iterator(); it.hasNext(); ) {
        String functIdStr = (String) it.next();
        Integer functId = new Integer (functIdStr);
        functionalities.add(functId);
      }
    }
    // lOAD ALL THE FUNCTIONALITIES ASSOCIATED TO THE BIOBJECT (but not into request)
    // First case: the current user is not an administrator (so he cannot see all the functionalities)
    // and the modality is Modify. In this case some functionalities, that the user cannot see, can be
    // already associated to the object (by different users). This associations mustn't be erased.
    if (!profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN) && mod.equalsIgnoreCase(ObjectsTreeConstants.DETAIL_MOD)) {
      IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
      BIObject prevObj = objDAO.loadBIObjectById(id);
      List prevFuncsId = prevObj.getFunctionalities();
      for (Iterator it = prevFuncsId.iterator(); it.hasNext(); ) {
        Integer funcId = (Integer) it.next();
        if (!ObjectsAccessVerifier.canDev(stateCode, funcId, profile)) {
          functionalities.add(funcId);
        }
      }
    }
    // Second case: the current user is a local administrator (he can admin only a part of the tree)
    // and the modality is Modify. In this case some funtionalities in oder part of the tree, which the
    // user cannot see, can be already associated to the object. This associations mustn't be erased.
    if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)
        && initialPath != null && !initialPath.trim().equals(""
        && mod.equalsIgnoreCase(ObjectsTreeConstants.DETAIL_MOD)) {
      IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
      BIObject prevObj = objDAO.loadBIObjectById(id);
      List functionalitiesId = prevObj.getFunctionalities();
      Iterator it = functionalitiesId.iterator();
      while (it.hasNext()) {
        Integer folderId = (Integer) it.next();
        LowFunctionality folder = DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByID(folderId, false);
        String folderPath = folder.getPath();
        if (!folderPath.equalsIgnoreCase(initialPath) && !folderPath.startsWith(initialPath + "/")) {
          functionalities.add(folderId);
        }
      }
    }
    // CHECK IF THE LABEL IS ALREADY ASSIGNED TO AN EXISTING OBJECT
    BIObject aBIObject = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(label);
    if (aBIObject != null && !aBIObject.getId().equals(id)) {
      EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "label", "1056");
      this.respCont.getErrorHandler().addError(error);
    }

    // SET DATA INTO OBJECT
    obj.setFunctionalities(functionalities);
View Full Code Here

    FileItem uploaded = (FileItem) request.getAttribute("UPLOADED_FILE");
    if (uploaded != null) {
      String fileName = GeneralUtilities.getRelativeFileNames(uploaded.getName());
      if (fileName != null && !fileName.trim().equals("")) {
        if (uploaded.getSize() == 0) {
          EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "uploadFile", "201");
          this.respCont.getErrorHandler().addError(error);
          return null;
        }
        int maxSize = GeneralUtilities.getTemplateMaxSize();
        if (uploaded.getSize() > maxSize) {
          EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "uploadFile", "202");
          this.respCont.getErrorHandler().addError(error);
          return null;
        }
        templ = new ObjTemplate();
        templ.setActive(new Boolean(true));
View Full Code Here

      String pathParent = (String) request
          .getAttribute(AdmintoolsConstants.PATH_PARENT);
      LowFunctionality parentFunct = DAOFactory.getLowFunctionalityDAO()
          .loadLowFunctionalityByPath(pathParent, false);
      if (parentFunct == null) {
        EMFValidationError error = new EMFValidationError(
            EMFErrorSeverity.ERROR,
            AdmintoolsConstants.PATH_PARENT, "1002", new Vector());
        getErrorHandler().addError(error);
      }
      String newPath = pathParent + "/" + code;
      // SourceBean dataLoad = new SourceBean("dataLoad");
      LowFunctionality funct = DAOFactory.getLowFunctionalityDAO()
          .loadLowFunctionalityByPath(newPath, false);
      if (funct != null) {
        HashMap params = new HashMap();
        params.put(AdmintoolsConstants.PAGE,
            BIObjectsModule.MODULE_PAGE);
        // params.put(SpagoBIConstants.ACTOR,
        // SpagoBIConstants.ADMIN_ACTOR);
        params.put(SpagoBIConstants.OPERATION,
            SpagoBIConstants.FUNCTIONALITIES_OPERATION);
        EMFValidationError error = new EMFValidationError(
            EMFErrorSeverity.ERROR, "code", "1005", new Vector(),
            params);
        getErrorHandler().addError(error);
      }
      if (DAOFactory.getLowFunctionalityDAO().existByCode(code) != null) {
        EMFValidationError error = new EMFValidationError(
            EMFErrorSeverity.ERROR, "code", "1027");
        getErrorHandler().addError(error);
      }
      lowFunct = new LowFunctionality();
      lowFunct.setCode(code);
      lowFunct.setDescription(description);
      lowFunct.setName(name);
      lowFunct.setPath(newPath);
      lowFunct.setDevRoles(devRoles);
      lowFunct.setExecRoles(execRoles);
      lowFunct.setTestRoles(testRoles);
      lowFunct.setCreateRoles(createRoles);

      if (parentFunct != null)
        lowFunct.setParentId(parentFunct.getId());
    } else if (mod.equalsIgnoreCase(AdmintoolsConstants.DETAIL_MOD)) {
      String idFunct = (String) request
          .getAttribute(AdmintoolsConstants.FUNCTIONALITY_ID);
      Integer idFunctWithSameCode = DAOFactory.getLowFunctionalityDAO()
          .existByCode(code);
      if ((idFunctWithSameCode != null)
          && !(idFunctWithSameCode.equals(new Integer(idFunct)))) {
        EMFValidationError error = new EMFValidationError(
            EMFErrorSeverity.ERROR, 1027);
        getErrorHandler().addError(error);
      }
      lowFunct = DAOFactory.getLowFunctionalityDAO()
          .loadLowFunctionalityByID(new Integer(idFunct), false);
View Full Code Here

          if(emfUser.getAdditionalInfo()!=null) message+=" "+emfUser.getAdditionalInfo();
          logger.error(message);
          throw new MissingParameterValue();
        }
        else if(error instanceof EMFValidationError){
          EMFValidationError emfValidation=(EMFValidationError)error;
          String message="Error while checking parameters: ";
          if(emfValidation.getMessage()!=null) message+=" "+emfValidation.getMessage();
          if(emfValidation.getAdditionalInfo()!=null) message+=" "+emfValidation.getAdditionalInfo();
          logger.error(message);
          throw new InvalidParameterValue();

        }
View Full Code Here

TOP

Related Classes of it.eng.spago.validation.EMFValidationError

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.