Package com.centraview.contact.helper

Examples of com.centraview.contact.helper.MethodOfContactVO


        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();
            if (syncAs != null && (! syncAs.equals(""))) {
              if (syncAs.equals("Work")) {
                currentWorkPhone = mocVO.getContent();
                currentWorkVO = mocVO;
              }else if (syncAs.equals("Home")){
                currentHomePhone = mocVO.getContent();
                currentHomeVO = mocVO;
              }else if (syncAs.equals("Fax")){
                currentFaxPhone = mocVO.getContent();
                currentFaxVO = mocVO;
              }else if (syncAs.equals("Other")){
                currentOtherPhone = mocVO.getContent();
                currentOtherVO = mocVO;
              }else if (syncAs.equals("Main")){
                currentMainPhone = mocVO.getContent();
                currentMainVO = mocVO;
              }else if (syncAs.equals("Pager")){
                currentPagerPhone = mocVO.getContent();
                currentPagerVO = mocVO;
              }else if (syncAs.equals("Mobile")){
                currentMobilePhone = mocVO.getContent();
                currentMobileVO = mocVO;
              }   // end if (syncAs.equals("Work"))
            }else if (mocVO.getMocType() == 1 && mocVO.getIsPrimary().equals("YES")){
              currentEmail = mocVO.getContent();
              currentEmailVO = mocVO;
            }   // end if (syncAs != null && (! syncAs.equals("")))
          }   // end while (e.hasMoreElements())
        }   // end if (currentMOCS != null)


        Vector newMOCs = new Vector();

        // now, check to see what SyncAs values we were passed,
        // if a given value is not null, then check to see if
        // there is an existing value for that field in the db:
        // (check "currentXxxVO" where "Xxx" equals one of the
        // syncAs types [Work, Home, Fax, etc]). If currentXxxVO
        // is null, create a new MethodOfContactVO object, and set
        // the appropriate values, then add that object to the
        // individualVO using setMOC(). Else, update the "content"
        // field and updated field on the currentXxxVO, and pass
        // that object to individualVO.setMOC();
        String workPhone = (String)contactForm.get("workPhone");
        if (workPhone != null && (! workPhone.equals(""))) {
          if (currentWorkVO == null) {
            MethodOfContactVO workPhoneVO = new MethodOfContactVO();
            workPhoneVO.setContent(workPhone);
            workPhoneVO.setSyncAs("Work");
            workPhoneVO.setMocType(Constants.MOC_WORK);
            newMOCs.add(workPhoneVO);
          }else{
            currentWorkVO.setContent(workPhone);
            currentWorkVO.updated(true);
            currentWorkVO.added(false);
            currentWorkVO.delete(false);
            newMOCs.add(currentWorkVO);
          }
        }

        String homePhone = (String)contactForm.get("homePhone");
        if (homePhone != null && (! homePhone.equals(""))) {
          if (currentHomeVO == null) {
            MethodOfContactVO homePhoneVO = new MethodOfContactVO();
            homePhoneVO.setContent(homePhone);
            homePhoneVO.setSyncAs("Home");
            homePhoneVO.setMocType(Constants.MOC_HOME);
            newMOCs.add(homePhoneVO);
          }else{
            currentHomeVO.setContent(homePhone);
            currentHomeVO.updated(true);
            currentHomeVO.added(false);
            currentHomeVO.delete(false);
            newMOCs.add(currentHomeVO);
          }
        }

        String faxPhone = (String)contactForm.get("faxPhone");
        if (faxPhone != null && (! faxPhone.equals(""))) {
          if (currentFaxVO == null) {
            MethodOfContactVO faxPhoneVO = new MethodOfContactVO();
            faxPhoneVO.setContent(faxPhone);
            faxPhoneVO.setSyncAs("fax");
            faxPhoneVO.setMocType(Constants.MOC_FAX);
            newMOCs.add(faxPhoneVO);
          }else{
            currentFaxVO.setContent(faxPhone);
            currentFaxVO.updated(true);
            currentFaxVO.added(false);
            currentFaxVO.delete(false);
            newMOCs.add(currentFaxVO);
          }
        }
       
        String otherPhone = (String)contactForm.get("otherPhone");
        if (otherPhone != null && (! otherPhone.equals(""))) {
          if (currentOtherVO == null) {
            MethodOfContactVO otherPhoneVO = new MethodOfContactVO();
            otherPhoneVO.setContent(otherPhone);
            otherPhoneVO.setSyncAs("other");
            otherPhoneVO.setMocType(Constants.MOC_OTHER);
            newMOCs.add(otherPhoneVO);
          }else{
            currentOtherVO.setContent(otherPhone);
            currentOtherVO.updated(true);
            currentOtherVO.added(false);
            currentOtherVO.delete(false);
            newMOCs.add(currentOtherVO);
          }
        }

        String mainPhone = (String)contactForm.get("mainPhone");
        if (mainPhone != null && (! mainPhone.equals(""))) {
          if (currentMainVO == null) {
            MethodOfContactVO mainPhoneVO = new MethodOfContactVO();
            mainPhoneVO.setContent(mainPhone);
            mainPhoneVO.setSyncAs("main");
            mainPhoneVO.setMocType(Constants.MOC_MAIN);
            newMOCs.add(mainPhoneVO);
          }else{
            currentMainVO.setContent(mainPhone);
            currentMainVO.updated(true);
            currentMainVO.added(false);
            currentMainVO.delete(false);
            newMOCs.add(currentMainVO);
          }
        }

        String pagerPhone = (String)contactForm.get("pagerPhone");
        if (pagerPhone != null && (! pagerPhone.equals(""))) {
          if (currentPagerVO == null) {
            MethodOfContactVO pagerPhoneVO = new MethodOfContactVO();
            pagerPhoneVO.setContent(pagerPhone);
            pagerPhoneVO.setSyncAs("pager");
            pagerPhoneVO.setMocType(Constants.MOC_PAGER);
            newMOCs.add(pagerPhoneVO);
          }else{
            currentPagerVO.setContent(pagerPhone);
            currentPagerVO.updated(true);
            currentPagerVO.added(false);
            currentPagerVO.delete(false);
            newMOCs.add(currentPagerVO);
          }
        }

        String mobilePhone = (String)contactForm.get("mobilePhone");
        if (mobilePhone != null && (! mobilePhone.equals(""))) {
          if (currentMobileVO == null) {
            MethodOfContactVO mobilePhoneVO = new MethodOfContactVO();
            mobilePhoneVO.setContent(mobilePhone);
            mobilePhoneVO.setSyncAs("mobile");
            mobilePhoneVO.setMocType(Constants.MOC_MOBILE);
            newMOCs.add(mobilePhoneVO);
          }else{
            currentMobileVO.setContent(mobilePhone);
            currentMobileVO.updated(true);
            currentMobileVO.added(false);
            currentMobileVO.delete(false);
            newMOCs.add(currentMobileVO);
          }
        }

        String email = (String)contactForm.get("email");
        if (email != null && (! email.equals(""))) {
          if (currentEmailVO == null) {
            MethodOfContactVO emailVO = new MethodOfContactVO();
            emailVO.setContent(email);
            emailVO.setMocType(Constants.MOC_EMAIL);    // 1 == "email"
            emailVO.setIsPrimary("YES")// always set as the primary email address
            newMOCs.add(emailVO);
          }else{
            currentEmailVO.setContent(email);
            currentEmailVO.updated(true);
            currentEmailVO.added(false);
View Full Code Here


    } // end for (int i=0; i < addressVOs.size(); i++)

    // populate bean with all MOC vos
    for (int i = 0; i < methodOfContactVOs.size(); i++)
    {
      MethodOfContactVO moc = (MethodOfContactVO)methodOfContactVOs.get(i);
      StringBuffer mocLabel = new StringBuffer();
      mocLabel.append(moc.getMocTypeName());
      mocLabel.append(":&nbsp;");
      mocLabel.append(moc.getContent());
      LabelValueBean currentMOC = new LabelValueBean(mocLabel.toString(), String.valueOf(moc.getMocID()));
      methodOfContactCollection.add(currentMOC);
    } // end for (int i = 0; i < methodOfContactVOs.size(); i++)

    for (int i = 0; i < entityVOs.size(); i++)
    {
View Full Code Here

      addressCollection.add(currentAddress);
    } // end for (int i=0; i < addressVOs.size(); i++)
   
    // populate bean with all MOC vos
    for (int i = 0; i < methodOfContactVOs.size(); i++) {
      MethodOfContactVO moc = (MethodOfContactVO)methodOfContactVOs.get(i);
      StringBuffer mocLabel = new StringBuffer();
      mocLabel.append(moc.getMocTypeName());
      mocLabel.append(":&nbsp;");
      mocLabel.append(moc.getContent());
      LabelValueBean currentMOC = new LabelValueBean(mocLabel.toString(), String.valueOf(moc.getMocID()));
      methodOfContactCollection.add(currentMOC);
    } // end for (int i = 0; i < methodOfContactVOs.size(); i++)

    // populate bean with all related Individual vos
    for (int i = 0; i < individualVOs.size(); i++) {
View Full Code Here

          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
            {
              Email=moc.getContent()+"<BR>";
            }else if (moc.getMocType() != 1){
              if(moc.getContent() != null)
              {
                Phone=Phone+ moc.getContent()+" ";
              }
            }
          }
          OwningEntity = OwningEntity + Email+"<BR>";
          OwningEntity = OwningEntity+ Phone+"<BR>";
View Full Code Here

      // save email address
      String email = (String)contactForm.get("email");
      if (email != null && ! email.equals(""))
      {
        MethodOfContactVO emailVO = new MethodOfContactVO();
        emailVO.setContent(email);
        emailVO.setMocType(Constants.MOC_EMAIL);   // hardcoded to "Email" type
        emailVO.setIsPrimary("YES")// always set as the primary email address
        individualVO.setMOC(emailVO);
      }

      // set workPhone
      String workPhone = (String)contactForm.get("workPhone");
      String workPhoneExt = (String)contactForm.get("workPhoneExt");    // will be needed later for entity, maybe
      if (workPhone != null && ! workPhone.equals(""))
      {
        individualVO.setMOC(syncUtils.createNewPhoneMoc(workPhone, workPhoneExt, "Work",Constants.MOC_WORK));    // (content, ext, syncAs, mocType)
      }

      // set homePhone
      String homePhone = (String)contactForm.get("homePhone");
      String homePhoneExt = (String)contactForm.get("homePhoneExt");
      if (homePhone != null && ! homePhone.equals(""))
      {
        individualVO.setMOC(syncUtils.createNewPhoneMoc(homePhone, homePhoneExt, "Home" , Constants.MOC_HOME));
      }

      // set faxPhone
      String faxPhone = (String)contactForm.get("faxPhone");
      String faxPhoneExt = (String)contactForm.get("faxPhoneExt");
      if (faxPhone != null && (! faxPhone.equals("")))
      {
        individualVO.setMOC(syncUtils.createNewPhoneMoc(faxPhone, faxPhoneExt, "Fax" , Constants.MOC_FAX));
      }

      // set otherPhone
      String otherPhone = (String)contactForm.get("otherPhone");
      String otherPhoneExt = (String)contactForm.get("otherPhoneExt");
      if (otherPhone != null && (! otherPhone.equals("")))
      {
        individualVO.setMOC(syncUtils.createNewPhoneMoc(otherPhone, otherPhoneExt, "Other" , Constants.MOC_OTHER));
      }

      // set mainPhone
      String mainPhone = (String)contactForm.get("mainPhone");
      String mainPhoneExt = (String)contactForm.get("mainPhoneExt");
      if (mainPhone != null && (! mainPhone.equals("")))
      {
        individualVO.setMOC(syncUtils.createNewPhoneMoc(mainPhone, mainPhoneExt, "Main" , Constants.MOC_MAIN));
      }

      // set pagerPhone
      String pagerPhone = (String)contactForm.get("pagerPhone");
      String pagerPhoneExt = (String)contactForm.get("pagerPhoneExt");
      if (pagerPhone != null && (! pagerPhone.equals("")))
      {
        individualVO.setMOC(syncUtils.createNewPhoneMoc(pagerPhone, pagerPhoneExt, "Pager" , Constants.MOC_PAGER));
      }

      // set mobilePhone
      String mobilePhone = (String)contactForm.get("mobilePhone");
      String mobilePhoneExt = (String)contactForm.get("mobilePhoneExt");
      if (mobilePhone != null && (! mobilePhone.equals("")))
      {
        individualVO.setMOC(syncUtils.createNewPhoneMoc(mobilePhone, mobilePhoneExt, "Mobile" , Constants.MOC_MOBILE));
      }

      // might as well create the EJB connections now...
      ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome","ContactFacade");
      ContactFacade cfremote = (ContactFacade)cfh.create();
      cfremote.setDataSource(dataSource);
     
      SyncFacadeHome syncHome = (SyncFacadeHome)CVUtility.getHomeObject("com.centraview.syncfacade.SyncFacadeHome", "SyncFacade");
      com.centraview.syncfacade.SyncFacade sfremote = (com.centraview.syncfacade.SyncFacade)syncHome.create();
      sfremote.setDataSource(dataSource);

      // first, we need to get the entityID based on the CompanyName
      // passed into the form. If the entity name doesn't match something
      // in the database, then set a flag to create a new entity.
      int finalEntityID = 0;
      boolean createNewEntity = false;
      if (companyName != null && (! companyName.equals("")))
      {
        finalEntityID = sfremote.findCompanyNameMatch(companyName, individualID);

        if (finalEntityID == 0)
        {
          createNewEntity = true;
        }
      }   // end if (companyName != null && (! companyName.equals("")))

      // now that we've got all the Individual's info set up properly in
      // the appropriate VO objects, let's create an Entity if necessary
      String primaryContact = "Yes";    // gets set to no if we're updating an existing entity
      if (createNewEntity)
      {
        // in this case, we didn't find a match to our entity name in the
        // database, so we'll create a new entity with any form information
        EntityVO newEntity = new EntityVO();
        newEntity.setContactType(1);    // contact type 1 = Entity
        newEntity.setName(companyName);
        newEntity.setSourceName((String)contactForm.get("entitySource"));
        newEntity.setExternalID((String)contactForm.get("entityID2"));

        // Entity Address information
        String eStreet1 = (String)contactForm.get("entityStreet1");
        String eStreet2 = (String)contactForm.get("entityStreet2");
        String eCity = (String)contactForm.get("entityCity");
        String eState = (String)contactForm.get("entityState");
        String eZipCode = (String)contactForm.get("entityZip");
        String eCountry = (String)contactForm.get("entityCountry");
        // only create an Address VO if ONE or MORE fields are filled in
        if ((eStreet1 != null && eStreet1.length() > 0) || (eStreet2 != null && eStreet2.length() > 0) ||
            (eCity != null && eCity.length() > 0) || (eState != null && eState.length() > 0) ||
            (eZipCode != null && eZipCode.length() > 0) || (eCountry != null && eCountry.length() > 0))
        {
          AddressVO ePrimaryAddress = new AddressVO();
          ePrimaryAddress.setIsPrimary("YES");
          ePrimaryAddress.setStreet1(eStreet1);
          ePrimaryAddress.setStreet2(eStreet2);
          ePrimaryAddress.setCity(eCity);
          ePrimaryAddress.setStateName(eState);
          ePrimaryAddress.setZip(eZipCode);
          ePrimaryAddress.setCountryName(eCountry);
          newEntity.setPrimaryAddress(ePrimaryAddress);
        }else{
          // if no entity address information was given, use individual address
          newEntity.setPrimaryAddress(primaryAddress);
        }

        // save email address
        String eEmail = (String)contactForm.get("entityEmail");
        if (eEmail != null && ! eEmail.equals(""))
        {
          MethodOfContactVO eEmailVO = new MethodOfContactVO();
          eEmailVO.setContent(eEmail);
          eEmailVO.setMocType(1);   // hardcoded to "Email" type
          eEmailVO.setIsPrimary("YES")// always set as the primary email address
          newEntity.setMOC(eEmailVO);
        }
       
        // set workPhone
        String eWorkPhone = (String)contactForm.get("entityWorkPhone");
View Full Code Here

                  String individualName = remote.getIndividualName(linkId);
                  app.setIndividualName(individualName);
                  Collection contacts = remote.getPrimaryMOCForContact(0, linkId, 2);
                  app.setIndividualPrimaryContact("");
                  if(contacts.size() > 0){
                    MethodOfContactVO mc = (MethodOfContactVO) contacts.toArray()[0];
                    app.setIndividualPrimaryContact(mc.getContent());                   
                  }
                  app.setIndividualID(linkId);
                } catch (Exception e) {
                  logger.error("[Exception] ActivityHelperEJB.getActivityLink: ", e);
                }
View Full Code Here

          if (attendeeVO.getContactID() != actVO.getOwner()) {
            Collection mocColl = contactRemote.getPrimaryMOCForContact(userId, attendeeVO.getContactID(), 2); // what is 2???
            if (mocColl != null) {
              Iterator mocIter = mocColl.iterator();
              while (mocIter.hasNext()) {
                MethodOfContactVO methCont = (MethodOfContactVO)mocIter.next();
                if (methCont.getMocType() == 1) // hardcoded for email
                {
                  toList.add(methCont.getContent());
                }
              }
            } // end while (mocIter.hasNext())
          } // end if (attendeeVO.getContactID() != actVO.getOwner())
        } // end while (attendeesIter.hasNext())
