Package com.any_erp_vendor.moa.jmsobjects.person.v1_0

Examples of com.any_erp_vendor.moa.jmsobjects.person.v1_0.BasicPerson


      stmt.setString(1, instId);
      logger.info("Retrieving Person record for InstitutionalId: " + instId);
      ResultSet rs = stmt.executeQuery();
      logger.info("Retreived Person record for InstitutionalId: " + instId);

      BasicPerson bPerson = (BasicPerson)getAppConfig().getObject("BasicPerson.v1_0");
      Name aName = bPerson.newName();
      boolean foundPerson = false;
      while (rs.next()) {
        foundPerson = true;
        bPerson.setInstitutionalId(rs.getString(1));
        aName.setFirstName(rs.getString(2));
        aName.setMiddleName(rs.getString(3));
        aName.setLastName(rs.getString(4));
        bPerson.setName(aName);
        bPerson.setGender(rs.getString(5));
        bPerson.setEthnicity(rs.getString(6));
        com.any_erp_vendor.moa.objects.resources.v1_0.Date bDate = bPerson.newBirthDate();
        java.sql.Date dbDate = rs.getDate(7);

        if (dbDate != null) {
          Calendar calendar = new GregorianCalendar();
          calendar.setTime(dbDate);

          bDate.setYear(Integer.toString(calendar.get(Calendar.YEAR)));
          bDate.setMonth(Integer.toString(calendar.get(Calendar.MONTH)+1));
          bDate.setDay(Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)));

          logger.info("BirthDate from db is: " + bDate.toString());
          bPerson.setBirthDate(bDate);
        }
        bPerson.setSocialSecurityNumber(rs.getString(8));
      }
     
      stmt.close();

      // finally, release the connection.
