Package com.centraview.contact.helper

Examples of com.centraview.contact.helper.ContactHelperLocal


      MailMessageVO mailMessageVO = new MailMessageVO();
      ArrayList toList = new ArrayList();

      InitialContext ic = CVUtility.getInitialContext();
      ContactHelperLocalHome contactHome = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal contactRemote = (ContactHelperLocal)contactHome.create();
      contactRemote.setDataSource(dataSource);
      toList = contactRemote.getEmailContactForIndividuals(individualIDs);
      String fromAddress = contactRemote.getPrimaryEmailAddress(individualID,2);

      if (fromAddress != null && !fromAddress.equals("") && toList != null && toList.size() != 0)
      {
        EmailSettingsLocalHome emailSettingsHome = (EmailSettingsLocalHome)ic.lookup("local/EmailSettings");
        EmailSettingsLocal emailSettingsRemote = (EmailSettingsLocal)emailSettingsHome.create();
View Full Code Here


      appRemote = null;
      appHome = null;

      // Used to get the Entity information when passing the EmailAddress
      ContactHelperLocalHome contactHelperHome = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal contactHelperRemote =  contactHelperHome.create();
      contactHelperRemote.setDataSource(this.dataSource);

      // Setting the Record Permission for newly Created record.
      AuthorizationLocalHome authHome=(AuthorizationLocalHome)ic.lookup("local/Authorization");
      AuthorizationLocal authRemote=(AuthorizationLocal)authHome.create();
      authRemote.setDataSource(this.dataSource);

      // get the Default Error Message Template for the Support replying emails
      EmailSettingsLocalHome emailSettingsHome=(EmailSettingsLocalHome)ic.lookup("local/EmailSettings");
      EmailSettingsLocal emailSettingsRemote=(EmailSettingsLocal)emailSettingsHome.create();
      emailSettingsRemote.setDataSource(this.dataSource);

      // Its a predefined Template for the replying message for the newly created Ticket
      EmailTemplateForm ticketTemplateForm = emailSettingsRemote.getEmailTemplate(AdministrationConstantKeys.EMAIL_TEMPLATE_SUPPORTTICKET);

      // Its a predefined Template for the replying message for the new created Thread
      EmailTemplateForm threadTemplateForm = emailSettingsRemote.getEmailTemplate(AdministrationConstantKeys.EMAIL_TEMPLATE_SUPPORTTHREAD);

      // Its a predefined Template for the replying for Error Message
      EmailTemplateForm errorTemplateForm = emailSettingsRemote.getEmailTemplate(AdministrationConstantKeys.EMAIL_TEMPLATE_SUPPORTERROR);

      emailSettingsRemote = null;
      emailSettingsHome = null;

      String defaultMessageBody = "";

      for (int i=0; i < messageIDs.size() ; i++) {
        int messageID = ((Integer) messageIDs.get(i)).intValue();
        if (messageID != -1) {
          MailMessageVO mailMessageVO = this.getEmailMessageVO(ownerID, messageID);
          String messageFrom = mailMessageVO.getFromAddress();

          InternetAddress emailAddress = new InternetAddress(messageFrom);
          messageFrom = emailAddress.getAddress();

          String messageSubject = mailMessageVO.getSubject();
          String messageBody = mailMessageVO.getBody();
          Html2Text plainMessageBody = new Html2Text(messageBody);

          int accountID = mailMessageVO.getEmailAccountID();
          int ticketID = 0;

          int startIndex = messageSubject.indexOf("TICKET#");
          int endIndex = -1;
          if (startIndex >0) {
            endIndex = messageSubject.indexOf("#",(startIndex + 7));
          }

          if (startIndex >0 && endIndex > startIndex) {
            startIndex = startIndex + 7;
            String tempTicketID =messageSubject.substring(startIndex,endIndex);
            if (tempTicketID != null && !tempTicketID.equals("")) {
              ticketID = Integer.parseInt(tempTicketID);
            }
          }

          if (ticketID == 0) {
            TicketVO ticketVO = new TicketVO();
            ticketVO.setTitle(messageSubject);
            ticketVO.setDetail(plainMessageBody.getPlainText());
            ticketVO.setPriorityId(1);
            ticketVO.setStatusId(1);
            ticketVO.setCreatedBy(ownerID);

            HashMap contactInfo = contactHelperRemote.getContactInfoForEmailAddress(messageFrom);

            int assignedId = 0;
            int entityId = 0;
            int individualId = 0;
View Full Code Here

    // same thing for entity.
    if(displayName != null && displayName.equals("Marketing List") && queryTableID != 0){
     
      //intialize the ContactHelperLocal
      ContactHelperLocalHome contactHelperLocalHome = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal contactHelperLocal =  contactHelperLocalHome.create();
      contactHelperLocal.setDataSource(this.dataSource);

      ArrayList recordIDs= new ArrayList();     
      for (int i = 0; i < resultsIDs.size(); i++)
      {
        int recordID =((Number)resultsIDs.get(i)).intValue();
        // If we are processing the Individual then we must have to get
        // Entity ID. So that we can move the entity as well as all associated individual
        // to the new List selected by the user.
        if(queryTableID == 2){
          recordID = contactHelperLocal.getEntityIDForIndividual(recordID);
        }//end of if(queryTableID == 2)
        recordIDs.add(recordID+"");
      }//end of for (int i = 0; i < resultsIDs.size(); i++)
      String entityIDs[] = new String[recordIDs.size()];
      for(int i = 0; i < recordIDs.size(); i++){
        entityIDs[i]= (String) recordIDs.get(i);
      }//end of for(int i = 0; i < recordIDs.size(); i++)
      int marketingListID = Integer.parseInt(fieldValue);
      if(marketingListID != 0 && entityIDs.length != ){
        // Reason for adminIndividualID to set as -1. We know that admin is a super user
        // he can move any thing. thats why its hard coded to -1
        int adminIndividualID = -1;
        contactHelperLocal.entityMove(adminIndividualID, marketingListID, entityIDs );
      }//end of if(marketingListID != 0 && entityIDs.length != 0  )     
    }//end of if(displayName != null && displayName.equals("Marketing List") && queryTableID != 0)

    // inserting the batched query to the database.
    int[] batchResult = cvdal.batchProcess(batchQuery);
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) {
      logger.error("[setJurisdictionForAddress]: Exception", e);
    }
  }
View Full Code Here

          int taxJurisdictionId = 0;

          if (invoiceVO.getShipToId()!=0)
          {
            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

      boolean entityPrimaryFlag = false;

      // Collect the State, country, source, group, user, Method of Contact List
      InitialContext ic = CVUtility.getInitialContext();
      ContactHelperLocalHome homeContact = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
      ContactHelperLocal remoteContact =  homeContact.create();
      remoteContact.setDataSource(this.dataSource);

      CommonHelperLocalHome homeCommon = (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
      CommonHelperLocal remoteCommon =  homeCommon.create();
      remoteCommon.setDataSource(this.dataSource);

      HashMap sourceList = remoteCommon.getSourceList();
      Vector groupList = remoteContact.getGroups();
      HashMap entityList = remoteContact.getEntityList(listid);
      HashMap employeeList = remoteContact.getEmployeeList();

      //remoteCommon = null;
      homeCommon = null;
      remoteContact = null;
      homeContact = null;
View Full Code Here

          int taxJurisdictionId = 0;

          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

          int taxClassId = item.getTaxClassId();
          int taxJurisdictionId = 0;
          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

              }
            }
          }
          InitialContext ic = CVUtility.getInitialContext();
          ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
          ContactHelperLocal remote = home.create();
          remote.setDataSource(this.dataSource);
          String ownerName = remote.getIndividualName(act.getOwner());
          act.setOwnerID(act.getOwner());
          act.setOwnerName(ownerName);
        } catch (Exception e) {
          logger.error("[Exception] ActivityHelperEJB.getBasicActivity: ", e);
        }