View Full Code Here

             Collection col = contacthelperL.getPrimaryMOCForContact(indID, evo.getContactID(), evo.getContactType());
             Iterator it = col.iterator();
             Vector vec = evo.getMOC();
             int vecsize = vec.size();
             while (it.hasNext()){
               MethodOfContactVO moc = (MethodOfContactVO)it.next();
               for (int j = 0; j < vecsize; j++){
                 if(moc.getMocType() == ((MethodOfContactVO) vec.elementAt(j)).getMocType()){
                   ((MethodOfContactVO) vec.elementAt(j)).setMocID(moc.getMocID());
                   ((MethodOfContactVO) vec.elementAt(j)).added(false);
                   ((MethodOfContactVO) vec.elementAt(j)).updated(true);
                   break;
                 }
               }
View Full Code Here

             Collection col = contacthelperL.getPrimaryMOCForContact(indID, ivo.getContactID(), ivo.getContactType());
             Iterator it = col.iterator();
             Vector vec = ivo.getMOC();
             int vecsize = vec.size();
             while (it.hasNext()){
               MethodOfContactVO moc = (MethodOfContactVO)it.next();
               for (int j = 0; j < vecsize; j++){
                 if(moc.getMocType() == ((MethodOfContactVO) vec.elementAt(j)).getMocType()){
                   ((MethodOfContactVO) vec.elementAt(j)).setMocID(moc.getMocID());
                   ((MethodOfContactVO) vec.elementAt(j)).added(false);
                   ((MethodOfContactVO) vec.elementAt(j)).updated(true);
                   break;
                 }
               }
View Full Code Here

    Collection mocList = this.getMOC();
    Iterator iterator = mocList.iterator();
    int count = 1;
    while (iterator.hasNext()) {
      MethodOfContactVO moc = (MethodOfContactVO)iterator.next();
      // this is for email
      if (moc.getMocType() == 1 && moc.getIsPrimary().equalsIgnoreCase("YES")) {
        entityForm.set("email", moc.getContent());
        entityForm.set("emailId", String.valueOf(moc.getMocID()));
      } else if (count < 4 && moc.getMocType() != 1) {
        entityForm.set("mocType" + count, String.valueOf(moc.getMocType()));
        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;
        }
        entityForm.set("mocContent" + count, mocContentValue);
        entityForm.set("mocExt" + count, mocContentExt);
        entityForm.set("mocId" + count, String.valueOf(moc.getMocID()));
        count++;
      }
    }
    IndividualVO individualVO = this.getIndividualVO();
    if (individualVO != null) {
View Full Code Here

TOP

Related Classes of com.centraview.contact.helper.MethodOfContactVO

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.