1 Reply Latest reply: May 24, 2013 10:21 AM by Kevin Pinsky RSS

    RequestDataValidator Help required

    user6906339
      Hi I am tring to write a RequestDataValidator for Modify User Template .When the user modifies his profile , i need to validate the Division/Department/Team input and make sure its a valid Div/Dept/Team.

      I can get access to some attributes in the validator , but when I try to get the Division/Dept/Team attribute i always get null.

      Any sample code or pointer will be much appreciated.

      Cheers
      Eash
        • 1. Re: RequestDataValidator Help required
          Kevin Pinsky
          You can loop through the data with this:

          LOGGER.log(Level.INFO, "validate:eventType[" + requestData + "]");
          List<RequestEntity> reqEntities = null;
          reqEntities = requestData.getTargetEntities();

          for(RequestEntity re : reqEntities){
          String entityKey = re.getEntityKey();
          LOGGER.log(Level.INFO,"Entity Key["+ entityKey + "]");

          List<RequestEntityAttribute> rEAs = re.getEntityData();
          for(RequestEntityAttribute rea : rEAs){
          String attrName = rea.getName();
          LOGGER.log(Level.INFO,"Attribute Name["+ attrName + "]Attribute Value["+ rea.getValue() + "]");
          //Insert If statement here to check for field and perform validation.
          if (....){
          String msg = "Note[CUSTOM_ERROR_MESSAGE].text:Invalid information.";
          InvalidRequestDataException ex = new InvalidRequestDataException(msg);
          throw ex;
          }
          }
          }

          -Kevin