Package com.centraview.contact.contactfacade

Examples of com.centraview.contact.contactfacade.ContactFacade


        vecSend = emailVecSend;
        vecAll = (Vector)hm.get(Constants.VIEWSENDEMAIL);
      }

      ContactFacadeHome facadeHome = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade cfremote = (ContactFacade) facadeHome.create();
      cfremote.setDataSource(dataSource);

      // get the records from the database
      Collection sqlResults = cfremote.getEmployeeListCollection(individualId);

      // now create a DisplayList out of those records
      IndividualList employeeList = new IndividualList();

      // ok, now that we have the results from the database,
View Full Code Here


    try
    {
       //System.out.println("Trying to  HOME IN HANDLER"+groupVO.getGroupName());
       ContactFacadeHome cfh = (ContactFacadeHome) CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome",
           "ContactFacade");
       ContactFacade remote = (ContactFacade) cfh.create();
       remote.setDataSource(dataSource);
       //System.out.println("GOT HOME IN HANDLER");
      // listid = remote.updateList( userID , form );
      ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      lg.makeListDirty("Marketing");
    }
View Full Code Here

        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");
        if (eWorkPhone != null && ! eWorkPhone.equals(""))
        {
          String eWorkPhoneExt = (String)contactForm.get("entityWorkPhoneExt");
          newEntity.setMOC(syncUtils.createNewPhoneMoc(eWorkPhone, eWorkPhoneExt, "Work", Constants.MOC_WORK));    // (content, ext, syncAs, mocType)
        }

        // set homePhone
        String eHomePhone = (String)contactForm.get("entityHomePhone");
        if (eHomePhone != null && ! eHomePhone.equals(""))
        {
          String eHomePhoneExt = (String)contactForm.get("entityHomePhoneExt");
          newEntity.setMOC(syncUtils.createNewPhoneMoc(eHomePhone, eHomePhoneExt, "Home", Constants.MOC_HOME));    // (content, ext, syncAs, mocType)
        }

        // set FaxPhone
        String eFaxPhone = (String)contactForm.get("entityFaxPhone");
        if (eFaxPhone != null && ! eFaxPhone.equals(""))
        {
          String eFaxPhoneExt = (String)contactForm.get("entityFaxPhoneExt");
          newEntity.setMOC(syncUtils.createNewPhoneMoc(eFaxPhone, eFaxPhoneExt, "Fax", Constants.MOC_FAX));    // (content, ext, syncAs, mocType)
        }

        // set OtherPhone
        String eOtherPhone = (String)contactForm.get("entityOtherPhone");
        if (eOtherPhone != null && ! eOtherPhone.equals(""))
        {
          String eOtherPhoneExt = (String)contactForm.get("entityOtherPhoneExt");
          newEntity.setMOC(syncUtils.createNewPhoneMoc(eOtherPhone, eOtherPhoneExt, "Other", Constants.MOC_OTHER));    // (content, ext, syncAs, mocType)
        }

        // set MainPhone
        String eMainPhone = (String)contactForm.get("entityMainPhone");
        if (eMainPhone != null && ! eMainPhone.equals(""))
        {
          String eMainPhoneExt = (String)contactForm.get("entityMainPhoneExt");
          newEntity.setMOC(syncUtils.createNewPhoneMoc(eMainPhone, eMainPhoneExt, "Main", Constants.MOC_MAIN));    // (content, ext, syncAs, mocType)
        }

        // set PagerPhone
        String ePagerPhone = (String)contactForm.get("entityPagerPhone");
        if (ePagerPhone != null && ! ePagerPhone.equals(""))
        {
          String ePagerPhoneExt = (String)contactForm.get("entityPagerPhoneExt");
          newEntity.setMOC(syncUtils.createNewPhoneMoc(ePagerPhone, ePagerPhoneExt, "Pager", Constants.MOC_PAGER));    // (content, ext, syncAs, mocType)
        }

        // set MobilePhone
        String eMobilePhone = (String)contactForm.get("entityMobilePhone");
        if (eMobilePhone != null && ! eMobilePhone.equals(""))
        {
          String eMobilePhoneExt = (String)contactForm.get("entityMobilePhoneExt");
          newEntity.setMOC(syncUtils.createNewPhoneMoc(eMobilePhone, eMobilePhoneExt, "Mobile", Constants.MOC_MOBILE));    // (content, ext, syncAs, mocType)
        }
       
        // custom fields
        this.addCustomFields(newEntity, mailRemote.getValidFields("Entity"), contactForm);

        int newEntityID = cfremote.createEntity(newEntity, individualID);
        finalEntityID = newEntityID;
      }else{
        primaryContact = "No";
        // in this block, we're updating an existing entity
        // USE finalEntityID to update the existing entity
    // TODO: write code for updating existing entity       
      }

      // custom fields...
      this.addCustomFields(individualVO, mailRemote.getValidFields("Individual"), contactForm);

      // create the individual record via the ContactFacade
      individualVO.setEntityID(finalEntityID);
      individualVO.setIsPrimaryContact(primaryContact);
     
      newIndividualID = cfremote.createIndividual(individualVO, individualID);
     
      if (newIndividualID > 0)
      {
        // we need to make the IndividualList dirty, so that the next time
        // it is viewed, it is refreshed and contains the record we just added
View Full Code Here

  private GlobalMasterLists(String dataSource) {
    this.dataSource = dataSource;
    try {
      ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject(
          "com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade remote = cfh.create();
      remote.setDataSource(this.dataSource);

      Vector stateColl = remote.getStates();
      Vector countColl = remote.getCountry();
      Vector mocColl = remote.getMOCType();
      Vector syncAsColl = remote.getSyncAs();

      this.put("States", stateColl);
      this.put("Country", countColl);
      this.put("MOC", mocColl);
      this.put("SyncAs", syncAsColl);

      Vector userColl = remote.getUsers();
      this.put("Users", userColl);

      Vector groupColl = remote.getGroups();
      this.put("Groups", groupColl);

      Vector activityColl = new Vector();
      activityColl.add(new DDNameValue(1, "All"));
      activityColl.add(new DDNameValue(2, "Appointments"));
      activityColl.add(new DDNameValue(3, "Calls"));
      activityColl.add(new DDNameValue(4, "Next Actions"));
      activityColl.add(new DDNameValue(5, "Opportunity Info"));
      activityColl.add(new DDNameValue(6, "Project Info"));
      activityColl.add(new DDNameValue(7, "Events"));
      activityColl.add(new DDNameValue(8, "Multiple Actitivy Types"));

      this.put("Activities", activityColl);

      Vector timeZoneColl = new Vector();
      Date today = new Date();
      // this is used to prevent duplicates in the list
      ArrayList descriptionList = new ArrayList();
      String[] zoneIds = TimeZone.getAvailableIDs();
      for (int i=0; i<zoneIds.length; i++) {
        TimeZone tz = TimeZone.getTimeZone(zoneIds[i]);
        String shortName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.SHORT);
        String longName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.LONG);
        int offset = tz.getOffset(today.getTime());
        int hour = offset / (60*60*1000);
        int min = Math.abs(offset / (60*1000)) % 60;
        StringBuffer description = new StringBuffer();
        description.append(shortName+": ");
        description.append(longName);
        description.append(" (GMT");
        if(offset >= 0) {
          description.append("+");
        }
        description.append(hour);
        description.append(":");
        DecimalFormat df = new DecimalFormat("00");
        description.append(df.format(min));
        description.append(")");
        if (!descriptionList.contains(description)) {
          timeZoneColl.add(new DDNameValue(zoneIds[i], description.toString()));
          descriptionList.add(description);
        }
      }
      this.put("TimeZone", timeZoneColl);

      Vector timeSpanColl = new Vector();
      timeSpanColl.add(new DDNameValue(1, "1 Hour"));
      timeSpanColl.add(new DDNameValue(2, "30 Minutes"));
      timeSpanColl.add(new DDNameValue(3, "15 Minutes"));

      this.put("TimeSpan", timeSpanColl);

      SearchHome sh = (SearchHome)CVUtility.getHomeObject("com.centraview.search.SearchHome",
          "Search");
      Search rmt = sh.create();
      rmt.setDataSource(this.dataSource);
      HashMap hmp = rmt.getTableIdsAndNames();
      this.put("Tables", hmp);

      setSupportLists();

      AccountHelperHome hm = (AccountHelperHome)CVUtility.getHomeObject(
          "com.centraview.account.helper.AccountHelperHome", "AccountHelper");
      AccountHelper accHelper = hm.create();
      accHelper.setDataSource(this.dataSource);

      Vector itemTypesVec = accHelper.getItemTypes();
      this.put("ItemTypes", itemTypesVec);

      Vector glAccountsVec = accHelper.getGLAccounts();
      this.put("GLAccounts", glAccountsVec);

      Vector accountingStatusVec = accHelper.getAccountingStatus();
      this.put("AccountingStatus", accountingStatusVec);

      Vector accountingTermsVec = accHelper.getAccountingTerms();
      this.put("AccountingTerms", accountingTermsVec);

      Vector paymentMethodsVec = accHelper.getPaymentMethods();
      this.put("PaymentMethods", paymentMethodsVec);

      Vector locationsVector = accHelper.getLocations();
      this.put("AccountingLocations", locationsVector);

      CommonHelperHome commonHelperHome = (CommonHelperHome)CVUtility.getHomeObject(
          "com.centraview.common.helper.CommonHelperHome", "CommonHelper");
      CommonHelper commonRemote = commonHelperHome.create();
      commonRemote.setDataSource(this.dataSource);

      allSource = commonRemote.getAllSource();
      this.put("AllSource", allSource);

      HashMap moduleList = commonRemote.getModuleList();
      this.put("moduleList", moduleList);

      setSupportLists();
      setSaleLists();

      Vector mocTypes = remote.getMOCType();
      if (mocTypes != null && mocTypes.size() > 0) {
        Iterator iter = mocTypes.iterator();
        while (iter.hasNext()) {
          DDNameValue row = (DDNameValue)iter.next();
          String name = row.getName();
View Full Code Here

      IndividualVO individualVO;
      AddressVO addressVO = null;

      ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade remote = (ContactFacade)cfh.create();
      remote.setDataSource(dataSource);

      session.setAttribute("highlightmodule", "preferences");
      individualVO = remote.getIndividual(individualID);
      individualVO.populateFormBean(dynaForm);     

      if (individualVO.getUserName() != null)
      {
        dynaForm.set("userName", individualVO.getUserName());
View Full Code Here

  {
    String entityName = "ENTITYNAME";
    HashMap names = new HashMap();
    try {
      ContactFacadeHome contactFacadeHome = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade contactFacade = (ContactFacade)contactFacadeHome.create();
      contactFacade.setDataSource(dataSource);
      EntityVO entityVO = contactFacade.getEntity(1);
      entityName = entityVO.getName();
      IndividualVO individualVO = entityVO.getIndividualVO();
      StringBuffer individualName = new StringBuffer();
      if (individualVO != null) {
        individualName.append(individualVO.getFirstName());
View Full Code Here

        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade remote = (ContactFacade)cfh.create();
      remote.setDataSource(dataSource);
      IndividualVO individualVO = new IndividualVOX(form, request, dataSource);

      if (typeOfSave.equals("save"))
      {
        try {
          remote.updateIndividual(individualVO, individualId);
          } catch (Exception e) {
            logger.error("[execute] Exception thrown.", e);
            throw new ServletException(e);
          }
        request.setAttribute("TYPEOFOPERATION", "EDIT");
View Full Code Here

        request.setAttribute("isPublic","Yes");
      }


      ContactFacadeHome facadeHome = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade cfremote = (ContactFacade)facadeHome.create();
      cfremote.setDataSource(dataSource);

      // get the records from the database
      Collection sqlResults = cfremote.getUserListCollection(uid);

      // now create a DisplayList out of those records
      IndividualList employeeList = new IndividualList();

      // ok, now that we have the results from the database,
View Full Code Here

    // TODO Remove this once the lookup controller is done.
    // This is for the marketinglist drop down.
    try {
      ContactFacadeHome contactFacadeHome = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade remote = contactFacadeHome.create();
      remote.setDataSource(dataSource);
      Vector marketingLists = remote.getDBList(individualId);
      request.setAttribute("marketingLists", marketingLists);
      request.setAttribute("AllDBList", marketingLists);
    } catch (CreateException ce) {
      logger.error("Exception thrown in EmailLookupValueListAction.", ce);
    }
View Full Code Here

  public PrintTemplateField IndividualValues(int individualId, String dataSource)
  {
    PrintTemplateField printTemplateField = new PrintTemplateField();
    try {
      ContactFacadeHome aa = (ContactFacadeHome) CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade remote = aa.create();
      remote.setDataSource(dataSource);
      IndividualVO individualVOReference = remote.getIndividual(individualId);
      printTemplateField.setIndividualID(String.valueOf(individualId));
      printTemplateField.setEntityID(String.valueOf(individualVOReference.getEntityID()));
      int entityId = individualVOReference.getEntityID();
      if (entityId != 0) {
        EntityVO evo = remote.getEntity(entityId);
        printTemplateField.setCompany(evo.getName());
      }
      // set the Primary information of the individual
      printTemplateField.setFirstName(individualVOReference.getFirstName());
      printTemplateField.setMiddleInitial(individualVOReference.getMiddleName());
View Full Code Here

TOP

Related Classes of com.centraview.contact.contactfacade.ContactFacade

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.