Package com.centraview.contact.helper

Examples of com.centraview.contact.helper.AddressVO


      String street2 = (String)contactForm.get("street2");
      String city = (String)contactForm.get("city");
      String state = (String)contactForm.get("state");
      String zipCode = (String)contactForm.get("zip");
      String country = (String)contactForm.get("country");
      AddressVO primaryAddress = new AddressVO();
      // only create an Address VO if ONE or MORE fields are filled in
      if ((street1 != null && street1.length() > 0) || (street2 != null && street2.length() > 0) ||
          (city != null && city.length() > 0) || (state != null && state.length() > 0) ||
          (zipCode != null && zipCode.length() > 0) || (country != null && country.length() > 0))
      {
        primaryAddress.setIsPrimary("YES");
        primaryAddress.setStreet1(street1);
        primaryAddress.setStreet2(street2);
        primaryAddress.setCity(city);
        primaryAddress.setStateName(state);
        primaryAddress.setZip(zipCode);
        primaryAddress.setCountryName(country);
        individualVO.setPrimaryAddress(primaryAddress);
      }

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


        ContactFacadeLocalHome home = (ContactFacadeLocalHome) ic.lookup("local/ContactFacade");
        ContactFacadeLocal remote = home.create();
        remote.setDataSource(this.dataSource);
        int entityID = remote.getEntityIDForIndividual(individualId);
        EntityVO entityVO = remote.getEntity(entityID);
        AddressVO primaryAdd = entityVO.getPrimaryAddress();
        userObj.setEntityName(entityVO.getName());
        userObj.setEntityId(entityID);
        userObj.setAddressVO(primaryAdd);
      } catch (Exception e) {
        logger.error("[getUserObject]: Exception", e);
View Full Code Here

          {
            ContactHelperLocalHome home1 = ( ContactHelperLocalHome )ic.lookup("local/ContactHelper");
            ContactHelperLocal contactHelperLocal = home1.create();
            contactHelperLocal.setDataSource(this.dataSource);

            AddressVO addVO = contactHelperLocal.getAddress(invoiceVO.getShipToId());
            taxJurisdictionId = 0;
            if (taxJurisdictionId !=0)
            {
              taxRate = getTax(taxClassId, taxJurisdictionId);
            }//if (taxJurisdictionId !=0)
          }//if InvoiceVO.shipToId!=null
          ((FloatMember)ie.get("UnitTaxrate")).setMemberValue(taxRate);
        }catch (Exception e)
        {
          ((FloatMember)ie.get("UnitTaxrate")).setMemberValue(0.0f);

        }
      }//while


    }//if counter!=0


    if (newItemID != null && !newItemID.equals("") )
      {
        st = new StringTokenizer(newItemID, ",");

        while (st.hasMoreTokens())
        {
          try
          {
          float taxRate = 0.0f;
          token   = (String)st.nextToken();
          int intToken = Integer.parseInt(token);
          InitialContext ic = CVUtility.getInitialContext();
          ItemLocalHome home = (ItemLocalHome)ic.lookup("local/Item");
          ItemLocal itemLocal = home.create();
          itemLocal.setDataSource(this.dataSource);
          ItemVO item = itemLocal.getItem(userId,intToken);


          //Get the Required Fields from the Item VO
          String name = item.getItemName();
          String sku = item.getSku();
          float price = (float)item.getPrice();
          int id = item.getItemId();
          int taxClassId = item.getTaxClassId();
          int taxJurisdictionId = 0;
          if (invoiceVO.getShipToId()!=0)
          {
            try
            {
            ContactHelperLocalHome home2 =( ContactHelperLocalHome)ic.lookup("local/ContactHelper");
            ContactHelperLocal contactHelperLocal = home2.create();
            contactHelperLocal.setDataSource(this.dataSource);
            AddressVO addVO = contactHelperLocal.getAddress(invoiceVO.getShipToId());
            taxJurisdictionId = 0;
            if (taxJurisdictionId !=0)
            {
              taxRate = getTax(taxClassId, taxJurisdictionId);
            }//if (taxJurisdictionId !=0)
View Full Code Here

          if (orderVO.getShipToAddIdValue()!=0)
          {
            ContactHelperLocalHome home1 = ( ContactHelperLocalHome )ic.lookup("local/ContactHelper");
            ContactHelperLocal contactHelperLocal = home1.create();
            contactHelperLocal.setDataSource(this.dataSource);
            AddressVO addVO = contactHelperLocal.getAddress(orderVO.getShipToAddIdValue());
            taxJurisdictionId = 0;
            if (taxJurisdictionId !=0)
            {
              taxRate = getTax(taxClassId, taxJurisdictionId);
            }//if (taxJurisdictionId !=0)
          }//if InvoiceVO.shipToId!=null
          ((FloatMember)ie.get("UnitTaxrate")).setMemberValue(taxRate);
        }catch (Exception e)
        {
          ((FloatMember)ie.get("UnitTaxrate")).setMemberValue(0.0f);
          System.out.println("[Exception][AccountHelperEJB.calculateOrderItems] Exception Thrown: "+e);
        }
      }//while


    }//if counter!=0


    if (newItemID != null && !newItemID.equals("") )
      {
        st = new StringTokenizer(newItemID, ",");

        while (st.hasMoreTokens())
        {
          try
          {
          float taxRate = 0.0f;
          token   = (String)st.nextToken();
          int intToken = Integer.parseInt(token);
          InitialContext ic = CVUtility.getInitialContext();
          ItemLocalHome home = (ItemLocalHome)ic.lookup("local/Item");
          ItemLocal itemLocal = home.create();
          itemLocal.setDataSource(this.dataSource);
          ItemVO item = itemLocal.getItem(userId,intToken);


          //Get the Required Fields from the Item VO
          String name = item.getItemName();
          String sku = item.getSku();
          float price = (float)item.getPrice();
          int id = item.getItemId();
          int taxClassId = item.getTaxClassId();
          int taxJurisdictionId = 0;
          if (orderVO.getShipToAddIdValue()!=0)
          {
            try
            {
            ContactHelperLocalHome home2 =( ContactHelperLocalHome)ic.lookup("local/ContactHelper");
            ContactHelperLocal contactHelperLocal = home2.create();
            contactHelperLocal.setDataSource(this.dataSource);
            AddressVO addVO = contactHelperLocal.getAddress(orderVO.getShipToAddIdValue());
            taxJurisdictionId = 0;
            if (taxJurisdictionId !=0)
            {
              taxRate = getTax(taxClassId, taxJurisdictionId);
            }//if (taxJurisdictionId !=0)
View Full Code Here

          if (purchaseOrderVO.getShipToId()!=0)
          {
            ContactHelperLocalHome home1 = ( ContactHelperLocalHome )ic.lookup("local/ContactHelper");
            ContactHelperLocal contactHelperLocal = home1.create();
            contactHelperLocal.setDataSource(this.dataSource);
            AddressVO addVO = contactHelperLocal.getAddress(purchaseOrderVO.getShipToId());
            taxJurisdictionId = 0;
            if (taxJurisdictionId !=0)
            {
              taxRate = getTax(taxClassId, taxJurisdictionId);
            }//if (taxJurisdictionId !=0)
          }//if InvoiceVO.shipToId!=null
          ((FloatMember)ie.get("UnitTaxrate")).setMemberValue(taxRate);
        }catch (Exception e)
        {
          ((FloatMember)ie.get("UnitTaxrate")).setMemberValue(0.0f);
          System.out.println("[Exception][AccountHelperEJB.calculatePurchaseOrderItems] Exception Thrown: "+e);
        }
      }//while


    }//if counter!=0


    if (newItemID != null && !newItemID.equals("") )
      {
        st = new StringTokenizer(newItemID, ",");

        while (st.hasMoreTokens())
        {
          try
          {
          float taxRate = 0.0f;
          token   = (String)st.nextToken();
          int intToken = Integer.parseInt(token);
          InitialContext ic = CVUtility.getInitialContext();
          ItemLocalHome home = (ItemLocalHome)ic.lookup("local/Item");
          ItemLocal itemLocal = home.create();
          itemLocal.setDataSource(this.dataSource);
          ItemVO item = itemLocal.getItem(userId,intToken);


          //Get the Required Fields from the Item VO
          String name = item.getItemName();
          String sku = item.getSku();
          float price = (float)item.getPrice();
          int id = item.getItemId();
          int taxClassId = item.getTaxClassId();
          int taxJurisdictionId = 0;
          if (purchaseOrderVO.getShipToId()!=0)
          {
            try
            {
            ContactHelperLocalHome home2 =( ContactHelperLocalHome)ic.lookup("local/ContactHelper");
            ContactHelperLocal contactHelperLocal = home2.create();
            contactHelperLocal.setDataSource(this.dataSource);
            AddressVO addVO = contactHelperLocal.getAddress(purchaseOrderVO.getShipToId());
            taxJurisdictionId = 0;
            if (taxJurisdictionId !=0)
            {
              taxRate = getTax(taxClassId, taxJurisdictionId);
            }//if (taxJurisdictionId !=0)
View Full Code Here


           for ( int i=0;i<size;i++)
           {
             evo = (EntityVO) EVOs.get(i);
             AddressVO adrVO = contacthelperL.getPrimaryAddressForContact(indID, evo.getContactID(), evo.getContactType());
             evo.getPrimaryAddress().setAddressID(adrVO.getAddressID());

             Collection col = contacthelperL.getPrimaryMOCForContact(indID, evo.getContactID(), evo.getContactType());
             Iterator it = col.iterator();
             Vector vec = evo.getMOC();
             int vecsize = vec.size();
View Full Code Here

           for ( int i=0;i<size;i++)
           {
             ivo = (IndividualVO) IVOs.get(i);
             ivo.setContactID(ivo.getIndividualID());

             AddressVO adrVO = contacthelperL.getPrimaryAddressForContact(indID, ivo.getIndividualID(), ivo.getContactType());
             ivo.getPrimaryAddress().setAddressID(adrVO.getAddressID());

             Collection col = contacthelperL.getPrimaryMOCForContact(indID, ivo.getContactID(), ivo.getContactType());
             Iterator it = col.iterator();
             Vector vec = ivo.getMOC();
             int vecsize = vec.size();
View Full Code Here

      HashMap hmentity=new HashMap();
      hmentity.put("EntityID",(new Integer(ev.getContactID())).toString());
      caremote.dumpData(individualID,transactionID,"entity",hmentity);

      AddressVO adv = ev.getPrimaryAddress();

      if (adv != null)
      {
        HashMap hmaddr=new HashMap();
        hmaddr.put("AddressID",(new Integer(adv.getAddressID())).toString());
        caremote.dumpData(individualID,transactionID,"address",hmaddr);
      }

      Vector vec = ev.getCustomField();
View Full Code Here

      HashMap hmind=new HashMap();
      hmind.put("IndividualID",(new Integer(indVO.getContactID())).toString());
      caremote.dumpData(indID,transactionID,"individual",hmind);

      AddressVO adv = indVO.getPrimaryAddress();
      if (adv != null)
      {
        HashMap hmaddr=new HashMap();
        hmaddr.put("AddressID",(new Integer(adv.getAddressID())).toString());
        caremote.dumpData(indID,transactionID,"address",hmaddr);

        HashMap addressRelateHashMap = new HashMap();
        addressRelateHashMap.put("Address",(new Integer(adv.getAddressID())).toString());
        caremote.dumpData(indID,transactionID,"addressrelate", addressRelateHashMap);
      }

      Vector mocvec = indVO.getMOC();
      if (mocvec != null)
View Full Code Here

    if (rawAddresses != null)
    {
      Iterator addressIteration = rawAddresses.iterator();
      while(addressIteration.hasNext())
      {
        AddressVO addressVO = new AddressVO();
        HashMap hm = (HashMap) addressIteration.next();
        addressVO.setAddressID(((Number)hm.get("addressId")).intValue());
        addressVO.setStreet1((String) hm.get("street1"));
        addressVO.setStreet2((String) hm.get("street2"));
        addressVO.setCity((String) hm.get("city"));
        addressVO.setStateName((String) hm.get("state"));
        addressVO.setZip((String) hm.get("zip"));
        addressVO.setCountryName((String) hm.get("country"));
        addressVO.setWebsite((String) hm.get("website"));
        addressVO.setAddressType(((Number) hm.get("addressType")).intValue());
        addressVO.setIsPrimary((String) hm.get("isPrimary"));
        addressVOs.add(addressVO);
      } // end while()
    } // end if(rawAddress != null)
    return addressVOs;
  } // getAllAddressesBasic(int contactId, int contactType)
View Full Code Here

TOP

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

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.