Package org.any_openeai_enterprise.moa.jmsobjects.coreapplication.v1_0

Examples of org.any_openeai_enterprise.moa.jmsobjects.coreapplication.v1_0.EnterpriseUserPassword


    (java.sql.Connection conn, String ssn) throws I2sRepositoryException {
    logger.debug("[RdbmsI2sRepository] Retrieving InstitutionalIdentity for " +
      "SSN: " + ssn + ".");

    // Get a configured InstitutionalIdentity object out of AppConfig.
    InstitutionalIdentity instIdent = new InstitutionalIdentity();
    try {
      instIdent = (InstitutionalIdentity)getAppConfig()
        .getObject("InstitutionalIdentity");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving an InstitutionalIdentity object from
      // AppConfig. Log it and throw an exception.
      String errMsg = "An error occurred retrieving an InstitutionalIdentity " +
        "object from AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdBySsn] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }

    // Get a configured UnknownPerson object out of AppConfig.
    UnknownPerson uPerson = new UnknownPerson();
    try {
      uPerson = (UnknownPerson)getAppConfig().getObject("UnknownPerson");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving an UnknownPerson object from
      // AppConfig. Log it and throw an exception.
      String errMsg = "An error occurred retrieving an UnknownPerson " +
        "object from AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdBySsn] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }

    // Get a configured Name object out of AppConfig.
    Name name = new Name();
    try {
      name = (Name)getAppConfig().getObject("Name");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving a Name object from AppConfig. Log it and
      // throw an exception.
      String errMsg = "An error occurred retrieving a Name object from " +
        "AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdBySsn] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }
   
    // Initialize a query string to retrieve the InstitutionalIdentity.
    String getString1 = "SELECT INST_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME, " +
      "SSN, BIRTH_DATE, GENDER FROM T_INST_IDENT WHERE SSN = ? AND " +
      "TERMINATED_DATE IS NULL";
     
    try {
      PreparedStatement getStmt1 = conn.prepareStatement(getString1);
      getStmt1.clearParameters();
      getStmt1.setString(1, ssn);
      ResultSet r1 = getStmt1.executeQuery();
      if (r1.next()) {
        // The InstitutionalIdentity exists. Log a message and build the
        // InstitutionalIdentity object.
        logger.debug("[RdbmsI2sRepository.retrieveInstitutionalIdentityBySsn] "
          + "Found an InstitutionalIdentity in the database for SSN: " + ssn +
          ".");
        // Set the values of the Name object.
        try {
          name.setFirstName(r1.getString(2));
          name.setMiddleName(r1.getString(3));
          name.setLastName(r1.getString(4));
        }
        catch (EnterpriseFieldException efe) {
          // An error occurred setting field values for the Name. Log it,
          // close the statement, and throw an exception.
          String errMsg = "An error occurred seeting field values for the " +
            "Name. the exception is: " + efe.getMessage();
          logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentityBySsn]"
            + " " + errMsg);
          getStmt1.close();
          throw new I2sRepositoryException(errMsg);
        }
        // Set the values of the UnknownPerson object.
        try {
          uPerson.setName(name);
          uPerson.setSocialSecurityNumber(r1.getString(5));
          org.any_openeai_enterprise.moa.objects.resources.v1_0.Date xeoStartDate =
            toXeoDate("BirthDate", r1.getDate(6));
          uPerson.setBirthDate(xeoStartDate);
          uPerson.setGender(r1.getString(7));
        }
        catch (EnterpriseFieldException efe) {
          // An error occurred setting field values for the UnknownPerson.
          // Log it, close the statement, and throw an exception.
          String errMsg = "An error occurred seeting field values for the " +
            "UnknownPerson. the exception is: " + efe.getMessage();
          logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentityBySsn]"
            + " " + errMsg);
          getStmt1.close();
          throw new I2sRepositoryException(errMsg);
        }
        // Set the values of the InstitutionalIdentity object.
        try {
          instIdent.setInstitutionalId(r1.getString(1));
          instIdent.setUnknownPerson(uPerson);
        }
        catch (EnterpriseFieldException efe) {
          // An error occurred setting field values for the
          // InstitutionalIdentity. Log it, close the statement, and throw an
          // exception.
View Full Code Here


    (java.sql.Connection conn, String instId) throws I2sRepositoryException {
    logger.debug("[RdbmsI2sRepository] Retrieving InstitutionalIdentity for " +
      "InstitutionalId: " + instId + ".");

    // Get a configured InstitutionalIdentity object out of AppConfig.
    InstitutionalIdentity instIdent = new InstitutionalIdentity();
    try {
      instIdent = (InstitutionalIdentity)getAppConfig()
        .getObject("InstitutionalIdentity");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving an InstitutionalIdentity object from
      // AppConfig. Log it and throw an exception.
      String errMsg = "An error occurred retrieving an InstitutionalIdentity " +
        "object from AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdByInstId] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }

    // Get a configured UnknownPerson object out of AppConfig.
    UnknownPerson uPerson = new UnknownPerson();
    try {
      uPerson = (UnknownPerson)getAppConfig().getObject("UnknownPerson");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving an UnknownPerson object from
      // AppConfig. Log it and throw an exception.
      String errMsg = "An error occurred retrieving an UnknownPerson " +
        "object from AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdByIndtId] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }

    // Get a configured Name object out of AppConfig.
    Name name = new Name();
    try {
      name = (Name)getAppConfig().getObject("Name");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving a Name object from AppConfig. Log it and
      // throw an exception.
      String errMsg = "An error occurred retrieving a Name object from " +
        "AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdByInstId] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }
   
    // Initialize a query string to retrieve the InstitutionalIdentity.
    String getString1 = "SELECT INST_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME, " +
      "SSN, BIRTH_DATE, GENDER FROM T_INST_IDENT WHERE INST_ID = ? AND " +
      "TERMINATED_DATE IS NULL";
     
    try {
      PreparedStatement getStmt1 = conn.prepareStatement(getString1);
      getStmt1.clearParameters();
      getStmt1.setString(1, instId);
      ResultSet r1 = getStmt1.executeQuery();
      if (r1.next()) {
        // The InstitutionalIdentity exists. Log a message and build the
        // InstitutionalIdentity object.
        logger.debug("[RdbmsI2sRepository.retrieveInstitutionalIdentityByInst" +
          "Id] Found an InstitutionalIdentity in the database for " +
          "InstitutionalId: " + instId + ".");
        // Set the values of the Name object.
        try {
          name.setFirstName(r1.getString(2));
          name.setMiddleName(r1.getString(3));
          name.setLastName(r1.getString(4));
        }
        catch (EnterpriseFieldException efe) {
          // An error occurred setting field values for the Name. Log it,
          // close the statement, and throw an exception.
          String errMsg = "An error occurred seeting field values for the " +
            "Name. the exception is: " + efe.getMessage();
          logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentityBy" +
            "InstId] " + errMsg);
          getStmt1.close();
          throw new I2sRepositoryException(errMsg);
        }
        // Set the values of the UnknownPerson object.
        try {
          uPerson.setName(name);
          uPerson.setSocialSecurityNumber(r1.getString(5));
          org.any_openeai_enterprise.moa.objects.resources.v1_0.Date xeoStartDate =
            toXeoDate("BirthDate", r1.getDate(6));
          uPerson.setBirthDate(xeoStartDate);
          uPerson.setGender(r1.getString(7));
        }
        catch (EnterpriseFieldException efe) {
          // An error occurred setting field values for the UnknownPerson.
          // Log it, close the statement, and throw an exception.
          String errMsg = "An error occurred seeting field values for the " +
            "UnknownPerson. the exception is: " + efe.getMessage();
          logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentityBy" +
            "InstId] " + errMsg);
          getStmt1.close();
          throw new I2sRepositoryException(errMsg);
        }
        // Set the values of the InstitutionalIdentity object.
        try {
          instIdent.setInstitutionalId(r1.getString(1));
          instIdent.setUnknownPerson(uPerson);
        }
        catch (EnterpriseFieldException efe) {
          // An error occurred setting field values for the
          // InstitutionalIdentity. Log it, close the statement, and throw an
          // exception.
View Full Code Here

    I2sRepositoryException {
    logger.debug("[RdbmsI2sRepository] Retrieving InstitutionalIdentity for " +
      "UnknownPerson: " + queryPerson.toString() + ".");

    // Get a configured InstitutionalIdentity object out of AppConfig.
    InstitutionalIdentity instIdent = new InstitutionalIdentity();
    try {
      instIdent = (InstitutionalIdentity)getAppConfig()
        .getObject("InstitutionalIdentity");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving an InstitutionalIdentity object from
      // AppConfig. Log it and throw an exception.
      String errMsg = "An error occurred retrieving an InstitutionalIdentity " +
        "object from AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentity] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }

    // Get a configured UnknownPerson object out of AppConfig.
    UnknownPerson uPerson = new UnknownPerson();
    try {
      uPerson = (UnknownPerson)getAppConfig().getObject("UnknownPerson");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving an UnknownPerson object from
      // AppConfig. Log it and throw an exception.
      String errMsg = "An error occurred retrieving an UnknownPerson " +
        "object from AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentity] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }

    // Get a configured Name object out of AppConfig.
    Name name = new Name();
    try {
      name = (Name)getAppConfig().getObject("Name");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving a Name object from AppConfig. Log it and
      // throw an exception.
      String errMsg = "An error occurred retrieving a Name object from " +
        "AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentity] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }
   
    // Initialize a query string to retrieve the InstitutionalIdentity.
    String getString1 = "SELECT INST_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME, " +
      "SSN, BIRTH_DATE, GENDER FROM T_INST_IDENT WHERE LAST_NAME = ? " +
      "AND BIRTH_DATE = ? AND GENDER = ? AND TERMINATED_DATE IS NULL";

    // If the UnknownPerson in the query has a FirstName, then add it to the
    // where clause and indicate that we must set this parameter of the
    // subsequent prepared statement.
    boolean hasFirstName = false;
    if (queryPerson.getName().getFirstName() != null) {
      getString1 = getString1 + " AND FIRST_NAME = ?";
      hasFirstName = true;
    }

    // If the UnknownPerson in the query has a MiddleName, then add it to the
    // where clause and indicate that we must set this parameter of the
    // subsequent prepared statement.
    boolean hasMiddleName = false;
    if (queryPerson.getName().getMiddleName() != null) {
      getString1 = getString1 + " AND MIDDLE_NAME = ?";
      hasMiddleName = true;
    }
   
    try {
      PreparedStatement getStmt1 = conn.prepareStatement(getString1);
      getStmt1.clearParameters();
      getStmt1.setString(1, queryPerson.getName().getLastName());
      java.sql.Date birthDate = null;
      try { birthDate = toSqlDate(queryPerson.getBirthDate()); }
      catch(InvalidFormatException ife) {
        // An error occurred formatting the birth date. Log it and throw an
        // exception.
        String errMsg = "An error occurred formatting the birth date. The " +
          "excception is: " + ife.getMessage();
        logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentity] " +
          errMsg);
      }
      getStmt1.setDate(2, birthDate);
      getStmt1.setString(3, queryPerson.getGender());
      if (hasFirstName == true) {
        getStmt1.setString(4, queryPerson.getName().getFirstName());
      }
      if (hasMiddleName == true) {
        getStmt1.setString(5, queryPerson.getName().getMiddleName());
      }
     
      ResultSet r1 = getStmt1.executeQuery();
      if (r1.next()) {
        // The InstitutionalIdentity exists. Log a message and build the
        // InstitutionalIdentity object.
        logger.debug("[RdbmsI2sRepository.retrieveInstitutionalIdentity] " +
          "Found an InstitutionalIdentity in the database for the " +
          "UnknownPerson: " + queryPerson.toString());
        // Set the values of the Name object.
        logger.debug("InstId: " + r1.getString(1));
        logger.debug("FirstName: " + r1.getString(2));
        logger.debug("MiddleName: " + r1.getString(3));
        logger.debug("LastName: " + r1.getString(4));
        logger.debug("SSN: " + r1.getString(5));
        logger.debug("BirthDate (date): " + r1.getDate(6).toString());
        // Note: uncommenting the next line with break this gateway for MySQL.
        // logger.debug("BirthDate (timestamp): " + r1.getTimestamp(6).toString());
        logger.debug("Gender: " + r1.getString(7));
        try {
          name.setFirstName(r1.getString(2));
          name.setMiddleName(r1.getString(3));
          name.setLastName(r1.getString(4));
        }
        catch (EnterpriseFieldException efe) {
          // An error occurred setting field values for the Name. Log it,
          // close the statement, and throw an exception.
          String errMsg = "An error occurred setting field values for the " +
            "Name. the exception is: " + efe.getMessage();
          logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentity] " +
            errMsg);
          getStmt1.close();
          throw new I2sRepositoryException(errMsg);
        }
        // Set the values of the UnknownPerson object.
        try {
          uPerson.setName(name);
          uPerson.setSocialSecurityNumber(r1.getString(5));
          org.any_openeai_enterprise.moa.objects.resources.v1_0.Date xeoStartDate =
            toXeoDate("BirthDate", r1.getDate(6));
          uPerson.setBirthDate(xeoStartDate);
          uPerson.setGender(r1.getString(7));
        }
        catch (EnterpriseFieldException efe) {
          // An error occurred setting field values for the UnknownPerson.
          // Log it, close the statement, and throw an exception.
          String errMsg = "An error occurred seeting field values for the " +
            "UnknownPerson. the exception is: " + efe.getMessage();
          logger.fatal("[RdbmsI2sRepository.retrieveInstitutionalIdentity]"
            + " " + errMsg);
          getStmt1.close();
          throw new I2sRepositoryException(errMsg);
        }
        // Set the values of the InstitutionalIdentity object.
        try {
          instIdent.setInstitutionalId(r1.getString(1));
          instIdent.setUnknownPerson(uPerson);
        }
        catch (EnterpriseFieldException efe) {
          // An error occurred setting field values for the
          // InstitutionalIdentity. Log it, close the statement, and throw an
          // exception.
View Full Code Here

      epc = m_connPool.getExclusiveConnection();
      conn = epc.getConnection();
      conn.setAutoCommit(false);

      // Generate the InstitutionalIdentity.
      InstitutionalIdentity instIdent = new InstitutionalIdentity();
      instIdent = generateInstitutionalIdentity(pub, conn, uPerson);
      return instIdent;
    }
    catch (JMSException jmse) {
      // There was an error retrieving a pub/sub producer from the pool to
View Full Code Here

      throw new I2sRepositoryException(errMsg);
    }

    // Determine if the UnknownPerson has already been assigned an
    // InstitutionalId. If so, log it and throw an exception.
    InstitutionalIdentity existingInstIdent = new InstitutionalIdentity();
    existingInstIdent = retrieveInstitutionalIdentity(conn, uPerson);
    if (existingInstIdent != null) {
      String errMsg = "An InstitutionalId has already been assigned to this " +
        "UnknownPerson. Cannot generate a new InstitutionalIdentity fot this " +
        "UnknownPerson.";
      logger.fatal("[RdbmsI2sRepository.generateInstitutionalIdentity] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);     
    }
   
    // Retrieve the next InstitutionalId to use for this person.
    String instId = null;
    try { instId = getInstIdSequence().next(); }
    catch (SequenceException se) {
      // An error occurred getting the next value from the institutional ID
      // sequence. Log it and throw an exception.
      String errMsg = "An error occurred getting the next value from the " +
        "institutional ID sequence. The exception is: " + se.getMessage();
      logger.fatal("[RdbmsI2sRepository.generateInstitutionalIdentity] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }

    // Get a configured InstitutionalIdentity object out of AppConfig.
    InstitutionalIdentity instIdent = new InstitutionalIdentity();
    try {
      instIdent = (InstitutionalIdentity)getAppConfig()
        .getObject("InstitutionalIdentity");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving an InstitutionalIdentity object from
      // AppConfig. Log it and throw an exception.
      String errMsg = "An error occurred retrieving an InstitutionalIdentity " +
        "object from AppConfig. The exception is: " + eoce.getMessage();
      logger.fatal("[RdbmsI2sRepository.generateInstitutionalIdentity] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }

    // Set the values of the InstitutionalIdentity.
    try {
      instIdent.setInstitutionalId(instId);
      instIdent.setUnknownPerson(uPerson);
    }
    catch (EnterpriseFieldException efe) {
      // An error occurred setting field values for the InstitutionalIdentity.
      // Log it and throw an exception.
      String errMsg = "An error occurred setting field values for the " +
        "InstitutionalIdentity. The exception is: " + efe.getMessage();
      logger.fatal("[RdbmsI2sRepository.generateInstitutionalIdentity] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }

    // Set the TestId.
    instIdent.setTestId(uPerson.getTestId());

    // Create the InstitutionalIdentity.
    createInstitutionalIdentity(pub, conn, instIdent);

    return instIdent;
View Full Code Here

        "InstitutionalIdentity.";
      logger.fatal("[RdbmsI2sRepository.updateInstitutionalIdentity] " +
        errMsg);
      throw new I2sRepositoryException(errMsg);
    }
    InstitutionalIdentity currentInstIdent = new InstitutionalIdentity();
    currentInstIdent = retrieveInstitutionalIdentity(conn, id);

    // --- Compare the baseline to the current state of the
    //     InstitutionalIdentity.
    try
View Full Code Here

            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);       
      }
      catch (I2sRepositoryException i2sre) {
        String errType = "system";
        String errCode = "InstitutionalIdentityService-1005";
        String errDesc = "Error accessing the I2sRepository to generate the " +
          "InstitutionalIdentiy. 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, localResponseDoc, errors);
        return getMessage(msg, replyContents);
      }

      try {
        localResponseDoc.getRootElement().getChild("DataArea").
          removeContent();
        localResponseDoc.getRootElement().getChild("DataArea").
          addContent((Element)instIdent.buildOutputFromObject());
        String replyContents = buildReplyDocument(eControlArea, localResponseDoc);
        return getMessage(msg, replyContents);
      }
      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);
      }
    }

    // Process an Update-Request message.
    if (msgAction.equalsIgnoreCase("Update")) {
      logger.info("[InstitutionalIdentityRequestCommand] Handling an " +
        "org.any-openeai-enterprise.CoreApplication.InstitutionalIdentity." +
        "Update-Request message.");
      // Get the update elements.
      Element newUpdateElement = inDoc.getRootElement().getChild("DataArea").
        getChild("NewData").getChild("InstitutionalIdentity");
      Element baselineUpdateElement = inDoc.getRootElement()
        .getChild("DataArea").getChild("BaselineData")
        .getChild("InstitutionalIdentity");

      // Verify that the NewData element is an InstitutionalIdentity and that it
      // is not null. If it is null, reply with an error.
      if (newUpdateElement == null) {
        String errType = "application";
        String errCode = "OpenEAI-1011";
        String errDesc = "Invalid update element found in the NewData " +
          "element of the Update-Request message. This command expects an " +
          "InstitutionalIdentity.";
        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);
      }

      // Verify that the BaselineData element is an InstitutionalIdentity and
      // that it is not null. If it is null, reply with an error.
      if (baselineUpdateElement == null) {
        String errType = "application";
        String errCode = "OpenEAI-1012";
        String errDesc = "Invalid update element found in the BaselineData " +
          "element of the Update-Request message. This command expects an " +
          "InstitutionalIdentity.";
        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 two primed InstitutionalIdentity objects out of AppConfig.
      InstitutionalIdentity newInstIdent = new InstitutionalIdentity();
      InstitutionalIdentity baselineInstIdent = new InstitutionalIdentity();
      try {
        newInstIdent = (InstitutionalIdentity)getAppConfig().
          getObject("InstitutionalIdentity");
        baselineInstIdent = (InstitutionalIdentity)getAppConfig().
          getObject("InstitutionalIdentity");
      }
      catch (EnterpriseConfigurationObjectException eoce) {
      logger.fatal("[InstitutionalIdentityRequestCommand] Error retrieving an" +
        " InstitutionalIdentity object from AppConfig. The exception is: " +
        eoce.getMessage());
      }
     
      // Try to build an InstitutionalIdentity object from the NewData element.
      try {
        newInstIdent.buildObjectFromInput(newUpdateElement);
      }
      catch (EnterpriseLayoutException ele) {
        // An error occurred building the InstitutionalIdentity object from the
        // InstitutionalIdentity NewData element.
        String errType = "application";
        String errCode = "InstitutionalIdentityService-1006";
        String errDesc = "Error building the InstitutionalIdentity object " +
          "from the InstitutionalIdentity element found in the NewData " +
          "element in the Update-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);       
      }
     
      // Try to build an InstitutionalIdentity object from the BaselineData
      // element.
      try {
        baselineInstIdent.buildObjectFromInput(baselineUpdateElement);
      }
      catch (EnterpriseLayoutException ele) {
        // There was an error building the InstitutionalIdentity object from the
        // baseline update element.
        String errType = "application";
        String errCode = "InstitutionalIdentityService-1007";
        String errDesc = "Error building the InstitutionalIdentity object " +
          "from the InstitutionalIdentity element found in the BaselineData " +
          "element in the Update-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);       
      }

      // Verify that the baseline matches the current state of the
      // InstitutionalIdentity. Otherwise reply with a baseline stale error.

      // --- Retrieve the current state of the InstitutionalIdentity.
      Identifier id = new Identifier();
      try {
        id.setType("InstitutionalId");
        id.setValue(baselineInstIdent.getInstitutionalId());
      }
      catch (EnterpriseFieldException efe) {
        // An error occurred setting the values of the identifier to use to
        // retrieve the current state of the InstitutionalIdentity. Log it
        // and throw an exception.
        String errType = "application";
        String errCode = "InstitutionalIdentityService-1011";
        String errDesc = "Error occurred setting field values for the " +
          "identifier to use in retrieving the current state of the " +
          "InstitutionalIdentity. The exception is:  " + efe.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);
      }
      InstitutionalIdentity currentInstIdent = new InstitutionalIdentity();
      try {
        currentInstIdent = m_i2sRepository.retrieveInstitutionalIdentity(id);
      }
      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 the InstitutionalIdentity to update does not exist, reply with
      //     an error.
      if (currentInstIdent == null) {
        String errType = "application";
        String errCode = "OpenEAI-1016";
        String errDesc = "The object for which an update was requested does " +
          "not exist. An object must be created before it can be updated.";
        logger.fatal("[RdbmsI2sRepository.updateInstitutionalIdentity] " +
          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 the InstitutionalIdentity to update does exists, compare the
      //     baseline to the current state of the InstitutionalIdentity. If they
      //     do not match, reply with an error.
      try
        if (baselineInstIdent.equals(currentInstIdent) == false) {
          // The baseline does not match the current state of the
          // InstitutionalIdentity. Log it and reply with an error.
          String errType = "application";
          String errCode = "OpenEAI-1014";
          String errDesc = "The baseline is stale. This InstitutionalIdentity " +
            "has been updated since you queried for the baseline. You must " +
            "query for the InstitutionalIdentity to retrieve a current baseline"
            + " before an update can be performed.";
          logger.fatal("[RdbmsI2sRepository.updateInstitutionalIdentity] " +
            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);
        }
      }
      catch (XmlEnterpriseObjectException xeoe) {
        // An error occurred comparing the baseline InstitutionalIdentity and
        // the current state of the InstitutionalIdentity. Log it, and throw an
        // exception.
        String errType = "application";
        String errCode = "InstitutionalIdentityService-1012";
        String errDesc = "An error occurred comparing the baseline " +
          "InstitutionalIdentity with the current state of the " +
          "InstitutionalIdentity. The exception is: " + xeoe.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);
      }

      // Set the TestId.
      baselineInstIdent.setTestId(testId);
      newInstIdent.setTestId(testId);

      // Update the InstitutionalIdentity and reply.
      try {
        m_i2sRepository.updateInstitutionalIdentity(baselineInstIdent,
          newInstIdent);       
      }
      catch (I2sRepositoryException i2sre) {
        String errType = "system";
        String errCode = "InstitutionalIdentityService-1008";
        String errDesc = "Error accessing the I2Repository to update 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, localResponseDoc, errors);
        return getMessage(msg, replyContents);
      }

      // Reply with a success.
      String replyContents = buildReplyDocument(eControlArea, localResponseDoc);
      return getMessage(msg, replyContents);
   
   
    // Process a Delete-Request.
    if (msgAction.equalsIgnoreCase("Delete")) {
      logger.info("[InstitutionalIdentityRequestCommand] Handling an " +
        "org.any-openeai-enterprise.CoreApplication.InstitutionalIdentity." +
        "Delete-Request message.");
      // Get the delete action type.
      Attribute aDeleteType = inDoc.getRootElement().getChild("DataArea").
        getChild("DeleteData").getChild("DeleteAction").getAttribute("type");                
      String deleteAction = aDeleteType.getValue();

      // Verify that the delete action is valid. If it is not, reply with an
      // error.
      if (deleteAction.equalsIgnoreCase("delete") == false &&
        deleteAction.equalsIgnoreCase("purge") == false) {
        String errType = "application";
        String errCode = "OpenEAI-1008";
        String errDesc = "Invalid delete action type. Only delete actions of " +
          "type 'delete' and 'purge' are allowed.";
        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);
      }

      // If the delete action is of type purge and purge support is presently
      // disabled, reply with an error.
      if (deleteAction.equalsIgnoreCase("purge") &&
        m_allowPurge == false) {
        String errType = "application";
        String errCode = "OpenEAI-1009";
        String errDesc = "Purge disabled. The delete action type of purge is " +
          "supported by this implementation, but it is presently disabled.";
        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 the delete element.
      Element deleteElement = inDoc.getRootElement().getChild("DataArea").
        getChild("DeleteData").getChild("InstitutionalIdentity");

      // Verify that the delete element is an InstitutionalIdentity and that it
      // is not null. If it is null, reply with an error.
      if (deleteElement == null) {
        String errType = "application";
        String errCode = "OpenEAI-1010";
        String errDesc = "Invalid delete element found in the Delete-Request " +
          "message. This command expects an ApplicationSession.";
        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 configured InstitutionalIdentity object out of AppConfig.
      InstitutionalIdentity instIdent = new InstitutionalIdentity();
      try {
        instIdent = (InstitutionalIdentity)getAppConfig().
          getObject("InstitutionalIdentity");
      }
      catch (EnterpriseConfigurationObjectException eoce) {
        // An error occurred retrieving an InstitutionalIdentity object from
        // AppConfig. Log it and throw an exception.
        String errMsg = "An error occurred retrieving an Institutional" +
          "Identity object from AppConfig. The exception is: " +
          eoce.getMessage();
        logger.fatal("[InstitutionalIdentityRequestCommand] " + errMsg);
      }
     
      // Try to build the InstitutionalIdentity object from the delete Element.
      try {
        instIdent.buildObjectFromInput(deleteElement);
      }
      catch (EnterpriseLayoutException ele) {
        // There was an error building the InstitutionalIdentity object from the
        // delete element.
        String errType = "application";
        String errCode = "InstitutionalIdentityService-1009";
        String errDesc = "Error building the InstitutionalIdentity object " +
          "from the InstitutionalIdentity element in the Delete-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.
      instIdent.setTestId(testId);

      // Delete the InstitutionalIdentity.
      try {
        m_i2sRepository.deleteInstitutionalIdentity(deleteAction, instIdent);       
      }
View Full Code Here

      getEnterpriseIdDomain() + ".");

    // Verify that all message objects required are in AppConfig.
    // Get a configured NetId object out of AppConfig.
    try {
      NetId netId = (NetId)getAppConfig().getObject("NetId");

      EnterpriseUser entUser = (EnterpriseUser)getAppConfig()
        .getObject("EnterpriseUser");
      EnterpriseUserPassword entUserPassword =
        (EnterpriseUserPassword)getAppConfig()
View Full Code Here

    // Get a list of NetIds.
    List netIds = entUser.getNetId();
   
    // Iterate through the NetIds for the EnterpriseUser and find the
    // EnterpriseId and return it.
    NetId netId = new NetId();
    for (int i=0; i < netIds.size(); i++) {
      netId = (NetId)netIds.get(i);
      logger.debug("[PasswordSyncCommand.getEnterpriseId] Found NetId: "
        + toString(netId));
      if (netId.getDomain().equals(m_enterpriseIdDomain)) {
        logger.debug("[PasswordSyncCommand.getEnterpriseId] Found " +
          "EnterpriseId: " + toString(netId));
        return netId;
      }
    }
View Full Code Here

    }

    // Verify that all message objects required are in AppConfig.
    // Get a configured NetId object out of AppConfig.
    try {
      NetId netId = (NetId)getAppConfig().getObject("NetId");

      EnterpriseUser entUser = (EnterpriseUser)getAppConfig()
        .getObject("EnterpriseUser");
      EnterpriseUserPassword entUserPassword =
        (EnterpriseUserPassword)getAppConfig()
View Full Code Here

TOP

Related Classes of org.any_openeai_enterprise.moa.jmsobjects.coreapplication.v1_0.EnterpriseUserPassword

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.