View Full Code Here


  * objects (insert, update or deletes)
  * @throws SQLException if errors occur deleting the message object from the database or if
  * errors occur publishing the resulting Delete-Sync message.
  **/
  protected void updatePerson(String msgCategory, String msgObject, String msgRelease, BasicPerson newData, BasicPerson baselinePerson) throws SQLException {   
    BasicPerson dbPerson = retrievePerson(newData.getInstitutionalId());
    if (dbPerson == null) {
      logger.info("Person did not exist in our repository, we'll just create them.");
      createPerson(msgCategory, msgObject, msgRelease, newData);
      return;
    }
View Full Code Here

      "publishErrorsForMissingEntries is: " +
      getPublishErrorsForMissingEntries());

    // Verify that all message objects required are in AppConfig.
    try {
      BasicPerson bPerson = (BasicPerson)getAppConfig()
        .getObject("BasicPerson");
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving a required object from AppConfig. Log it
      // and throw an exception.
View Full Code Here

      publishSyncError(eControlArea, errors);
      return;
    }

    // Get two configured BasicPerson objects from AppConfig.
    BasicPerson currentBasicPerson = null;
    BasicPerson newBasicPerson = null;
    try {
      currentBasicPerson = (BasicPerson)getAppConfig().getObject("BasicPerson");
      newBasicPerson = (BasicPerson)getAppConfig().getObject("BasicPerson");
    }
    catch (EnterpriseConfigurationObjectException ecoe) {
      // An error occurred getting an object from AppConfig. Log it and
      // publish a sync error message.
      Error error = new Error();
      error.setType("application");
      error.setErrorNumber("OpenEAI-3001");
      error.setErrorDescription("An error occurred getting an object from " +
        "AppConfig. the exception is: " + ecoe.getMessage());
      errors = new ArrayList();
      errors.add(error);
      publishSyncError(eControlArea, errors, ecoe);
      return;
    }

    // Handle a BasicPerson.Update-Sync
    if (messageAction.equalsIgnoreCase("Update")) {
      // Get the baseline state of the BasicPerson and build a BasicPerson
      // object.
      Element eBaselinePerson = inDoc.getRootElement().getChild("DataArea")
        .getChild("BaselineData").getChild("BasicPerson");
      try
        currentBasicPerson.buildObjectFromInput(eBaselinePerson);
      }
      catch (EnterpriseLayoutException ele) {
        // An error occurred building the BasicPerson object from the
        // BasicPerson element contained in the BaselineData element of the
        // message. Log it and publish a sync error message.
        Error error = new Error();
        error.setType("system");
        error.setErrorNumber("DirectoryServiceGateway-1001");
        error.setErrorDescription("An error occurred building the BasicPerson "
          + "object from the BasicPerson element contained in the " +
          "BaselineData element of the message. The exception is: " +
          ele.getMessage());
        errors = new ArrayList();
        errors.add(error);
        publishSyncError(eControlArea, errors, ele);
        return;
      }

      // Get the new state of the BasicPerson and build a BasicPerson
      // object.
      Element eNewPerson = inDoc.getRootElement().getChild("DataArea")
        .getChild("NewData").getChild("BasicPerson");
      try
        newBasicPerson.buildObjectFromInput(eNewPerson);
      }
      catch (EnterpriseLayoutException ele) {
        // An error occurred building the BasicPerson object from thw
        // BasicPerson element contained in the NewData element of
        // the message. Log it and publish a sync error message.
        Error error = new Error();
        error.setType("system");
        error.setErrorNumber("DirectoryServiceGateway-1002");
        error.setErrorDescription("An error occurred building the " +
          "BasicPerson object from the BasicPerson element contained in " +
          "the NewData element of the message. The exception is: " +
          ele.getMessage());
        errors = new ArrayList();
        errors.add(error);
        publishSyncError(eControlArea, errors, ele);
        return;
      }

      // Determine whether the user exists in the portal database.
      String instId = currentBasicPerson.getInstitutionalId();
      PortalPerson portalPerson = null;
      try { portalPerson = retrievePortalPerson(instId); }
      catch (CommandException ce) {
        // An error occurred querying the portal database to determine whether
        // the user exists. Log it, publish a error message, and return.
        String errMsg = "An error occurred querying the portal database to " +
          "determine whether the user exists.";
        logger.debug("[PasswordSyncCommand.execute] " + errMsg);
        Error error = new Error();
        error.setType("system");
        error.setErrorNumber("UportalGateway-2001");
        error.setErrorDescription(errMsg);
        errors = new ArrayList();
        errors.add(error);
        publishSyncError(eControlArea, errors, ce);
        return;
      }

      // If there are no matching entries and the publishErrorsForMissingEntries
      // property is true, publish a error message indicating that the user does
      // not exist. Otherwise, log the fact that the user does not exist and
      // return.
      if (portalPerson == null) {
        if (getPublishErrorsForMissingEntries() == true) {
          // --- Publish the sync error.
          Error error = new Error();
          error.setType("application");
          error.setErrorNumber("UportalGateway-1005");
          error.setErrorDescription("No user with user ID " + instId +
            " exists in the portal. Cannot reset the password for this user.");
          logger.fatal("[BasicPersonSyncCommand.execute] " +
            error.getErrorDescription());
          errors = new ArrayList();
          errors.add(error);
          publishSyncError(eControlArea, errors);
          return;
        }
        else {
          // --- Just log it.
          logger.info("[BasicPersonSyncCommand.execute] No user with user ID " +
            instId + " exists in the portal. Cannot reset the password for " +
            "this user.");
          return;
        }
      }

      // Otherwise, the user already exists in the portal, so determine if their
      // name and e-mail have changed and, if so, update them.
      else {
        // Get the new first name, last name, and e-mail address.
        String newFirstName = newBasicPerson.getName().getFirstName();
        String newLastName = newBasicPerson.getName().getLastName();
        String email;
        List emailAddresses = newBasicPerson.getEmail();
        ListIterator li = emailAddresses.listIterator();
       
        switch (emailAddresses.size()) {
          // If there are no e-mail addresses in the list, set the value of the
          // e-mail address to null.
View Full Code Here

      public DropDownLoader() {
      }
     
      public void run() {
        try {
          BasicPerson bPerson =
            (BasicPerson)APP_CONFIG.getObject(BASIC_PERSON);
         
          // state drop downs
          java.util.HashMap hm = bPerson.getEnterpriseFields().getFieldsForObject("Address");
          org.openeai.config.Field stateField = (org.openeai.config.Field)hm.get("StateOrProvince");
          org.openeai.config.EnterpriseTranslator et = stateField.getFormatter().getTranslator();
          java.util.Enumeration keys = et.getMappings().keys();
          while (keys.hasMoreElements()) {
            String fieldName = (String)keys.nextElement();
            org.openeai.OpenEaiObject.logger.info("Field name: " + fieldName);
            java.util.List l = (java.util.List)et.getMappings().get(fieldName);
            for (int i=0; i<l.size(); i++) {
              org.openeai.config.EnterpriseMapping em = (org.openeai.config.EnterpriseMapping)l.get(i);
              bp_stateList.addItem(em.getEnterpriseValue());
              ec_stateList.addItem(em.getEnterpriseValue());
            }       
          }
          bp_stateList.setSelectedIndex(-1);
          ec_stateList.setSelectedIndex(-1);
         
          // address type drop downs
          org.openeai.config.Field addrTypeField = (org.openeai.config.Field)hm.get("Type");
          org.openeai.config.EnterpriseTranslator et2 = addrTypeField.getFormatter().getTranslator();
          java.util.Enumeration keys2 = et2.getMappings().keys();
          while (keys2.hasMoreElements()) {
            String fieldName = (String)keys2.nextElement();
            org.openeai.OpenEaiObject.logger.info("Field name: " + fieldName);
            java.util.List l = (java.util.List)et2.getMappings().get(fieldName);
            for (int i=0; i<l.size(); i++) {
              org.openeai.config.EnterpriseMapping em = (org.openeai.config.EnterpriseMapping)l.get(i);
              bp_addressType.addItem(em.getEnterpriseValue());
            }       
          }
          bp_addressType.setSelectedIndex(-1);
         
          // phone type drop down
          java.util.HashMap hm2 = bPerson.getEnterpriseFields().getFieldsForObject("Phone");
          org.openeai.config.Field phoneTypeField = (org.openeai.config.Field)hm2.get("Type");
          org.openeai.config.EnterpriseTranslator et3 = phoneTypeField.getFormatter().getTranslator();
          java.util.Enumeration keys3 = et3.getMappings().keys();
          while (keys3.hasMoreElements()) {
            String fieldName = (String)keys3.nextElement();
            org.openeai.OpenEaiObject.logger.info("Field name: " + fieldName);
            java.util.List l = (java.util.List)et3.getMappings().get(fieldName);
            for (int i=0; i<l.size(); i++) {
              org.openeai.config.EnterpriseMapping em = (org.openeai.config.EnterpriseMapping)l.get(i);
              bp_phoneType.addItem(em.getEnterpriseValue());
            }       
          }
          bp_phoneType.setSelectedIndex(-1);
         
          // email type drop down
          java.util.HashMap hm3 = bPerson.getEnterpriseFields().getFieldsForObject("Email");
          org.openeai.config.Field emailTypeField = (org.openeai.config.Field)hm3.get("Type");
          org.openeai.config.EnterpriseTranslator et4 = emailTypeField.getFormatter().getTranslator();
          java.util.Enumeration keys4 = et4.getMappings().keys();
          while (keys4.hasMoreElements()) {
            String fieldName = (String)keys4.nextElement();
View Full Code Here

          xml += j.getXmlEnterpriseObject().toXmlString();
        }
        if (returnedJeos.size() == 0) {
          // create the BasicPerson using default values from uPortal (givenName, sn)
          LogService.log(LogService.INFO, "[basicPersonQueryHandler] BasicPerson doesn't exist, creating it.");
          BasicPerson bp = (BasicPerson)getAppConfig().getObject(messageObjectName);
          bp.setInstitutionalId(instId);
          Name name = bp.newName();
          name.setFirstName(firstName);
          name.setLastName(lastName);
          bp.setName(name);
          bp.create((PointToPointProducer)getAppConfig().getObject(producerName));
          LogService.log(LogService.INFO, "[basicPersonQueryHandler] BasicPerson was created.");
          xml += bp.getXmlEnterpriseObject().toXmlString();
        }
      }
      else {
        xml += "<LightweightPerson><InstitutionalId></InstitutionalId></LightweightPerson>";
      }
View Full Code Here

    // Make sure all objects needed are configured and available for use.
  // LightweightPerson, BasicPersion, EnterpriseUserPassword
     try {
      LightweightPerson lPerson =
            (LightweightPerson)getAppConfig().getObject("LightweightPerson");
        BasicPerson aeo = (BasicPerson)getAppConfig().getObject("BasicPerson");
        EnterpriseUserPassword newEntUserPassword = (EnterpriseUserPassword)getAppConfig()
          .getObject("EnterpriseUserPassword");
    }
    catch (EnterpriseConfigurationObjectException ecoe) {
      String errMsg = "[PasswordSyncCommand] An error occurred getting an  object from " +
View Full Code Here

      // Determine whether the user exists in the database.
      String userId = getUserId(newEntUserPassword);
      String instId = newEntUserPassword.getEnterpriseUser()
        .getLightweightPerson().getInstitutionalId();
      BasicPerson bp=null;
      try {
        logger.info("[PasswordSyncCommand.execute] Querying for BasicPerson.");
        bp = getBasicPerson(instId);
        logger.info("[PasswordSyncCommand.execute] Queried for BasicPerson.");
    } catch (EnterpriseConfigurationObjectException e) {
        // Log it, publish a error message, and return.
        String errMsg = "EnterpriseConfigurationObjectException: " + e.getMessage();
        logger.error("[PasswordSyncCommand.execute] " + errMsg);
        Error error = new Error();
        error.setType("system");
        error.setErrorNumber("SakaiGateway-1014");
        error.setErrorDescription(errMsg);
        errors = new ArrayList();
        errors.add(error);
        logger.info("[PasswordSyncCommand.execute] Publishing Sync.Error-Sync.");
        publishSyncError(eControlArea, errors);
        return
     } catch (EnterpriseFieldException e) {
        // Log it, publish a error message, and return.
        String errMsg = "EnterpriseFieldException: " + e.getMessage();
        logger.error("[PasswordSyncCommand.execute] " + errMsg);
        Error error = new Error();
        error.setType("system");
        error.setErrorNumber("SakaiGateway-1014");
        error.setErrorDescription(errMsg);
        errors = new ArrayList();
        errors.add(error);
       logger.info("[PasswordSyncCommand.execute] Publishing Sync.Error-Sync.");
        publishSyncError(eControlArea, errors);
        return
     } catch (EnterpriseObjectQueryException e) {
        // Log it, publish a error message, and return.
        String errMsg = "EnterpriseObjectQueryException: " + e.getMessage();
        logger.error("[PasswordSyncCommand.execute] " + errMsg);
        Error error = new Error();
        error.setType("system");
        error.setErrorNumber("SakaiGateway-1014");
        error.setErrorDescription(errMsg);
        errors = new ArrayList();
        errors.add(error);
        logger.info("[PasswordSyncCommand.execute] Publishing Sync.Error-Sync.");
        publishSyncError(eControlArea, errors);
        return
     }
  if (bp==null) {
        // No BasicPerson exists for this instId.
        // Log it, publish a error message, and return.
        String errMsg = "No BasicPerson exists for " + instId;
        logger.debug("[PasswordSyncCommand.execute] " + errMsg);
        Error error = new Error();
        error.setType("application");
        error.setErrorNumber("SakaiGateway-1012");
        error.setErrorDescription(errMsg);
        errors = new ArrayList();
        errors.add(error);
        publishSyncError(eControlArea, errors);
        return
      }
      PortalPerson portalPerson = null
      try { portalPerson = retrievePortalPersonByUserId(userId); }
      catch (CommandException ce) {
        // An error occurred querying the portal database to determine whether
        // the user exists. Log it, publish a error message, and return.
        String errMsg = "An error occurred querying the portal database to " +
          "determine whether the user exists.";
        logger.debug("[PasswordSyncCommand.execute] " + errMsg);
        Error error = new Error();
        error.setType("system");
        error.setErrorNumber("SakaiGateway-2001");
        error.setErrorDescription(errMsg);
        errors = new ArrayList();
        errors.add(error);
        publishSyncError(eControlArea, errors, ce);
        return;
      }

      // If the user does exist, publish a error message indicating
      // that the user already exists.
      if (portalPerson != null) {
        Error error = new Error();
        error.setType("application");
        error.setErrorNumber("SakaiGateway-1011");
        error.setErrorDescription("User with user ID " + userId +
          ") exists in the portal. Cannot reset the password for this user.");
        logger.fatal("[PasswordSyncCommand.execute] " +
          error.getErrorDescription());
        errors = new ArrayList();
        errors.add(error);
        publishSyncError(eControlArea, errors);
        return;
      }

      // Create the portal user with info from BasicPerson and the
      // user's password to be the new value indicated in the message.
      else {
        logger.info("[PasswordSyncCommand.execute] BasicPerson="+bp);
        portalPerson = new PortalPerson();
        portalPerson.setEmailAddress(getEmailAddress(bp.getEmail()));
        portalPerson.setUserId(userId);
        portalPerson.setInstId(instId);
        portalPerson.setFirstName(bp.getName().getFirstName());
        portalPerson.setLastName(bp.getName().getLastName());
       
        // Encypt the password.
        String encryptedPassword=null;
        String cleartextPassword = newEntUserPassword.getPassword().getValue();
        try {
View Full Code Here

        logger.info("[PasswordSyncCommand.getBasicPerson] Got LightweightPerson...");
 
        lPerson.setInstitutionalId(instId);
        logger.info("[PasswordSyncCommand.getBasicPerson] Set instid on lightweight person...");
       
        BasicPerson aeo = (BasicPerson)getAppConfig().getObject("BasicPerson");
        logger.info("[PasswordSyncCommand.getBasicPerson] Got BasicPerson from AppConfig, performing Query...");
 
        java.util.List a = aeo.query(lPerson, p2p4BpQuery);
        logger.info("[PasswordSyncCommand.getBasicPerson] Executed Query...");
 
        StringBuffer results = new StringBuffer();
        if (a.size() == 0) {
          logger.info("[PasswordSyncCommand.getBasicPerson] No rows found matching the query.");
          return null;
        }
        else {
          BasicPerson bp = (BasicPerson)a.get(0);
          return bp;
        }
  }
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(NET_ID);
      EnterpriseUser entUser = (EnterpriseUser)getAppConfig().getObject(ENTERPRISE_USER);
      BasicPerson person = (BasicPerson)getAppConfig().getObject(BASIC_PERSON);
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      // An error occurred retrieving a required object from AppConfig. Log it
      // and throw an exception.
      String errMsg = "An error occurred retrieving a required object from " +
View Full Code Here

TOP

Related Classes of com.any_erp_vendor.moa.jmsobjects.person.v1_0.BasicPerson

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.