View Full Code Here

            linkId = ((Number)hm.get("RecordID")).intValue();
            switch (recordType) {
              case ActivityVO.ACTIVITY_LINK_ENTITY : // entity
                try {
                  ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
                  ContactHelperLocal remote = home.create();
                  remote.setDataSource(this.dataSource);
                  String entityName = remote.getEntityName(linkId);
                  app.setEntityName(entityName);
                  app.setEntityID(linkId);
                } catch (Exception e) {
                  logger.error("[Exception] ActivityHelperEJB.getActivityLink: ", e);
                }
                break;
              case ActivityVO.ACTIVITY_LINK_INDIVIDUAL : // Individual
                try {
                  ContactHelperLocalHome home = (ContactHelperLocalHome)ic.lookup("local/ContactHelper");
                  ContactHelperLocal remote = home.create();
                  remote.setDataSource(this.dataSource);
                  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);
                }
                break;
              case ActivityVO.ACTIVITY_LINK_FILE : // File
                try {
                  CvFileLocalHome fh = (CvFileLocalHome)ic.lookup("local/CvFile");
                  CvFileLocal fr = fh.create();
                  fr.setDataSource(this.dataSource);
                  CvFileVO flvo = fr.getFileBasic(gbUserId, linkId);
                  app.setAttachmentVec(flvo);
                } catch (Exception e) {
                  logger.error("[Exception] ActivityHelperEJB.getActivityLink: ", e);
                }
                break;
              case ActivityVO.ACTIVITY_LINK_OPPORTUNITY : // Opportunity - from module table
                try {
                  OpportunityLocalHome home = (OpportunityLocalHome)ic.lookup("local/Opportunity");
                  OpportunityLocal local = home.create();
                  local.setDataSource(this.dataSource);
                  String opportunityName = local.getOpportunityName(linkId);
                  app.setRelatedFieldID(linkId);
                  app.setRelatedFieldValue(opportunityName);
                  app.setRelatedTypeID(ActivityVO.ACTIVITY_LINK_OPPORTUNITY);
                  app.setRelatedTypeValue("Opportunity");
                } catch (Exception e) {
                  logger.error("[Exception] ActivityHelperEJB.getActivityLink: ", e);
                }
                break;
              case ActivityVO.ACTIVITY_LINK_PROJECT : // Projects - from module table
                try {
                  ProjectLocalHome home = (ProjectLocalHome)ic.lookup("local/Project");
                  ProjectLocal remote = (ProjectLocal)home.create();
                  remote.setDataSource(this.dataSource);
                  String projectTitle = remote.getProjectName(linkId);
                  app.setRelatedFieldID(linkId);
                  app.setRelatedFieldValue(projectTitle);
                  app.setRelatedTypeID(ActivityVO.ACTIVITY_LINK_PROJECT);
                  app.setRelatedTypeValue("Project");
                } catch (Exception e) {
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.