Package com.centraview.contact.entity

Examples of com.centraview.contact.entity.EntityVO


      ContactFacade remote = aa.create();
      remote.setDataSource(dataSource);

      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());
      }
View Full Code Here


    ContactFacadeHome aa = (ContactFacadeHome)CVUtility.getHomeObject(
        "com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");

    try {
      EntityVO entityVO = new EntityVO();

      String rowId[] = null;

      if (request.getParameterValues("selectId") != null) {
        rowId = request.getParameterValues("selectId");
      } else {
        rowId[0] = new String(request.getParameter(Constants.PARAMID));
      }

      ContactFacade remote = aa.create();
      remote.setDataSource(dataSource);

      entityVO = remote.getEntity(Integer.parseInt(rowId[0]));
      DynaActionForm dynaForm = (DynaActionForm)form;

      dynaForm.set("entityName", entityVO.getName());

      Collection mocList = entityVO.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, new Integer(moc.getMocID()).toString());
          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());
      request.setAttribute(Constants.ENTITYVO, entityVO);
      returnStatus = "success";
    } catch (Exception e) {
      logger.error("[Exception] DuplicateEntityHandler.Execute Handler ", e);
    }
View Full Code Here

    int individualId = userobject.getIndividualID();

    ActionMessages allErrors = new ActionMessages();

    DynaActionForm entityForm = (DynaActionForm)form;
    EntityVO entityVO = new EntityVOX(form, request, dataSource);

    String entityName = entityVO.getName();
    if (entityName == null || entityName.length() <= 0) {
      allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField",
          "Entity Name"));
    }

    entityVO.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
    if (entityVO.getContactID() < 1) {
      // set the creator
      entityVO.setCreatedBy(individualId);
      // if necessary the account manager
      if (entityVO.getAccManager() < 1) {
        entityVO.setAccManager(individualId);
      }
      String marketingListSession = (String)session.getAttribute("dbid");
      int marketingList = 1;
      try {
        marketingList = Integer.valueOf(marketingListSession).intValue();
      } catch (NumberFormatException nfe) {}

      entityVO.setList(marketingList);

      if (!allErrors.isEmpty()) {
        // if there were any validation errors, show the
        // new entity form again, with error messages...
        this.saveErrors(request, allErrors);
        return mapping.findForward(".view.contact.new_entity");
      }

      int newEntityId = contactFacade.createEntity(entityVO, individualId);

      if (request.getParameter("new") != null) {
        path.append(mapping.findForward("newEntity").getPath());
        path.append(entityVO.getList());
        forward = new ActionForward(path.toString(), true);
      } else {
        path.append(mapping.findForward("viewEntity").getPath());
        path.append(newEntityId);
        path.append("&closeWindow=false");
        forward = new ActionForward(path.toString(), true);
      }
    } else {
      try {
        contactFacade.updateEntity(entityVO, individualId);
      } catch (Exception e) {
        logger.error("[execute] Exception thrown.", e);
        throw new ServletException(e);
      }
      path.append(mapping.findForward("viewEntity").getPath());
      path.append(entityVO.getContactID());
      path.append("&closeWindow=");
      path.append(entityForm.get("closeWindow"));
      forward = new ActionForward(path.toString(), true);
    }
    return forward;
