Package com.centraview.contact.individual

Examples of com.centraview.contact.individual.IndividualVO


      if (isEntity) {
        EntityVO entityVO = remote.getEntity(contactID);
        contactObject = entityVO;
        dynaForm.set("name", entityVO.getName());
      } else {
        IndividualVO individualVO = remote.getIndividual(contactID);
        contactObject = individualVO;
        dynaForm.set("name", individualVO.getFirstName() + " " + individualVO.getLastName());
      }
      request.setAttribute("rowId", new String[] { Integer.toString(contactID) });
      String[] primaryEmailAddress = (String[])dynaForm.get("primaryEmailAddress");
      String[] primaryPhoneNumbers = (String[])dynaForm.get("primaryPhoneNumbers");
      // Putting the phone numbers in an arraylist because it's a bit easier to
View Full Code Here


   *
   * @return
   */
  private IndividualVO getIndividualVO(int individualID)
  {
    IndividualVO individualVO = new IndividualVO();
    try
    {
      InitialContext ic = new InitialContext();
      IndividualLocalHome home = (IndividualLocalHome)
        ic.lookup("local/Individual");
      IndividualLocal remote =  home.findByPrimaryKey(
        new IndividualPK(individualID, this.dataSource));
      individualVO = remote.getIndividualVOWithBasicReferences();
    } //end of try block
    catch (Exception e)
    {
      //Give empty information
      individualVO.setContactID(individualID);
      individualVO.setFirstName("");
      individualVO.setLastName("");
      System.out.println("[Exception] AdvancedSearchEJB.getIndividualVO: "
        + e.toString());
      //e.printStackTrace();
    } //end of catch block (Exception)
    return individualVO;
View Full Code Here

    try {
      Integer rowId = new Integer(request.getParameter("selectId"));

      DynaActionForm dynaForm = (DynaActionForm)form;

      IndividualVO individualVO = null;
      AddressVO primaryAdd = null;

      ContactFacade remote = cfh.create();
      remote.setDataSource(dataSource);
      individualVO = remote.getIndividual(rowId.intValue());

      if (individualVO.getFirstName() != null) {
        dynaForm.set("firstName", individualVO.getFirstName());
        dynaForm.set("lastName", individualVO.getLastName());
        dynaForm.set("middleInitial", individualVO.getMiddleName());
      }

      if (individualVO.getEntityID() != 0) {
        dynaForm.set("entityId", new Integer(individualVO.getEntityID()));
      }

      if (individualVO.getTitle() != null) {
        dynaForm.set("title", individualVO.getTitle());
      }

      if (individualVO.getExternalID() != null) {
        dynaForm.set("id2", individualVO.getExternalID());
      }

      if (individualVO.getSourceName() != null) {
        dynaForm.set("sourceName", individualVO.getSourceName());
      }

      if (individualVO.getSource() > 0) {
        dynaForm.set("sourceId", new Integer(individualVO.getSource()));
      }

      if (individualVO.getContactID() != 0) {
        dynaForm.set("individualId", new Integer(individualVO.getContactID()));
      }

      request.setAttribute("marketingListId", new Integer(individualVO.getList()));
      Collection mocList = individualVO.getMOC();
      Iterator iterator = mocList.iterator();
      int count = 1;

      while (iterator.hasNext()) {
        MethodOfContactVO moc = (MethodOfContactVO)iterator.next();
        if (moc.getMocType() == 1 && moc.getIsPrimary().equalsIgnoreCase("YES")) {
          // this is for email
          dynaForm.set("email", moc.getContent());
          dynaForm.set("emailId", new Integer(moc.getMocID()).toString());
        } else if (count < 4 && moc.getMocType() != 1) {
          dynaForm.set("mocType" + count, new Integer(moc.getMocType()).toString());
          String mocContent = moc.getContent();
          String mocContentValue = "";
          String mocContentExt = "";
          if (mocContent.indexOf("EXT") != -1) {
            String tempContent = mocContent;
            mocContentValue = tempContent.substring(0, tempContent.indexOf("EXT"));
            mocContentExt = tempContent.substring(tempContent.indexOf("EXT") + 3, tempContent
                .length());
          } else {
            mocContentValue = mocContent;
          }

          dynaForm.set("mocContent" + count, mocContentValue);
          dynaForm.set("mocExt" + count, mocContentExt);
          dynaForm.set("mocId" + count, String.valueOf(moc.getMocID()));
          count++;
        }
      }

      primaryAdd = individualVO.getPrimaryAddress();
      if (primaryAdd != null) {
        if (primaryAdd.getAddressID() != 0) {
          dynaForm.set("addressId", new Integer(primaryAdd.getAddressID()));
        }
        if (primaryAdd.getStreet1() != null) {
View Full Code Here

          "com.centraview.contact.contactfacade.ContactFacadeHome", dataSource);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    IndividualVO individualVO = contactFacade.getIndividual(Integer.parseInt(viewIndividualId));
    individualVO.populateFormBean(individualForm);
    // Now we need to get the custom field stuff because it doesn't live on the
    // individualVO even though there is a nice space for it there
    CustomField customField = null;
    try {
      customField = (CustomField)CVUtility.setupEJB("CustomField",
          "com.centraview.customfield.CustomFieldHome", dataSource);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    // Only 8 custom fields fit on the detail screen so we have to pull only the
    // first 8 out.
    TreeMap customFieldMap = customField.getCustomFieldData("Individual", individualVO
        .getContactID());
    Collection customFieldValues = customFieldMap.values();
    int arraySize = customFieldValues.size() > 8 ? 8 : customFieldValues.size();
    CustomFieldVO[] fieldArray = new CustomFieldVO[arraySize];
    Iterator i = customFieldValues.iterator();
    int count = 0;
    while (i.hasNext() && count < 8) {
      fieldArray[count++] = (CustomFieldVO)i.next();
    }
    individualForm.set("customFields", fieldArray);
    // Useful Stuff for the request (common things for every type of screen so
    // we don't have to program for each different form bean)
    request.setAttribute("recordType", "Individual");
    request.setAttribute("recordName", individualVO.getFullName());
    request.setAttribute("recordId", viewIndividualId);
    request.setAttribute("dynamicTitle", individualVO.getFullName());
    request.setAttribute("parentId", new Integer(individualVO.getEntityID()));
    request.setAttribute("parentName", individualVO.getEntityName());
    request.setAttribute("marketingList", new Integer(individualVO.getList()));
    individualForm.set("mocTypeList", Globals.MOC_TYPE);
    // end getting the data together for the main window.
    // if we clicked copy to, then show this data on the simple copyto jsp.
    if (request.getParameter("copyTo") != null) {
      return mapping.findForward(".view.contact.copyto");
View Full Code Here

          count++;
        }
      }

      AddressVO primaryAdd = entityVO.getPrimaryAddress();
      IndividualVO individualVO = entityVO.getIndividualVO();

      if (individualVO.getFirstName() != null) {
        dynaForm.set("pcFirstName", individualVO.getFirstName());
      }

      if (individualVO.getMiddleName() != null) {
        dynaForm.set("pcMiddleInitial", individualVO.getMiddleName());
      }

      if (individualVO.getLastName() != null) {
        dynaForm.set("pcLastName", individualVO.getLastName());
      }

      if (individualVO.getTitle() != null) {
        dynaForm.set("pcTitle", individualVO.getTitle());
      }

      if (primaryAdd != null) {
        if (primaryAdd.getStreet1() != null) {
          dynaForm.set("street1", primaryAdd.getStreet1());
        }

        if (primaryAdd.getStreet2() != null) {
          dynaForm.set("street2", primaryAdd.getStreet2());
        }

        if (primaryAdd.getCity() != null) {
          dynaForm.set("city", primaryAdd.getCity());
        }

        if (primaryAdd.getStateName() != null) {
          dynaForm.set("state", primaryAdd.getStateName());
        }

        if (primaryAdd.getZip() != null) {
          dynaForm.set("zip", primaryAdd.getZip());
        }

        if (primaryAdd.getCountryName() != null) {
          dynaForm.set("country", primaryAdd.getCountryName());
        }

        if (primaryAdd.getWebsite() != null) {
          dynaForm.set("website", primaryAdd.getWebsite());
        }

        dynaForm.set("addressId", new Integer(primaryAdd.getAddressID()));
      }

      if (entityVO.getSourceName() != null) {
        dynaForm.set("sourceName", entityVO.getSourceName());
      }

      if (entityVO.getSource() > 0) {
        dynaForm.set("sourceId", new Integer(entityVO.getSource()));
      }

      request.setAttribute("marketingListId", new Integer(entityVO.getList()));

      dynaForm.set("pcIndividualId", new Integer(individualVO.getContactID()));
      dynaForm.set("entityId", new Integer(entityVO.getContactID()));
      dynaForm.set("accountManagerId", new Integer(entityVO.getAccManager()));
      dynaForm.set("accountManagerName", entityVO.getAcctMgrName());
      dynaForm.set("accountTeamId", new Integer(entityVO.getAccTeam()));
      dynaForm.set("accountTeamName", entityVO.getAcctTeamName());
View Full Code Here

      ModuleFieldRightMatrix rightsMatrix = userObject.getUserPref().getModuleAuthorizationMatrix();
      HashMap indivFieldRights = rightsMatrix.getFieldRights("Individual");
      HashMap entityFieldRights = rightsMatrix.getFieldRights("Entity");

      IndividualVO individualVO = new IndividualVO();
      IndividualVO individualCurrent = remote.getIndividual(contactID);

      individualVO.setContactID(contactID);
     
      String companyName = (String)contactForm.get("companyName");
      if (companyName != null) {
        if (! companyName.equals("")) {
          // first, check to see if a entity with a matching name exists
          // if yes, then associate this invidivual with that entity
          // if no, then create a new entity, and associate this individual with that entity
          SyncFacadeHome syncHome = (SyncFacadeHome)CVUtility.getHomeObject("com.centraview.syncfacade.SyncFacadeHome", "SyncFacade");
          com.centraview.syncfacade.SyncFacade sfremote = (com.centraview.syncfacade.SyncFacade)syncHome.create();
          sfremote.setDataSource(dataSource);
         
          int newEntityID = sfremote.findCompanyNameMatch(companyName, individualID);

          individualVO.setEntityID(newEntityID);
        }else{
          individualVO.setEntityID(individualCurrent.getEntityID());
        }
      }

      String firstName = (String)contactForm.get("firstName");
      if (firstName != null && ! firstName.equals("") && ((Integer)indivFieldRights.get("firstname")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
        individualVO.setFirstName(firstName);
      }else{
        individualVO.setFirstName(individualCurrent.getFirstName());
      }


      String MI = (String)contactForm.get("MI");
      if (MI != null && ! MI.equals("") && ((Integer)indivFieldRights.get("middlename")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
        individualVO.setMiddleName(MI);
      }else{
        individualVO.setMiddleName(individualCurrent.getMiddleName());
      }

      String lastName = (String)contactForm.get("lastName");
      if (lastName != null && ! lastName.equals("") && ((Integer)indivFieldRights.get("lastname")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
        individualVO.setLastName(lastName);
      }else{
        individualVO.setLastName(individualCurrent.getLastName());
      }

      String title = (String)contactForm.get("title");
      if (title != null && ! title.equals("") && ((Integer)indivFieldRights.get("title")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
        individualVO.setTitle(title);
      }else{
        individualVO.setTitle(individualCurrent.getTitle());
      }

      String primaryContact = (String)contactForm.get("primaryContact");
      if (primaryContact != null) { // && ((Integer)indivFieldRights.get("primarycontact")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT)
        if (primaryContact.equals("YES") || primaryContact.equals("NO")) {
          individualVO.setIsPrimaryContact(primaryContact);
        }
      }else{
        individualVO.setIsPrimaryContact(individualCurrent.getIsPrimaryContact());
      }
     
      AddressVO primaryAddress = individualCurrent.getPrimaryAddress();
     
      if (primaryAddress == null) {
        primaryAddress = new AddressVO();
      }
      primaryAddress.setIsPrimary("YES");

      if (((Integer)indivFieldRights.get("address")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
        String street1 = (String)contactForm.get("street1");
        if ((street1 != null) && (! street1.equals(""))) {
          primaryAddress.setStreet1(street1);
        }
       
        String street2 = (String)contactForm.get("street2");
        if ((street2 != null) && (! street2.equals(""))) {
          primaryAddress.setStreet2(street2);
        }
       
        String city = (String)contactForm.get("city");
        if ((city != null) && (! city.equals(""))) {
          primaryAddress.setCity(city);
        }
       
        String state = (String)contactForm.get("state");
        if ((state != null) && (!state.equals(""))) {
          primaryAddress.setStateName(state);
        }

        String zipCode = (String)contactForm.get("zipCode");
        if ((zipCode != null) && (! zipCode.equals(""))) {
          primaryAddress.setZip(zipCode);
        }

        String country = (String)contactForm.get("country");
        if ((country != null) && (!country.equals(""))) {
          primaryAddress.setCountryName(country);
        }
       
        individualVO.setPrimaryAddress(primaryAddress);

      }   // end if (((Integer)indivFieldRights.get("address")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT)

      if (((Integer)indivFieldRights.get("contactmethod")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
        // get the current MOC values from the individualCurrent MOC
        // save them in String variables for use below
        String currentWorkPhone   = new String("");
        String currentHomePhone   = new String("");
        String currentFaxPhone    = new String("");
        String currentOtherPhone  = new String("");
        String currentMainPhone   = new String("");
        String currentPagerPhone  = new String("");
        String currentMobilePhone = new String("");
        String currentEmail       = new String("");

        MethodOfContactVO currentWorkVO = null;
        MethodOfContactVO currentHomeVO = null;
        MethodOfContactVO currentFaxVO = null;
        MethodOfContactVO currentOtherVO = null;
        MethodOfContactVO currentMainVO = null;
        MethodOfContactVO currentPagerVO = null;
        MethodOfContactVO currentMobileVO = null;
        MethodOfContactVO currentEmailVO = null;

        Vector currentMOCs = individualCurrent.getMOC();
        if (currentMOCs != null) {
          Enumeration e = currentMOCs.elements();
          while (e.hasMoreElements()) {
            MethodOfContactVO mocVO = (MethodOfContactVO)e.nextElement();
            String syncAs = mocVO.getSyncAs();
View Full Code Here

  {
    String dataSource = Settings.getInstance().getSiteInfo(
        CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    DynaActionForm individualForm = (DynaActionForm)form;
    // The individualVOX takes the form and converts it to a VO
    IndividualVO individualVO = new IndividualVOX(form, request, dataSource);
    HttpSession session = request.getSession(true);
    UserObject userobject = (UserObject)session.getAttribute("userobject");
    int individualId = userobject.getIndividualID();
    individualVO.setModifiedBy(individualId);
    ContactFacade contactFacade = null;
    try {
      contactFacade = (ContactFacade)CVUtility.setupEJB("ContactFacade",
          "com.centraview.contact.contactfacade.ContactFacadeHome", dataSource);
    } catch (Exception e) {
      throw new ServletException(e);
    }
    ActionForward forward = null;
    StringBuffer path = new StringBuffer();
    // Decide if we are updating an existing or creating a new individual
    if (individualVO.getContactID() < 1) {
      String marketingListSession = (String)session.getAttribute("dbid");
      int marketingList = 1;
      try {
        marketingList = Integer.valueOf(marketingListSession).intValue();
      } catch (NumberFormatException nfe) {}
      individualVO.setList(marketingList);
      individualVO.setCreatedBy(individualId);
      int newIndividualId = 0;
      try {
        newIndividualId = contactFacade.createIndividual(individualVO, individualId);
      } catch (Exception e) {
        logger.error("[execute] Exception thrown.", e);
        throw new ServletException(e);
      }
      if (request.getParameter("new") != null) {
        path.append(mapping.findForward("newIndividual").getPath());
        path.append(individualVO.getList());
        path.append("&entityNo=");
        path.append(individualVO.getEntityID());
        path.append("&entityName=");
        path.append(individualVO.getEntityName());
        forward = new ActionForward(path.toString(), true);
      } else {
        path.append(mapping.findForward("viewIndividual").getPath());
        path.append(newIndividualId);
        path.append("&closeWindow=false");
        forward = new ActionForward(path.toString(), true);
      }
    } else {
      try {
        contactFacade.updateIndividual(individualVO, individualId);
      } catch (Exception e) {
        logger.error("[execute] Exception thrown.", e);
        throw new ServletException(e);
      }
      path.append(mapping.findForward("viewIndividual").getPath());
      path.append(individualVO.getContactID());
      path.append("&closeWindow=");
      path.append(individualForm.get("closeWindow"));
      forward = new ActionForward(path.toString(), true);
    }
    return forward;
View Full Code Here

        saveErrors(request, allErrors);
        session.removeAttribute("listErrorMessage");
      }
      GroupVO groupVO = remote.getGroup(individualId, Integer.parseInt(row));
      DynaActionForm dynaForm = (DynaActionForm)form;
      IndividualVO ivo = remote.getIndividual(groupVO.getOwner());
      if (ivo != null) {
        dynaForm.set("ownerName", new String(ivo.getFirstName() + " " + ivo.getLastName()));
      }
      ivo = null;
      dynaForm.set("groupname", groupVO.getGroupName());
      dynaForm.set("groupdescription", groupVO.getDescription());
      dynaForm.set("groupid", (new Integer(groupVO.getGroupID())).toString());
View Full Code Here

    // in a field.  (ContactVO.getMOC())
    ArrayList methodOfContactVOs = new ArrayList();
    ArrayList entityIds = new ArrayList();
    for (int i = 0; i < individualVOs.size(); i++)
    {
      IndividualVO current = (IndividualVO)individualVOs.get(i);
      methodOfContactVOs.addAll(current.getMOC());
      // collect a list of unique entity Ids among the Individuals
      int entityId = current.getEntityID();
      if (entityId > 0 && !entityIds.contains(String.valueOf(entityId)))
      {
        entityIds.add(String.valueOf(entityId));
      }
    }
    // Get the EntityVOs
    ArrayList entityVOs = new ArrayList();
    if (entityIds.size() > 0)
    {
      String[] entityIdArray = (String[])entityIds.toArray(new String[entityIds.size()]);
      entityVOs = MergeUtil.getEntityVOs(entityIdArray, dataSource);
    }

    // only the primary address is in the ContactVO so we have to get them all.
    int mergeType = searchResult.getMergeType();
    ArrayList addressVOs = MergeUtil.getAddressVOs(mergeIdArray, mergeType, dataSource);
    // The customfields are in the ContactVO too.
    // TODO merge custom fields

    // Populate the form with the information.
    DynaActionForm mergeIndividualDetails = (DynaActionForm)form;
    ArrayList nameCollection = new ArrayList();
    ArrayList idCollection = new ArrayList();
    ArrayList id2Collection = new ArrayList();
    ArrayList entityNameCollection = new ArrayList();
    ArrayList sourceCollection = new ArrayList();
    ArrayList methodOfContactCollection = new ArrayList();
    ArrayList addressCollection = new ArrayList();
    ArrayList marketingListCollection = new ArrayList();

  ArrayList rawMarketingList = new ArrayList();
  ContactFacadeHome contactFacadeHome = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
  try
  {
    ContactFacade remoteContactFacade = contactFacadeHome.create();
    remoteContactFacade.setDataSource(dataSource);
    rawMarketingList = (ArrayList)remoteContactFacade.getAllMarketingList();
  } catch (Exception e) {
    logger.error("[Exception] IndividualMergeDetail.Execute Handler ", e);
    throw new ServletException(e);
  }
  for(int i = 0; i < rawMarketingList.size(); i++)
  {
    HashMap currentList = (HashMap)rawMarketingList.get(i);
    marketingListCollection.add(new LabelValueBean((String)currentList.get("title"), ((Number)currentList.get("listid")).toString()));
  }

    for (int i = 0; i < individualVOs.size(); i++)
    {
      // build up the collections with the unique values from each VO.
      IndividualVO individual = (IndividualVO)individualVOs.get(i);
      String middleName = individual.getMiddleName();
      if(middleName != null && !middleName.equals("")){
        middleName += middleName + ". ";
      }
      else{
        middleName = "";
      }
      String individualName = individual.getFirstName() + " " + middleName + individual.getLastName();
      LabelValueBean currentName = new LabelValueBean(individualName, String.valueOf(i));
      boolean flag = false;
      for (int j = 0; !flag && (j < nameCollection.size()); j++)
      {
        if(((LabelValueBean)nameCollection.get(j)).getLabel().equals(currentName.getLabel()))
        {
          flag = true;
        }
      }
      if (!flag)
      {
        nameCollection.add(currentName);
      }

      LabelValueBean currentId = new LabelValueBean(String.valueOf(individual.getContactID()), String.valueOf(individual.getContactID()));
      idCollection.add(currentId);

      String currentId2String = individual.getExternalID();
      LabelValueBean currentId2 = new LabelValueBean(currentId2String, String.valueOf(i));
      boolean flag2 = false;
      for (int j = 0; !flag2 && (j < id2Collection.size()); j++)
      {
        String id2CollectionLabel = ((LabelValueBean)id2Collection.get(j)).getLabel();
        if((currentId2String == null) || // if string is null for some reason
           (currentId2String.length() == 0) || // if the length == 0
           (id2CollectionLabel.equals(currentId2String))) // if it is equal to an existing one
        {
          flag2 = true; // Don't add it.
        } // end if
      } // end for (int j = 0; j < id2Collection.size(); j++)
      if (!flag2)
      {
        id2Collection.add(currentId2);
      }

      LabelValueBean currentSource = new LabelValueBean(individual.getSourceName(), String.valueOf(individual.getSource()));
      if(!sourceCollection.contains(currentSource) &&
          !(currentSource.getValue().equals("") || currentSource.getLabel().equals("")))
      {
        sourceCollection.add(currentSource);
      }
View Full Code Here

      }
    }

    taskForm.setPercentComplete(taskVO.getPercentComplete() + "%");

    IndividualVO ivo = taskVO.getCreatedByVO();

    if (ivo != null)
    {
      taskForm.setCreated(ivo.getFirstName() + " " + ivo.getLastName());
      request.setAttribute("createdby", ivo);
    }

    ivo = taskVO.getModifiedByVO();

    if (ivo != null)
    {
      taskForm.setModified(ivo.getFirstName() + " " + ivo.getLastName());
      request.setAttribute("modifiedby", ivo);
    }

    taskForm.setManager(taskVO.getIndividualName());
    taskForm.setManagerID("" + taskVO.getIndividualID());
View Full Code Here

TOP

Related Classes of com.centraview.contact.individual.IndividualVO

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.