Package org.any_openeai_enterprise.moa.objects.resources.v1_0

Examples of org.any_openeai_enterprise.moa.objects.resources.v1_0.LightweightPerson


        return getMessage(msg, replyContents);
      }
    
      else {
        // Get a primed UnknownPerson object from AppConfig.
        UnknownPerson uPerson = new UnknownPerson();
        try {
          uPerson = (UnknownPerson)getAppConfig().
            getObject("UnknownPerson");
        }
        catch (EnterpriseConfigurationObjectException eoce) {
        logger.fatal("[InstitutionalIdentityRequestCommand] Error retrieving " +
          "an UnknownPerson object from AppConfig. The exception is: " +
          eoce.getMessage());
        }
     
        // Try to build the UnknownPerson object from the query element.
        try {
          uPerson.buildObjectFromInput(queryElement);
        }
        catch (EnterpriseLayoutException ele) {
          // There was an error building the UnknownPerson object from the
          // query element.
          String errType = "application";
          String errCode = "InstitutionalIdentityService-1001";
          String errDesc = "Error building the UnknownPerson object from the" +
            "UnknownPerson element in the Query-Request message. The " +
            "exception is: " + ele.getMessage();
          logger.fatal("[InstitutionalIdentityRequestCommand] " + errDesc);
          logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
          ArrayList errors = new ArrayList();
          errors.add(buildError(errType, errCode, errDesc));
          String replyContents =
            buildReplyDocumentWithErrors(eControlArea, localProvideDoc, errors);
          return getMessage(msg, replyContents);       
        }
     
        // Retrieve the InstitutionalIdentity.
        InstitutionalIdentity instIdent = new InstitutionalIdentity();
        try {
          instIdent = m_i2sRepository.retrieveInstitutionalIdentity(uPerson)
        }
        catch (I2sRepositoryException i2sre) {
          String errType = "system";
          String errCode = "InstitutionalIdentityService-1002";
          String errDesc = "Error accessing the I2sRepository to retrieve the "
            + "InstitutionalIdentity. The exception is: " + i2sre.getMessage();
          logger.fatal("[InstitutionalIdentityRequestCommand] " + errDesc);
          logger.fatal("[InstitutionalIdentityRequestCommand] Message sent " +
            "in is: \n" + getMessageBody(inDoc));
          ArrayList errors = new ArrayList();
          errors.add(buildError(errType, errCode, errDesc));
          String replyContents =
            buildReplyDocumentWithErrors(eControlArea, localProvideDoc, errors);
          return getMessage(msg, replyContents);
        }

        // If an InstitutionalIdentity was found in the repository for the
        // UnknownPerson, the InstitutionalIdentity object will not be null. If
        // no InstitutionalIdentity was found for the UnknownPerson, the
        // InstitutionalIdentity will be null. If the InstitutionalIdentity is
        // not null, serialize it and place it into the DataArea of the
        // Provide-Reply. If it is null, clear the DataArea of the Provide-Reply
        // to return an empty DataArea as prescribed by the OpenEAI Message
        // Protocol.     
        try {
          if (instIdent != null) {  
            localProvideDoc.getRootElement().getChild("DataArea").
              removeContent();
            localProvideDoc.getRootElement().getChild("DataArea").
              addContent((Element)instIdent.buildOutputFromObject());
          }
          else {
            localProvideDoc.getRootElement().getChild("DataArea").
              removeContent();
          }
        }
        catch (EnterpriseLayoutException ele) {
          // An error occurred building the InstitutionalIdentity element from
          // the InstitutionalIdentity object returned from the I2sRepository.
          // Log it an reply with an error.
          String errType = "application";
          String errCode = "InstitutionalIdentityService-1003";
          String errDesc = "An error occurred building the Institutional" +
            "Identity element from the InstitutionalIdentity object returned " +
            "from the I2sRepository.  The exception is: " + ele.getMessage();
          logger.fatal("[InstitutionalIdentityRequestCommand " + errDesc);
          ArrayList errors = new ArrayList();
          errors.add(buildError(errType, errCode, errDesc));
          String replyContents =
          buildReplyDocumentWithErrors(eControlArea, localProvideDoc, errors);
          return getMessage(msg, replyContents);
        }

        // Build the reply message and return it.
        String replyContents =
          buildReplyDocument(eControlArea, localProvideDoc);
        return getMessage(msg, replyContents);
      }
    }

    // Process a Generate-Request message.
    if (msgAction.equalsIgnoreCase("Generate")) { 
      logger.info("[InstitutionalIdentityRequestCommand] Handling an " +
        "org.any-openeai-enterprise.CoreApplication.InstitutionalIdentity." +
        "Generate-Request message.");
      // Get the generate element.
      Element generateElement = inDoc.getRootElement().getChild("DataArea")
        .getChild("UnknownPerson");

      // Verify that the generate element is an UnknownPerson and that it is
      // not null. If it is null, reply with an error.
      if (generateElement == null) {
        String errType = "application";
        String errCode = "OpenEAI-1015";
        String errDesc = "Invalid generate element found in the Generate-" +
          "Request message. This command expects an UnknownPerson.";
        logger.fatal("[InstitutionalIdentityRequestCommand] " + errDesc);
        logger.fatal("[InstitutionalIdentityRequestCommand] 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);
      }

      // Get a primed UnknownPerson object from AppConfig.
      UnknownPerson uPerson = new UnknownPerson();
      try {
        uPerson = (UnknownPerson)getAppConfig().
          getObject("UnknownPerson");
      }
      catch (EnterpriseConfigurationObjectException eoce) {
      logger.fatal("[InstitutionalIdentityRequestCommand] Error retrieving " +
        "an UnknownPerson object from AppConfig. The exception is: " +
        eoce.getMessage());
      }
     
      // Try to build the UnknownPerson object from the generate element.
      try {
        uPerson.buildObjectFromInput(generateElement);
      }
      catch (EnterpriseLayoutException ele) {
        // There was an error building the UnknownPerson object from the
        // generate element.
        String errType = "application";
        String errCode = "InstitutionalIdentityService-1004";
        String errDesc = "Error building the UnknownPerson object from the" +
          "UnknownPerson element in the Generate-Request message. The " +
          "exception is: " + ele.getMessage();
        logger.fatal("[InstitutionalIdentityRequestCommand] " + 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);       
      }

      // Set the TestId.
      uPerson.setTestId(testId);

      // Generate the InstitutionalIdentity and reply.
      InstitutionalIdentity instIdent = new InstitutionalIdentity();
      try {
        instIdent = m_i2sRepository.generateInstitutionalIdentity(uPerson);       
View Full Code Here

TOP

Related Classes of org.any_openeai_enterprise.moa.objects.resources.v1_0.LightweightPerson

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.