Package com.centraview.contact.helper

Examples of com.centraview.contact.helper.ContactHelperLocal


  public EntityVO getEntityVOWithBasicReferences()
  {
    try {
      InitialContext ic = CVUtility.getInitialContext();
      ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal remote = home.create();
      remote.setDataSource(this.dataSource);

      int cntType = 1;
      int cntId = this.envo.getContactID();

      // TODO: hardocoded userid!
      AddressVO adr = remote.getPrimaryAddressForContact(1, cntId, cntType); //user ID HardCoded
      this.envo.setPrimaryAddress(adr);

      // TODO: hardocoded userid!
      Collection cl = remote.getAllMOCForContact(1, cntId, cntType);
      this.envo.clearMOC();

      Iterator it = cl.iterator();
      while (it.hasNext()) {
        this.envo.setMOC((MethodOfContactVO)it.next());
      }

      if (envo.getModifiedBy() != 0) {
        try {
          String individualName = remote.getIndividualName(this.envo.getModifiedBy());
          if (individualName != null && individualName.length() > 20) {
            individualName = individualName.substring(0,20);
            individualName = individualName +"…";
          }
          this.envo.setModifiedByName(individualName);
        }catch(Exception e){
          logger.error("[getEntityVOWithBasicReferences] Exception thrown.", e);
        } //end of catch block (Exception)
      } // end if (envo.getModifiedBy() != 0)

      if (envo.getCreatedBy() != 0) {
        try {
          String individualName = remote.getIndividualName(this.envo.getCreatedBy());
          if (individualName != null && individualName.length() > 20) {
            individualName = individualName.substring(0,20);
            individualName = individualName +"…";
          }
          this.envo.setCreatedByName(individualName);
View Full Code Here


    newEntityID = dl.getAutoGeneratedKey();

    try {
      ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal remote =  home.create();
      remote.setDataSource(dataSource);

      int contactType = entityVO.getContactType();

      if (entityVO.getPrimaryAddress() != null) {
        // The boolean value false tells the ContactHelperEJB to NOT
        // update the 'entity.Modified' field, since we are already
        // updating that record at this time.
        remote.addAddress(entityVO.getPrimaryAddress(), newEntityID, contactType, individualID, false);
      }

      Iterator mocIter = entityVO.getMOC().iterator();
      while (mocIter.hasNext()) {
        // The boolean value false tells the ContactHelperEJB to NOT
        // update the 'entity.Modified' field, since we are already
        // updating that record at this time.
        remote.addMOC((MethodOfContactVO)(mocIter.next()), newEntityID, contactType, individualID, false);
      }

      IndividualVO individualVO = entityVO.getIndividualVO();
      if (individualVO != null && individualVO.getContactID() <= 0) {
        IndividualLocalHome ih = (IndividualLocalHome)ic.lookup("local/Individual");
View Full Code Here

          custFieldVO.setRecordID(entId);
          custRemote.updateCustomField(custFieldVO);
        }

        ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
        ContactHelperLocal remote = home.create();
        remote.setDataSource(this.dataSource);

        int cntType = this.envo.getContactType();
        AddressVO adr = this.envo.getPrimaryAddress();
        if (adr != null) {
          int addID = adr.getAddressID();
          if (addID > 0) {
            // The boolean value false tells the ContactHelperEJB to NOT
            // update the 'entity.Modified' field, since we are already
            // updating that record at this time.
            remote.updateAddress(this.envo.getPrimaryAddress(), entId, modBy, false);
          } else {
            // don't update Modified field
            remote.addAddress(this.envo.getPrimaryAddress(), entId, cntType, modBy, false);
          }
        }

        Collection mocVOs = this.envo.getMOC();
        if (mocVOs != null) {
          Iterator mi = this.envo.getMOC().iterator();
          while (mi.hasNext()) {
            MethodOfContactVO mocObj = (MethodOfContactVO)mi.next();
            int mocID = mocObj.getMocID();
            if (mocObj.isAdded()) {
              // The boolean value false tells the ContactHelperEJB to NOT
              // update the 'entity.Modified' field, since we are already
              // updating that record at this time.
              remote.addMOC(mocObj, entId, cntType, modBy, false);
            } else if (mocObj.isUpdated()) {
              remote.updateMOC(mocObj, entId, modBy, false); // don't update
            } else if (mocObj.isDelete()) {
              remote.deleteMOC(mocID, entId, modBy, false); // don't update
            }
          }
        } // end if (mocVOs != null)

        IndividualVO newInd = this.envo.getIndividualVO();
View Full Code Here

      CVUtility.addHistoryRecord(historyInfo, ds);

      // Create the address.
      AddressVO addVO = individualDetail.getPrimaryAddress();
      ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal remote = home.create();
      remote.setDataSource(ds);
      // if there is no address filled in, automatically fill in the address
      // from the associated entity.
      if ((addVO.getCity() == null || addVO.getCity().equals("")) &&
          (addVO.getCountryName() == null || addVO.getCountryName().equals("")) &&
          (addVO.getStateName() == null || addVO.getStateName().equals("")) &&
          (addVO.getStreet1() == null || addVO.getStreet1().equals("")) &&
          (addVO.getStreet2() == null || addVO.getStreet2().equals("")) &&
          (addVO.getZip() == null || addVO.getZip().equals("")))
      {
        // This of course creates a copy of the address from the entity, therefore
        // it is possible to be changed independently of Entities, however it will
        // not be in sync with changes to the entities.
        addVO = remote.getPrimaryAddressForContact(userID, individualDetail.getEntityID(), 1);
        addVO.setIsPrimary("YES");
      }


      // We are passing the Extra boolean value to the method. if the boolean
      // value is false then we wil not update the individual table
      remote.addAddress(addVO, individualID, individualDetail.getContactType(), userID, false);


      // Getting MethodOfContactVO List from Individual Object
      Collection mocList = individualDetail.getMOC();
      Iterator it = mocList.iterator();
      int counter = 0;
      MethodOfContactVO mocVO = null;
      while (it.hasNext()) {
        mocVO = (MethodOfContactVO)it.next();
        // Count all the Mobile and Phone type MOCs that were manually added.
        // If there were none, try to inheirit copies of them from the parent
        // entity.
        if (mocVO.getIsPrimary().equals("YES")) {
          counter++;
        }

        // We are passing the Extra boolean value to the method. if the boolean
        // value is false then we wil not update the individual table
        remote.addMOC(mocVO, individualID, 2, userID, false); // Hardcoded for
                                                              // Individual
                                                              // ContactType
      }

      // if counter < 1 then there were no phone or mobile numbers entered for
      // this individual. So we should try and suck down copies of the Entities.
      if (counter < 1) {
        Collection col = remote.getAllMOCForContact(userID, individualDetail.getEntityID(), 1);
        if (col != null) {
          Iterator mocIter = col.iterator();
          while (mocIter.hasNext()) {
            mocVO = (MethodOfContactVO)mocIter.next();
            // we ussed to only copy "Main" and "Fax" types, but per Alan's
            // request this has been changed. Please see bug #88. I have
            // changed this to copy ALL MOC's.
            if (mocVO.getIsPrimary().equals("YES")) {
              remote.addMOC(mocVO, individualID, 2, userID, false);   // false means don't update the modified timestamp of individual record
            }
          }
        }
      }
View Full Code Here

            custRemote.updateCustomField(custFieldVO);
          }
        }

        ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
        ContactHelperLocal remote = home.create();
        remote.setDataSource(this.dataSource);

        int cntType = this.indVo.getContactType();
        AddressVO av = this.indVo.getPrimaryAddress();
        if (av != null) {
          if (av.getAddressID() == 0) {
            av.setIsPrimary("YES");
            //We are passing the Extra boolean value to the method. if the
            // boolean value is false then we wil not update the individual
            // table
            remote.addAddress(av, indVo.getContactID(), 2, 1, false);
          } else {
            //We are passing the Extra boolean value to the method. if the
            // boolean value is false then we wil not update the individual
            // table
            remote.updateAddress(this.indVo.getPrimaryAddress(), indVo.getContactID(), indVo.getModifiedBy(), false);
          }
        }
        Iterator mi = this.indVo.getMOC().iterator();
        while (mi.hasNext()) {
          MethodOfContactVO mocObj = (MethodOfContactVO)mi.next();
          int mocID = mocObj.getMocID();
          if (mocObj.isAdded()) {
            //We are passing the Extra boolean value to the method. if the
            // boolean value is false then we wil not update the individual
            // table
            remote.addMOC(mocObj, indVo.getContactID(), cntType, indVo.getModifiedBy(), false);
          } else if (mocObj.isUpdated()) {
            // We are passing the Extra boolean value to the method. if the
            // boolean value is false then we wil not update the individual
            // table
            remote.updateMOC(mocObj, indVo.getContactID(), indVo.getModifiedBy(), false);
          } else if (mocObj.isDelete()) {
            // We are passing the Extra boolean value to the method. if the
            // boolean value is false then we wil not update the individual
            // table
            remote.deleteMOC(mocID, indVo.getContactID(), indVo.getModifiedBy(), false);
          }
        }

        //this is to fill all the system fields like created on and modified on
        // date
View Full Code Here

      dl.clearParameters();

      if (!isUser) {
        InitialContext ic = CVUtility.getInitialContext();
        ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
        ContactHelperLocal remote = home.create();
        remote.setDataSource(this.dataSource);

        if (!basicReferanceFilled) {
          getIndividualVOWithBasicReferences();
        }

        // delete Address
        AddressVO addVO = this.indVo.getPrimaryAddress();
        if (addVO != null) {
          //We are passing the Extra boolean value to the method. if the
          // boolean value is false then we wil not update the individual table
          remote.deleteAddress(addVO.getAddressID(), this.indVo.getContactID(), this.operationIndividualId, false);
        }

        // All Method od Contact is to deleted.
        Iterator mi = this.indVo.getMOC().iterator();
        while (mi.hasNext()) {
          MethodOfContactVO mocVO = (MethodOfContactVO)mi.next();
          // We are passing the Extra boolean value to the method. if the
          // boolean value is false then we wil not update the individual table
          remote.deleteMOC(mocVO.getMocID(), this.indVo.getContactID(), this.operationIndividualId, false);
        }
        //ALLSQL.put("contact.deleteindividual", "delete from individual where
        // individualID = ? ");

        //Delete Custom Field
View Full Code Here

    try
    {
      InitialContext ic = CVUtility.getInitialContext();
      ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal remote =  home.create();
      remote.setDataSource(this.dataSource);

      if (! basicReferencesFilled)
      {
        getEntityVOWithBasicReferences();
      }

      // delete Address
      AddressVO addVO = this.envo.getPrimaryAddress();
      if (addVO != null)
      {
        // The boolean value false tells the ContactHelperEJB to NOT
        // update the 'entity.Modified' field, since we are already
        // updating that record at this time.
        remote.deleteAddress(addVO.getAddressID(), this.envo.getContactID(), 1, false);
      }

      // All Method of Contact is to deleted.
      Iterator mi = this.envo.getMOC().iterator();
      while (mi.hasNext())
      {
        MethodOfContactVO mocVO = (MethodOfContactVO)mi.next();
        // The boolean value false tells the ContactHelperEJB to NOT
        // update the 'entity.Modified' field, since we are already
        // updating that record at this time.
        remote.deleteMOC(mocVO.getMocID(), this.envo.getContactID(), 1, false);
      }


      dl.setSqlQuery("SELECT IndividualID AS id FROM individual WHERE individual.Entity = ?");
      dl.setInt(1,this.envo.getContactID());
View Full Code Here

  public IndividualVO getIndividualVOWithBasicReferences()
  {
    try {
      InitialContext ic = CVUtility.getInitialContext();
      ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal remote = home.create();
      remote.setDataSource(this.dataSource);

      // Getting AddressVO from Contact Helper Ejb //
      // (userID,contactID,contactType
      // TODO: Hardcoded UserId to be removed Later (use
      // this.operationIndividualID)
      AddressVO addVO = remote.getPrimaryAddressForContact(1, this.indVo.getContactID(), this.indVo.getContactType());
      this.indVo.setPrimaryAddress(addVO);

      if (indVo.getModifiedBy() != 0) {
        String individualName = remote.getIndividualName(this.indVo.getModifiedBy());
        if (individualName != null && individualName.length() > 20) {
          individualName = individualName.substring(0, 20);
          individualName = individualName + "&#8230;";
        }
        this.indVo.setModifiedByName(individualName);
      } // end if (indVo.getModifiedBy() != 0)

      if (indVo.getCreatedBy() != 0) {
        String individualName = remote.getIndividualName(this.indVo.getCreatedBy());
        if (individualName != null && individualName.length() > 20) {
          individualName = individualName.substring(0, 20);
          individualName = individualName + "&#8230;";
        }
        this.indVo.setCreatedByName(individualName);
      } // end if (indVo.getCreatedBy() != 0)

      //Getting AddressVO from Contact Helper Ejb //
      // (userID,contactID,contactType
      //Collection mocColl =
      // remote.getPrimaryMOCForContact(1,this.indVo.getContactID(),this.indVo.getContactType());
      Collection mocColl = remote.getAllMOCForContact(1, this.indVo.getContactID(), this.indVo.getContactType());

      if (mocColl != null) {
        Iterator it = mocColl.iterator();
        this.indVo.clearMOC();
        while (it.hasNext()) {
View Full Code Here

  {
    HashMap hm = new HashMap();
    try {
      InitialContext ic = CVUtility.getInitialContext();
      ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal remote = home.create();
      remote.setDataSource(this.dataSource);

      // TODO: HARDCODED USER ID!!! (use this.operationIndividualID)
      Vector addVOs = remote.getCustomerPrimaryAddressForContact(1, this.indVo.getContactID(), this.indVo.getContactType());
      //this.indVo.setPrimaryAddress(addVO);

      if (indVo.getModifiedBy() != 0) {
        String individualName = remote.getIndividualName(this.indVo.getModifiedBy());
        if (individualName != null && individualName.length() > 20) {
          individualName = individualName.substring(0, 20);
          individualName = individualName + "&#8230;";
        }
        this.indVo.setModifiedByName(individualName);
      } // end if (indVo.getModifiedBy() != 0)

      if (indVo.getCreatedBy() != 0) {
        String individualName = remote.getIndividualName(this.indVo.getCreatedBy());
        if (individualName != null && individualName.length() > 20) {
          individualName = individualName.substring(0, 20);
          individualName = individualName + "&#8230;";
        }
        this.indVo.setCreatedByName(individualName);
      } // end if (indVo.getCreatedBy() != 0)

      IndividualLocalHome ih = (IndividualLocalHome)ic.lookup("local/Individual");

      try {
        IndividualLocal il = ih.findByPrimaryKey(new IndividualPK(this.indVo.getContactID(), this.dataSource));
        IndividualVO iv = il.getIndividualVOBasic();
        hm.put("addVOs", addVOs);
        hm.put("IndividualVO", iv);
      } catch (Exception e) {
        logger.error("[Exception]: Find By Primary Key Exception in Individual", e);
      }

      // Getting AddressVO from Contact Helper Ejb //
      // (userID,contactID,contactType
      //Collection mocColl =
      // remote.getPrimaryMOCForContact(1,this.indVo.getContactID(),this.indVo.getContactType());
      Collection mocColl = remote.getAllMOCForContact(1, this.indVo.getContactID(), this.indVo.getContactType());

      if (mocColl != null) {
        Iterator it = mocColl.iterator();
        this.indVo.clearMOC();
        while (it.hasNext()) {
View Full Code Here

  public void setJurisdictionForAddress(int addressID, int jurisdictionID)
  {
    try {
      InitialContext ic = CVUtility.getInitialContext();
      ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal remote = home.create();
      remote.setDataSource(this.dataSource);
      remote.setJurisdictionForAddress(addressID, jurisdictionID);
    } catch (Exception e) {
      System.out
          .println("[Exception][AccountFacadeEJB.setJurisdictionForAddress] Exception Thrown: " + e);
      // e.printStackTrace();
    }
View Full Code Here

TOP

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

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.