Package com.centraview.contact.contactfacade

Examples of com.centraview.contact.contactfacade.ContactFacade


    // get the customer profile from the database
    ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome","ContactFacade");
   
    try {
      ContactFacade remote = (ContactFacade)cfh.create();
      remote.setDataSource(dataSource);
     
      // get the Entity record of the logged-in user's Entity
      EntityVO entityVO = (EntityVO)remote.getEntity(entityID);
     
      if (entityVO == null) {
        // let the user know something bad happened
        allErrors.add("error.general.databaseError", new ActionMessage("error.general.databaseError"));
        entityVO = new EntityVO();
View Full Code Here


      individualList.addElement(new DDNameValue("0#employee", "Employee"));
      individualList.addElement(new DDNameValue("0#allindividual", "All Individual"));

      ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject(
          "com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade remote = cfh.create();
      remote.setDataSource(dataSource);
      Vector allDBList = remote.getDBList(individualID);
      if (allDBList != null) {
        for (int dbcount = 0; dbcount < allDBList.size(); dbcount++) {
          DDNameValue dbInfo = (DDNameValue)allDBList.get(dbcount);
          String id = dbInfo.getStrid();
          String name = dbInfo.getName();
          individualList.addElement(new DDNameValue(id + "#individual", name));
        }
      }
      request.setAttribute("individualList", individualList);

      DDNameValue dbIDName = null;
      String dbID = "0";
      String tempDBID = "0";
      String dbName = "0";
      if (individualList != null && individualList.size() > 0) {
        dbIDName = (DDNameValue)individualList.get(0);
      }

      if (request.getParameter("dbID") == null
          && ((ActivityForm)form).getActivityAttendeesType() == null) {
        tempDBID = dbIDName.getStrid();
        if (tempDBID != null && tempDBID.length() > 0) {
          dbID = tempDBID.substring(0, tempDBID.indexOf("#"));
          dbName = tempDBID.substring(tempDBID.indexOf("#") + 1, tempDBID.length());
        }
      } else if (((ActivityForm)form).getActivityAttendeesType() != null) {
        tempDBID = ((ActivityForm)form).getActivityAttendeesType();
        if (tempDBID != null && tempDBID.length() > 0) {
          dbID = tempDBID.substring(0, tempDBID.indexOf("#"));
          dbName = tempDBID.substring(tempDBID.indexOf("#") + 1, tempDBID.length());
        }
      }

      Vector attendeeVec = new Vector();
      if (dbName != null && dbName.equals("employee")) {
        attendeeVec = new Vector();

        Collection sqlResults = remote.getEmployeeListCollection(individualID);

        // ok, now that we have the results from the database,
        // we need to generate a DisplayList object to pass
        // to the List View code (List.jsp)
        Iterator iter = sqlResults.iterator();
View Full Code Here

      String emailinvitation = ((ActivityForm)form).getActivityEmailInvitation();
      if (emailinvitation != null && emailinvitation.equals("on")) {
        ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject(
            "com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
        try {
          ContactFacade remote = cfh.create();
          remote.setDataSource(dataSource);
          // Static 2 because we are looking for the Individual's Primary Email
          // Address
          String emailAddress = remote.getPrimaryEmailAddress(IndividualId, 2);
          if (emailAddress == null || emailAddress.equals("")) {
            allErrors
                .add(
                    ActionMessages.GLOBAL_MESSAGE,
                    new ActionMessage(
                        "error.freeForm",
                        "Error while sending email invitations. You do not have an email address configured. Please configure a primary email address in order to send email invitations."));
            saveErrors(request, allErrors);
            return (mapping.findForward(FORWARD_save));
          }
        } catch (Exception e) {
          logger.error("[Exception] SaveActivityHandler.Execute Handler ", e);
        }
      }

      // call to activity facade
      ActivityFacadeHome activityFacade = (ActivityFacadeHome)CVUtility.getHomeObject(
          "com.centraview.activity.activityfacade.ActivityFacadeHome", "ActivityFacade");

      try {
        ActivityFacade remote = activityFacade.create();
        remote.setDataSource(dataSource);

        int rowId = remote.addActivity(activityVO, IndividualId);

        AuthorizationHome authHome = (AuthorizationHome)CVUtility.getHomeObject(
            "com.centraview.administration.authorization.AuthorizationHome", "Authorization");
        Authorization authRemote = authHome.create();
        authRemote.setDataSource(dataSource);
View Full Code Here

    String monitorMessage = "UNKNOWN";
    ContactFacadeHome contactFacadeHome = null;
    try {
      long startTime = System.currentTimeMillis();
      contactFacadeHome = (ContactFacadeHome) CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade contactRemote = contactFacadeHome.create();
      contactRemote.setDataSource(dataSource);
      EntityVO entityVO = contactRemote.getEntity(1);
      long endTime = System.currentTimeMillis();
      // How long it took to retreive data in milliseconds
      long msDataRetreival = (endTime - startTime);
      if (entityVO == null) {
        monitorMessage = "FAILED: Record Not Found";
View Full Code Here

    ArrayList deleteLog = new ArrayList();
    String rowId[] = request.getParameterValues("rowId");
    ContactFacadeHome contactFacadeHome = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome","ContactFacade");
    try
    {
      ContactFacade remote = contactFacadeHome.create();
      remote.setDataSource(dataSource);
      for (int i=0; i<rowId.length; i++)
      {
        if(rowId[i] != null && !rowId[i].equals(""))
        {
          int elementID = Integer.parseInt(rowId[i]);
          try
          {
            remote.deleteEntity(elementID, individualId);
          } catch(AuthorizationFailedException ae) {
            String errorMessage = ae.getExceptionDescription();
            deleteLog.add(errorMessage);
          } catch(RemoteException re) {
            logger.error("[execute] Exception thrown.", re);
View Full Code Here

        sourceListId = Integer.parseInt(sourceListID);
      }
      String entityID[] = request.getParameterValues("rowId");
      ContactFacadeHome aa = (ContactFacadeHome)CVUtility.getHomeObject(
          "com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
      ContactFacade remote = aa.create();
      remote.setDataSource(dataSource);

      if (userType.equals("ADMINISTRATOR")) {
        individualId = -1;
      }

      remote.entityMove(individualId, sourceListId, entityID);
    } catch (Exception e) {
      logger.error("[execute]: Exception", e);
    }
    return (mapping.findForward("success"));
  }
View Full Code Here

      {
        companyName = firstName + " " + lastName;
      }

      ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome","ContactFacade");
      ContactFacade remote = (ContactFacade)cfh.create();
      remote.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);

      // this will represent the new Individual we are creating
      IndividualVO individualVO = new IndividualVO();

      individualVO.setFirstName(firstName);
      individualVO.setMiddleName((String)contactForm.get("MI"));
      individualVO.setLastName(lastName);
      individualVO.setTitle((String)contactForm.get("title"));
      individualVO.setIsPrimaryContact(primaryContact);
      individualVO.setContactType(2);   // contactType 2 is "Individual"

      AddressVO primaryAddress = new AddressVO();

      primaryAddress.setIsPrimary("YES");
      primaryAddress.setStreet1((String)contactForm.get("street1"));
      primaryAddress.setStreet2((String)contactForm.get("street2"));
      primaryAddress.setCity((String)contactForm.get("city"));
      primaryAddress.setStateName((String)contactForm.get("state"));
      primaryAddress.setZip((String)contactForm.get("zipCode"));
      primaryAddress.setCountryName((String)contactForm.get("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");
      if (workPhone != null && (! workPhone.equals("")))
      {
        // create new MocVO object
        MethodOfContactVO workPhoneMocVO = new MethodOfContactVO();
       
        // set properties
        String workPhoneExt = (String)contactForm.get("workPhoneExt");
        if (workPhoneExt != null && ! workPhoneExt.equals(""))
        {
          workPhone = workPhone + "EXT" + workPhoneExt;
        }
        workPhoneMocVO.setContent(workPhone);
        workPhoneMocVO.setSyncAs("Work");
        workPhoneMocVO.setMocType(Constants.MOC_WORK);   // hardcoded to "Phone" type

        individualVO.setMOC(workPhoneMocVO);
      }

      // set homePhone
      String homePhone = (String)contactForm.get("homePhone");
      if (homePhone != null && (! homePhone.equals("")))
      {
        // create new MocVO object
        MethodOfContactVO homePhoneMocVO = new MethodOfContactVO();
       
        // set properties
        String homePhoneExt = (String)contactForm.get("homePhoneExt");
        if (homePhoneExt != null && ! homePhoneExt.equals(""))
        {
          homePhone = homePhone + "EXT" + homePhoneExt;
        }
        homePhoneMocVO.setContent(homePhone);
        homePhoneMocVO.setSyncAs("Home");
        homePhoneMocVO.setMocType(Constants.MOC_HOME);   // hardcoded to "Phone" type

        individualVO.setMOC(homePhoneMocVO);
      }

      // set faxPhone
      String faxPhone = (String)contactForm.get("faxPhone");
      if (faxPhone != null && (! faxPhone.equals("")))
      {
        // create new MocVO object
        MethodOfContactVO faxPhoneMocVO = new MethodOfContactVO();
       
        // set properties
        String faxPhoneExt = (String)contactForm.get("faxPhoneExt");
        if (faxPhoneExt != null && ! faxPhoneExt.equals(""))
        {
          faxPhone = faxPhone + "EXT" + faxPhoneExt;
        }
        faxPhoneMocVO.setContent(faxPhone);
        faxPhoneMocVO.setSyncAs("Fax");
        faxPhoneMocVO.setMocType(Constants.MOC_FAX);   // hardcoded to "Fax" type

        individualVO.setMOC(faxPhoneMocVO);
      }

      // set otherPhone
      String otherPhone = (String)contactForm.get("otherPhone");
      if (otherPhone != null && (! otherPhone.equals("")))
      {
        // create new MocVO object
        MethodOfContactVO otherPhoneMocVO = new MethodOfContactVO();
       
        // set properties
        String otherPhoneExt = (String)contactForm.get("otherPhoneExt");
        if (otherPhoneExt != null && ! otherPhoneExt.equals(""))
        {
          otherPhone = otherPhone + "EXT" + otherPhoneExt;
        }
        otherPhoneMocVO.setContent(otherPhone);
        otherPhoneMocVO.setSyncAs("Other");
        otherPhoneMocVO.setMocType(Constants.MOC_OTHER);   // hardcoded to "Phone" type

        individualVO.setMOC(otherPhoneMocVO);
      }

      // set mainPhone
      String mainPhone = (String)contactForm.get("mainPhone");
      if (mainPhone != null && (! mainPhone.equals("")))
      {
        // create new MocVO object
        MethodOfContactVO mainPhoneMocVO = new MethodOfContactVO();
       
        // set properties
        String mainPhoneExt = (String)contactForm.get("mainPhoneExt");
        if (mainPhoneExt != null && ! mainPhoneExt.equals(""))
        {
          mainPhone = mainPhone + "EXT" + mainPhoneExt;
        }
        mainPhoneMocVO.setContent(mainPhone);
        mainPhoneMocVO.setSyncAs("Main");
        mainPhoneMocVO.setMocType(Constants.MOC_MAIN);   // hardcoded to "Phone" type

        individualVO.setMOC(mainPhoneMocVO);
      }

      // set pagerPhone
      String pagerPhone = (String)contactForm.get("pagerPhone");
      if (pagerPhone != null && (! pagerPhone.equals("")))
      {
        // create new MocVO object
        MethodOfContactVO pagerPhoneMocVO = new MethodOfContactVO();
       
        // set properties
        String pagerPhoneExt = (String)contactForm.get("pagerPhoneExt");
        if (pagerPhoneExt != null && ! pagerPhoneExt.equals(""))
        {
          pagerPhone = pagerPhone + "EXT" + pagerPhoneExt;
        }
        pagerPhoneMocVO.setContent(pagerPhone);
        pagerPhoneMocVO.setSyncAs("Pager");
        pagerPhoneMocVO.setMocType(Constants.MOC_PAGER);   // hardcoded to "Phone" type

        individualVO.setMOC(pagerPhoneMocVO);
      }

      // set mobilePhone
      String mobilePhone = (String)contactForm.get("mobilePhone");
      if (mobilePhone != null && (! mobilePhone.equals("")))
      {
        // create new MocVO object
        MethodOfContactVO mobilePhoneMocVO = new MethodOfContactVO();
       
        // set properties
        String mobilePhoneExt = (String)contactForm.get("mobilePhoneExt");
        if (mobilePhoneExt != null && ! mobilePhoneExt.equals(""))
        {
          mobilePhone = mobilePhone + "EXT" + mobilePhoneExt;
        }
        mobilePhoneMocVO.setContent(mobilePhone);
        mobilePhoneMocVO.setSyncAs("Mobile");
        mobilePhoneMocVO.setMocType(Constants.MOC_MOBILE);   // hardcoded to "Mobile" type

        individualVO.setMOC(mobilePhoneMocVO);
      }

      // get notes field
      String notes = (String)contactForm.get("notes");
      boolean addNote = (notes != null && notes.length() > 0) ? true : false;

      // 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 companyID = 0;
      int finalEntityID = 0;
      boolean createNewEntity = false;
      if (companyName != null && (! companyName.equals("")))
      {
        companyID = sfremote.findCompanyNameMatch(companyName, individualID);

        if (companyID == 0)
        {
          createNewEntity = true;
        }else{
          finalEntityID = companyID;
        }
      }   // 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
      if (createNewEntity)
      {
        // we must have set the createNewEntity flag to true
        // above, when we checked for a matching entity name
        // in the database, and didn't find one.
        EntityVO newEntity = new EntityVO();
        newEntity.setContactType(1);    // contact type 1 = Entity
        newEntity.setName(companyName);

        // set the new Entity's primary Address equal to the
        // same data for the new Individual
        newEntity.setPrimaryAddress(primaryAddress);
       
        Vector indivMOCs = individualVO.getMOC();
        Iterator iter = indivMOCs.iterator();
        while (iter.hasNext())
        {
          // set the new Entity's methods of contacts equal
          // to the same data for the new Individual
          MethodOfContactVO tmpVO = (MethodOfContactVO)iter.next();
          newEntity.setMOC(tmpVO);
        }

        int newEntityID = remote.createEntity(newEntity, individualID);

        // Check to see if the user's preference is to create sync'ed
        // records as private. If so, delete all records from recordauthorisation
        // and publicrecords tables that link to the newly created records.
        if (syncAsPrivate)
        {
          ArrayList entityIDs = new ArrayList();
          try
          {
            entityIDs.add(new Integer(newEntityID));
          }catch(NumberFormatException nfe){
            // don't need to do anything, because we obviously didn't add an entity successfully.
          }
          sfremote.markRecordsPrivate(14, entityIDs);
        }

        finalEntityID = newEntityID;
        individualVO.setIsPrimaryContact("Yes");
      }
     
      // create the individual record via the ContactFacade
      individualVO.setEntityID(finalEntityID);
      int newIndividualID = remote.createIndividual(individualVO, individualID);
     
      if (newIndividualID != 0)
      {
        if (addNote)
        {
View Full Code Here

    ContactFacadeHome aa = (ContactFacadeHome)CVUtility.getHomeObject(
        "com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");

    try {
      ContactFacade remote = aa.create();
      remote.setDataSource(dataSource);

      int contactId = 0;
      try {
        contactId = Integer.parseInt((String)((DynaActionForm)form).get("recordID"));
      } catch (NumberFormatException nfe) {
        // carry on, we already set a default value
      }

      String listFor = (String)((DynaActionForm)form).get("listFor");
      int contactType = 1;
      if (listFor != null && listFor.equals("Entity")) {
        contactType = 1;
      } else if (listFor != null && listFor.equals("Individual")) {
        contactType = 2;
      }

      remote.createAddress(contactId, contactType, addVO, individualID);
    } catch (Exception e) {
      logger.error("[Exception] AddAddressHandler.Execute Handler ", e);
    }
    return status;
  }
View Full Code Here

      CustomFieldVO cfvo = remote.getCustomField(fieldId);

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

      cfvo.setRecordID(recordID);
      remoteContactFacade.updateModifiedBy(cfvo, individualID);
    } catch (Exception e) {
      logger.error("[Exception] UpdateCustomFieldHandler.perform  ", e);
    }
    return status;
  }
View Full Code Here

    ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome","ContactFacade");
    try
    {
      //call to EJB server
      int elementID = Integer.parseInt(key);
      ContactFacade remote =(ContactFacade)cfh.create();
      remote.setDataSource(this.dataSource);
      remote.deleteMOC(elementID,this.contactId,this.contactType);
      // User-rights for DeleteMOC ?
    }
    catch(AuthorizationFailedException ae){
      logger.error("[Exception] MOCList.deleteElement( int indvID, String String key )", ae);
    }//end of catch block
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.