View Full Code Here

    String[] rowId = null;
    String viewEntityId = "";
    HttpSession session = request.getSession();
    UserObject user = (UserObject)session.getAttribute("userobject");
    int individualId = user.getIndividualID();
    EntityVO entityVO = new EntityVO();
    // passing selected row id
    if (request.getParameterValues("rowId") != null) {
      String[] selectedRowId = request.getParameterValues("rowId");
      StringTokenizer parseSelectedId = new StringTokenizer(selectedRowId[0], ",");
      int countOfRowId = parseSelectedId.countTokens();
      rowId = new String[countOfRowId];
      int i = 0;
      while (parseSelectedId.hasMoreTokens()) {
        rowId[i] = parseSelectedId.nextToken().toString();
        i++;
      }
      if (rowId.length > 0) {
        viewEntityId = rowId[0];
      }
    } else {
      viewEntityId = new String(request.getParameter("entityLinkId"));
    } // end if (request.getParameterValues("rowId") != null)
    ContactFacade contactFacade = null;
    try {
      contactFacade = (ContactFacade)CVUtility.setupEJB("ContactFacade",
          "com.centraview.contact.contactfacade.ContactFacadeHome", dataSource);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    entityVO = contactFacade.getEntity(Integer.parseInt(viewEntityId));
    DynaActionForm entityForm = (DynaActionForm)form;
    entityVO.populateFormBean(entityForm);

    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("Entity", entityVO.getContactID());
    Collection customFieldValues = customFieldMap.values();
    int arraySize = customFieldValues.size() > 4 ? 4 : customFieldValues.size();
    CustomFieldVO[] fieldArray = new CustomFieldVO[arraySize];
    Iterator i = customFieldValues.iterator();
    int count = 0;
    while (i.hasNext() && count < 4) {
      fieldArray[count++] = (CustomFieldVO)i.next();
    }
    entityForm.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", "Entity");
    request.setAttribute("recordName", entityVO.getName());
    request.setAttribute("recordId", viewEntityId);
    request.setAttribute("dynamicTitle", entityVO.getName());
    request.setAttribute("parentId", new Integer(entityVO.getList()));
    request.setAttribute("parentName", "");
    request.setAttribute("marketingList", new Integer(entityVO.getList()));
    // 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");
    }
    // Right Nav stuff
View Full Code Here

    for (int i = 0; i < entityVOs.size(); i++)
    {
      // Add the Entity Id onto the end of the Label so users can have that
      // information available to guide their choices.
      EntityVO current = (EntityVO)entityVOs.get(i);
      String entityName = current.getName() + " ID: " +current.getContactID();
      LabelValueBean entityLabel = new LabelValueBean(entityName, String.valueOf(current.getContactID()));
      entityNameCollection.add(entityLabel);
    }

    mergeIndividualDetails.set("nameCollection", nameCollection);
    mergeIndividualDetails.set("idCollection", idCollection);
View Full Code Here

      marketingListCollection.add(new LabelValueBean((String)currentList.get("title"), ((Number)currentList.get("listid")).toString()));
    }
   
    for (int i = 0; i < entityVOs.size(); i++) {
      // build up the collections with the unique values from each VO.
      EntityVO entity = (EntityVO)entityVOs.get(i);
      LabelValueBean currentName = new LabelValueBean(entity.getName(), 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(entity.getContactID()), String.valueOf(entity.getContactID()));
      idCollection.add(currentId);

      String currentId2String = entity.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.
        }
      }

      if (!flag2) {
        id2Collection.add(currentId2);
      }
     
      LabelValueBean currentAccountManager = new LabelValueBean(entity.getAcctMgrName(), String.valueOf(entity.getAccManager()));
      if (!accountManagerCollection.contains(currentAccountManager) &&
          !(currentAccountManager.getValue().equals("0") || currentAccountManager.getLabel().equals(""))) {
        accountManagerCollection.add(currentAccountManager);
      }
     
      LabelValueBean currentAccountTeam = new LabelValueBean(entity.getAcctTeamName(), String.valueOf(entity.getAccTeam()));
      if (!accountTeamCollection.contains(currentAccountTeam) &&
          !(currentAccountTeam.getValue().equals("0") || currentAccountTeam.getLabel().equals(""))) {
        accountTeamCollection.add(currentAccountTeam);
      }
     
      LabelValueBean currentSource = new LabelValueBean(entity.getSourceName(), String.valueOf(entity.getSource()));
      if (!sourceCollection.contains(currentSource) &&
          !(currentSource.getValue().equals("") || currentSource.getLabel().equals(""))) {
        sourceCollection.add(currentSource);
      }
    } // end for(int i = 0; i < entityVOs.size(); i++)
