Package com.openii.moa.jmsobjects.services.v1_0

Examples of com.openii.moa.jmsobjects.services.v1_0.AddressValidation


  void av_validateAddress_mouseClicked(MouseEvent e)
  {
    String messageObjectName = VALID_ADDRESS;
    org.openeai.OpenEaiObject.logger.info("Message Object Name is: " + messageObjectName);
    try {
      AddressValidation vaddress = (AddressValidation)APP_CONFIG.getObject(messageObjectName);
      AddressValidationQuerySpecification vaddressQuery = (AddressValidationQuerySpecification)APP_CONFIG.getObject("ValidAddressQuerySpecification.v1_0");;
      org.openeai.OpenEaiObject.logger.info("got ValidAddress...");
     
      com.openii.moa.objects.resources.v1_0.Address address = vaddress.newAddress();
      if (!"".equals(bp_street1.getText()) && !"".equals(bp_city.getText()) && bp_stateList.getSelectedItem()!=null) {
        address.setStreet1(bp_street1.getText());
        address.setCityOrLocality(bp_city.getText());
        address.setStateOrProvince(bp_stateList.getSelectedItem().toString());
        address.setNation("US");
        address.setZipOrPostalCode(bp_zip.getText());
        com.openii.moa.objects.resources.v1_0.Date ed = address.newEffectiveDate();
        ed.setMonth("12");
        ed.setDay("5");
        ed.setYear("2006");
        address.setEffectiveDate(ed);
      } else {
        bp_resultsTextArea.setText("Address not vaild. Need Street1, City and State.");
        return;
      }
      //vaddress.setAddress(address);
      vaddressQuery.setAddress(address);
     
      //ActionableEnterpriseObject jeo = (ActionableEnterpriseObject)APP_CONFIG.getObject(messageObjectName);
      ActionableEnterpriseObject jeo = vaddress;
      org.openeai.OpenEaiObject.logger.info("got " + messageObjectName + " from AppConfig, performing Query...");
     
      java.util.List a = jeo.query(vaddressQuery, (PointToPointProducer)APP_CONFIG.getObject(ADDRESS_VALIDATION_PRODUCER));
      org.openeai.OpenEaiObject.logger.info("Executed Query...");
     
      StringBuffer results = new StringBuffer();
      if (a.size() == 0) {
        bp_resultsTextArea.setText("No rows found matching the query.");
      }
      else {
        for (int i=0; i<a.size(); i++) {
          AddressValidation av = (AddressValidation)a.get(i);
          List b = av.getMatchStatus();
          if (b.size() == 0) {
            bp_resultsTextArea.setText("Can't find MatchStatus in the query.");
          }
          else {
            if (a.size()==1) {
              List c=av.getAddress();
              if (c.size()==1) {
                com.openii.moa.objects.resources.v1_0.Address betterAddress = (com.openii.moa.objects.resources.v1_0.Address) c.get(0);
                bp_street1.setText(betterAddress.getStreet1());
                bp_zip.setText(betterAddress.getZipOrPostalCode());
                bp_city.setText(betterAddress.getCityOrLocality());
View Full Code Here


      }
      // Initialize the ValidPasswordQuerySpecification object and a list of statuses, and a ValidPassword for the response
      //ValidPasswordQuerySpecification querySpec = new ValidPasswordQuerySpecification();
      PasswordValidationQuerySpecification querySpec;
      Vector validationStatuses = new Vector();
      PasswordValidation validPassword = new PasswordValidation();

      try {
        querySpec = (PasswordValidationQuerySpecification)getAppConfig().getObject("ValidPasswordQuerySpecification.v1_0");
        querySpec.buildObjectFromInput(eQuerySpec);
        String candidate = querySpec.getCandidatePassword();
        logger.info("[PasswordValidationRequestCommand] Password to validate is: "+candidate);
        validPassword.setCandidatePassword(candidate);
        validPassword.setIdentifier(querySpec.getIdentifier());
        // Here's where the validation occurs
        for (int i=0;i<validationRules.size();i++) {
          logger.info("[PasswordValidationRequestCommand] Running rule "+i+"...");
          PasswordValidationRule rule=(PasswordValidationRule)validationRules.get(i);
          ValidationStatus status=rule.validate(querySpec);
          if (status!=null) {
            logger.info("[PasswordValidationRequestCommand] Candidate password "+candidate
                +" violates rule "+i+", "+rule.getClass().getName());
            validationStatuses.add(status);
          }
        }
        // check for rule violation. If none, return validation status 0
        if (validationStatuses.size()==0) {
          validationStatuses.add(noViolation);
        }
        // add ValidationStatuses to ValidPassword
        validPassword.setValidationStatus(validationStatuses);
       
      } catch (EnterpriseLayoutException ele) {
        logger.fatal("[PasswordValidationRequestCommand] Error building PasswordValidationQuerySpecification " +
            "object from Query object: The exception is: " + ele.getMessage());
        String errType = "application";
        String errCode = "OpenEAI-1015";
        String errDesc = "EnterpriseLayoutException thrown during PasswordValidationQuerySpecification build.";
        logger.fatal("[PasswordValidationRequestCommand] " + errDesc);
        logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
        ArrayList errors = new ArrayList();
        errors.add(buildError(errType, errCode, errDesc));
        String replyContents =
          buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
        return getMessage(msg, replyContents);       
      } catch (EnterpriseFieldException efe) {
        logger.fatal("[PasswordValidationRequestCommand] Password validation processing error. The exception is: "
            + efe.getMessage());
        String errType = "application";
        String errCode = "OpenEAI-1016";
        String errDesc = "EnterpriseFieldException thrown during address build.";
        logger.fatal("[PasswordValidationRequestCommand] " + errDesc);
        logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
        ArrayList errors = new ArrayList();
        errors.add(buildError(errType, errCode, errDesc));
        String replyContents =
          buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
        return getMessage(msg, replyContents);       
      } catch (PasswordValidationException e) {
        logger.fatal("[PasswordValidationRequestCommand] Password validation processing error. The exception is: "
            + e.getMessage());
        String errType = "application";
        String errCode = "OpenEAI-1017";
        String errDesc = "PasswordValidationException thrown during address build.";
        logger.fatal("[PasswordValidationRequestCommand] " + errDesc);
        logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
        ArrayList errors = new ArrayList();
        errors.add(buildError(errType, errCode, errDesc));
        String replyContents =
          buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
        return getMessage(msg, replyContents);       
      } catch (EnterpriseConfigurationObjectException e) {
        logger.fatal("[PasswordValidationRequestCommand] Password validation processing error. The exception is: "
            + e.getMessage());
        String errType = "application";
        String errCode = "OpenEAI-1018";
        String errDesc = "PasswordValidationException thrown during password query spec build.";
        logger.fatal("[PasswordValidationRequestCommand] " + errDesc);
        logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
        ArrayList errors = new ArrayList();
        errors.add(buildError(errType, errCode, errDesc));
        String replyContents =
          buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
        return getMessage(msg, replyContents);       
      }
     
      // Serialize the ValidPassord and place it into the reply.
      String replyContents = null;
      try {
        localResponseDoc.getRootElement().getChild("DataArea").removeContent();
        localResponseDoc.getRootElement().getChild("DataArea")
          .addContent((Element)validPassword.buildOutputFromObject());
        replyContents = buildReplyDocument(eControlArea, localResponseDoc);
      }
      catch (EnterpriseLayoutException ele) {
        // There was an error building the ValidPassword element from the quuery request
        // object.
View Full Code Here

TOP

Related Classes of com.openii.moa.jmsobjects.services.v1_0.AddressValidation

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.