View Full Code Here

      Vector stateList = cfRemote.getStates();
      Vector countryList = cfRemote.getCountry();

      String OwningEntity="";

      EntityVO entityVO = cfRemote.getEntity(1);



      if (entityVO  != null)
      {
        AddressVO primaryAdd       = entityVO.getPrimaryAddress();
        OwningEntity= OwningEntity + "<p><font face=\"Arial, Helvetica, sans-serif\"><strong>" +entityVO.getName()+"</strong><br>\n";
        if (primaryAdd != null)
        {
          if (primaryAdd.getStreet1() != null)
          {
            OwningEntity= OwningEntity+ primaryAdd.getStreet1()+"<BR>\n";
          }
         
          if (primaryAdd.getStreet2() != null)
          {
            OwningEntity= OwningEntity+ primaryAdd.getStreet2()+"<BR>\n";
          }
         
          if (primaryAdd.getCity() != null)
          {
            OwningEntity=OwningEntity + primaryAdd.getCity()+", ";
          }


          String state = primaryAdd.getStateName();
                    if (state != null){
              OwningEntity=OwningEntity + state+" ";
                    }

          if (primaryAdd.getZip() != null)
          {
            OwningEntity=OwningEntity + primaryAdd.getZip()+"<BR>";
          }

          String country = primaryAdd.getCountryName();

                    if (country != null)
          {
              OwningEntity= OwningEntity + country+"<BR>";
                    }

          String Email = "";

          String Phone = "";

          Collection mocList = entityVO.getMOC();
          Iterator iterator = mocList.iterator();
          int count = 1;
          while (iterator.hasNext())
          {
            MethodOfContactVO moc = (MethodOfContactVO)iterator.next();
View Full Code Here

    MergedIndividualConfirmationBean mergedIndividualBean = (MergedIndividualConfirmationBean)session.getAttribute("mergedIndividual");
   
    // populate the individualVO
    int entityID = mergedIndividualBean.getEntityID();
   
    EntityVO entityVO = null;
    for (int i = 0; (entityVO == null) && (i < entityVOs.size()); i++) {
      EntityVO current = (EntityVO)entityVOs.get(i);
      if (current.getContactID() == entityID) {
        entityVO = current;
      }
    }
   
    int listID = mergedIndividualBean.getListID();
View Full Code Here

      remoteContactFacade.setDataSource(dataSource);
      for (int i = 0; i < mergeIds.length; i++)
      {
        try
        {
          EntityVO entityVO = remoteContactFacade.getEntity(Integer.parseInt(mergeIds[i]));
          entityVOs.add(entityVO);
        } catch (NumberFormatException nfe) {} // only increment if there is actually an entityId
      }
    }
    catch (Exception e)
View Full Code Here

    ArrayList individualVOs = (ArrayList)mergeEntityDetails.get("individualVOs");
    ArrayList addressVOs = (ArrayList)mergeEntityDetails.get("addressVOs");
    ArrayList methodOfContactVOs = (ArrayList)mergeEntityDetails.get("methodOfContactVOs");

    // get the EntityVO for the matching id we picked.  To serve as a starting point.
    EntityVO survivor = null;
    int entityId = Integer.parseInt(idSelect);
    for (int i = 0; (survivor == null) && (i < entityVOs.size()); i++) {
      EntityVO current = (EntityVO)entityVOs.get(i);
      if (current.getContactID() == entityId) {
        survivor = current;
      }
    }

    // Now we have our survivor, lets update the fields.

    IndividualVO primaryContact = null;
    int primaryContactId = 0;
    for (int i = 0; (primaryContact == null) && (i < individualVOs.size()); i++) {
      IndividualVO current = (IndividualVO)individualVOs.get(i);
      if (current.getContactID() == Integer.parseInt(primaryContactSelect)) {
        primaryContact = current;
        primaryContactId = current.getContactID();
        primaryContact.setEntityID(entityId);
      }
    }

    // Time to start using the EJB layer
    ContactFacade remoteContactFacade = null;
    ContactFacadeHome contactFacadeHome = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
    try {
      remoteContactFacade = contactFacadeHome.create();
      remoteContactFacade.setDataSource(dataSource);
    } catch (Exception e) {
      logger.error("[Exception] EntityMerge.Execute Handler ", e);
      throw new ServletException(e);
    }

    ArrayList addressCheckList = new ArrayList();
    for (int i = 0; i < addressCheckBox.length; i++) {
      int addressId = Integer.parseInt(addressCheckBox[i]);
      addressCheckList.add(addressId+"");
      remoteContactFacade.changeAddressRelate(addressId, entityId, contactType);
    }

    // delete un-used addresses
    // Of course only delete the ones that weren't selected
    // thats what all the following convoluted code does
    for (int i = 0; i < addressVOs.size(); i++) {
      int currentId = ((AddressVO)addressVOs.get(i)).getAddressID();
      if (!addressCheckList.contains(currentId+"")) {
        try {
          remoteContactFacade.deleteAddress(currentId, entityId, individualId);
        } catch (RemoteException re) {
          logger.error("[Exception] EntityMerge.Execute Handler ", re);
        } catch (AuthorizationFailedException afe) {
          logger.error("[Exception] EntityMerge.Execute Handler ", afe);
        }
      }
    }

    ArrayList methodOfContactCheckList = new ArrayList();
    for (int i = 0; i < methodOfContactCheckBox.length; i++) {
      int mocId = Integer.parseInt(methodOfContactCheckBox[i]);
      methodOfContactCheckList.add(mocId+"");
      remoteContactFacade.changeMOCRelate(mocId, entityId, contactType);
    }

    // delete un-used mocs.
    // Of course only delete the ones that weren't selected
    // thats what all the following convoluted code does
    for (int i = 0; i < methodOfContactVOs.size(); i++) {
      int currentId = ((MethodOfContactVO)methodOfContactVOs.get(i)).getMocID();

      if (!methodOfContactCheckList.contains(currentId+"")) {
        try {
          remoteContactFacade.deleteMOC(currentId, entityId, individualId);
        } catch (RemoteException re) {
          logger.error("[Exception] EntityMerge.Execute Handler ", re);
        } catch (AuthorizationFailedException afe) {
          logger.error("[Exception] EntityMerge.Execute Handler ", afe);
        }
      }
    }
   
    MergedEntityConfirmationBean mergedEntityBean = (MergedEntityConfirmationBean)session.getAttribute("mergedEntity");
   
    int listID = mergedEntityBean.getListID();

    // populate the surviving VO
    survivor.setName(mergedEntityBean.getEntityName());
    survivor.setExternalID(mergedEntityBean.getId2());
    survivor.setAccManager(mergedEntityBean.getAccountManagerID());
    survivor.setAccTeam(mergedEntityBean.getAccountTeamID());
    survivor.setSource(mergedEntityBean.getSourceID());
    survivor.setSourceName(mergedEntityBean.getSourceName());
    survivor.setIndividualID(primaryContactId);
    survivor.setIndividualVO(primaryContact);
    survivor.setModifiedBy(individualId);
    survivor.setList(listID);
    survivor.clearMOC()// Don't make millions of MOCs


    // Move all Individuals to the surviving record.
    // I can either update the IndividualVOs and call update
    // Or do a DB query.  For now I am going to do the former, but we
    // maybe should update to do the latter, to save precious Compute
    // resources.  But for now this is cleaner.
    for (int i = 0; i < individualVOs.size(); i++) {
      IndividualVO current = (IndividualVO)individualVOs.get(i);
      current.setEntityID(entityId);
      current.setList(listID);
      current.setIsPrimaryContact("NO");
     
      try {
        remoteContactFacade.updateIndividual(current, individualId);
      } catch (RemoteException re) {
        logger.error("[Exception] EntityMerge.Execute Handler ", re);
View Full Code Here

TOP

Related Classes of com.centraview.contact.entity.EntityVO

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.