Package com.centraview.common.helper

Examples of com.centraview.common.helper.CommonHelperLocal


    ArrayList folderPathList = new ArrayList();
    try
    {
      InitialContext ic = CVUtility.getInitialContext();
      CommonHelperLocalHome contactHelperHome = (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
      CommonHelperLocal contactHelperRemote =  contactHelperHome.create();
      contactHelperRemote.setDataSource(this.dataSource);
      folderPathList = contactHelperRemote.getFolderFullPath(folderID, "emailfolder");
    }catch(Exception e){
      logger.error("[getFolderFullPath] Exception thrown.", e);
    }
    return(folderPathList);
  }
View Full Code Here


    if (parentID <= 0){ return folderList; }

    try {
    InitialContext ic = CVUtility.getInitialContext();
    CommonHelperLocalHome commonHelperHome = (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
    CommonHelperLocal commonHelperRemote =  commonHelperHome.create();
    commonHelperRemote.setDataSource(this.dataSource);
    folderList = commonHelperRemote.getSubFolderList(individualID,parentID, "emailfolder");
    }catch(Exception e){
      logger.error("[getSubFolderList]: Exception", e);
    }
    return(folderList);
  }
View Full Code Here

      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;

      // Collect all the CustomfieldValue
      CustomFieldLocalHome homeCustomField = (CustomFieldLocalHome)ic.lookup("local/CustomField");
      CustomFieldLocal remoteCustomField =  homeCustomField.create();
      remoteCustomField.setDataSource(this.dataSource);

      HashMap CustomFieldValues = remoteCustomField.getCustomFieldValue();
      homeCustomField = null;
      remoteCustomField = null;

      ArrayList newEntityList = new ArrayList();
      ArrayList newIndividualList = new ArrayList();

      int errCounter = 0;

      //initalize the cvDal
      CVDal dl = new CVDal(dataSource);

      dl.setSqlQuery("SELECT a.PrimaryContact ,b.EntityId FROM individual a, "
        + "entity b WHERE a.Entity=b.EntityId AND PrimaryContact='YES' "
        + "AND a.list=" + listid);

      Collection col = dl.executeQuery();
      dl.clearParameters();

      HashMap primaryContactList = new HashMap();

      if (col != null) {
        Iterator it = col.iterator();

        while (it.hasNext()) {
          HashMap hm = (HashMap) it.next();
          String name = (String) hm.get("PrimaryContact");
          int id = ((Long) hm.get("EntityId")).intValue();
          primaryContactList.put(id + "", name.trim());
        }
      }

      int count = importList.size();

      ArrayList batchQuery = new ArrayList();
      int i = 0;
      while (i < importList.size()) {
        HashMap hCols = (HashMap) importList.get(0);
        line = (String) hCols.get("Line");
        String showLine = line;

        if (line != null && line.length() >25) {
          showLine = line.substring(0, 25);
        }
        entityPrimaryFlag = false;
        errMsg = "";

        if (hCols.size() == 0) {
          errMsg = "Delimitor doesn't Match Up!,";
          errCounter++;
        } else {
          fName = (String) hCols.get("First Name");
          lName = (String) hCols.get("Last Name");
          mName = (String) hCols.get("Middle Name");
          entity = (String) hCols.get("Entity Name");
          manager = (String) hCols.get("Account Manager");
          group = (String) hCols.get("Account Team");
          street1 = (String) hCols.get("Street1");
          street2 = (String) hCols.get("Street2");
          city = (String) hCols.get("City");
          state = (String) hCols.get("State");
          country = (String) hCols.get("Country");
          zip = (String) hCols.get("Zipcode");
          title = (String) hCols.get("Title");
          homePhone = (String) hCols.get("Home Phone");
          faxPhone = (String) hCols.get("Fax Phone");
          mainPhone = (String) hCols.get("Main Phone");
          mobilePhone = (String) hCols.get("Mobile Phone");
          otherPhone = (String) hCols.get("Other Phone");
          pagerPhone = (String) hCols.get("Pager Phone");
          workPhone = (String) hCols.get("Work Phone");
          email = (String) hCols.get("Email");
          entityExternalID = (String) hCols.get("ExternalID (Entity)");
          individualExternalID = (String) hCols.get("ExternalID (Individual)");
          sourceIndividual = (String) hCols.get("Source (Individual)");
          sourceEntity = (String) hCols.get("Source (Entity)");
          website = (String) hCols.get("Website");

          if (fName == null) {
            fName = "";
          }

          if (lName == null) {
            lName = "";
          }

          if (manager == null) {
            manager = "";
          }

          if (group == null) {
            group = "";
          }

          if (mName == null) {
            mName = "";
          }

          if (entity == null) {
            entity = "";
          }

          if (street1 == null) {
            street1 = "";
          }

          if (street2 == null) {
            street2 = "";
          }

          if (city == null) {
            city = "";
          }

          if (state == null) {
            state = "";
          }

          if (country == null) {
            country = "";
          }

          if (zip == null) {
            zip = "";
          }

          if (title == null) {
            title = "";
          }

          if (homePhone == null) {
            homePhone = "";
          }

          if (faxPhone == null) {
            faxPhone = "";
          }

          if (mainPhone == null) {
            mainPhone = "";
          }

          if (mobilePhone == null) {
            mobilePhone = "";
          }

          if (otherPhone == null) {
            otherPhone = "";
          }

          if (pagerPhone == null) {
            pagerPhone = "";
          }

          if (workPhone == null) {
            workPhone = "";
          }

          if (email == null) {
            email = "";
          }

          if (entityExternalID == null) {
            entityExternalID = "";
          }

          if (individualExternalID == null) {
            individualExternalID = "";
          }

          if (sourceIndividual == null) {
            sourceIndividual = "";
          }

          if (sourceEntity == null) {
            sourceEntity = "";
          }

          if (website == null) {
            website = "";
          }

          if ((fName.equals("")) && (lName.equals("")) && (website.equals("")) &&
              (manager.equals("")) && (group.equals("")) && (mName.equals("")) &&
              (entity.equals("")) && (street1.equals("")) &&
              (street2.equals("")) && (city.equals("")) && (state.equals("")) &&
              (country.equals("")) && (zip.equals("")) && (title.equals("")) &&
              (homePhone.equals("")) && (faxPhone.equals("")) &&
              (mainPhone.equals("")) && (mobilePhone.equals("")) &&
              (otherPhone.equals("")) && (pagerPhone.equals("")) &&
              (workPhone.equals("")) && (email.equals("")) &&
              (entityExternalID.equals("")) &&
              (individualExternalID.equals("")) &&
              (sourceIndividual.equals("")) && (sourceEntity.equals("")))
          {
            errMsg = errMsg + "Delimitor doesn't Match Up!,";
            errCounter++;
          } else {
            if (entity.equals("") || ((fName.equals("")) && (lName.equals("")))) {
              if (entity.equals("")) {
                errMsg = errMsg + "Entity is a Required Field,";
              }

              if (fName.equals("")) {
                errMsg = errMsg + "First Name is a Required Field,";
              }

              if (lName.equals("")) {
                errMsg = errMsg + "Last Name is a Required Field,";
              }

              errCounter++;
            } else {
              boolean flagInsert = true;

              if (! manager.equals("")) {
                int user = 0;
                boolean employeeFlag = employeeList.containsKey(manager);

                if (employeeFlag) {
                  user = Integer.parseInt((String) employeeList.get(manager));
                }

                if (user == 0) {
                  errMsg = errMsg + "Account Manager \"" + manager + "\" not found in Employee List,";
                  flagInsert = false;
                }
              }

              if (! group.equals("")) {
                // Get the group ID from the database
                int groupID = 0;

                // loop throught list and look for match
                Iterator itGroup = groupList.iterator();

                while (itGroup.hasNext()) {
                  DDNameValue nameValue = (DDNameValue) itGroup.next();

                  // if name matches, then...
                  if (group.equals(nameValue.getName())) {
                    // ... get the ID
                    groupID = nameValue.getId();
                  }
                }

                if (groupID == 0) {
                  errMsg = errMsg + "Account Team \"" + group + "\" not found in Group List,";
                  flagInsert = false;
                }
              }

              if ((CustomEntList != null) && (CustomEntList.size() > 0)) {
                Iterator it = CustomEntList.iterator();

                while (it.hasNext()) {
                  DDNameValue ddname = (DDNameValue) it.next();
                  String id = ddname.getName();

                  String type = null;

                  StringTokenizer st = new StringTokenizer(id, "*");

                  while (st.hasMoreTokens()) {
                    id = (String) st.nextToken();
                    type = (String) st.nextToken();
                  }

                  String name = ddname.getStrid();

                  String customEntityValue = (String) hCols.get(name);

                  if (customEntityValue != null) {
                    if ((type != null) && type.equals("MULTIPLE")) {
                      String tempEnt = customEntityValue;

                      int indexName = name.indexOf("(");


                      if (indexName > 0) {
                        customEntityValue = customEntityValue + "*" + name.substring(0, indexName);
                      }

                      boolean customFlag = CustomFieldValues.containsKey(customEntityValue);

                      if (! customFlag) {
                        errMsg = errMsg + "Custom Field \"" + tempEnt + "\" Mapped for Entity's Does Not Exist in the database ,";
                        flagInsert = false;
                      }
                    }
                  }
                }
              }

              if ((CustomIndList != null) && (CustomIndList.size() > 0)) {
                Iterator it = CustomIndList.iterator();

                while (it.hasNext()) {
                  DDNameValue ddname = (DDNameValue) it.next();
                  String id = ddname.getName();
                  String type = null;
                  StringTokenizer st = new StringTokenizer(id, "*");

                  while (st.hasMoreTokens()) {
                    id = (String) st.nextToken();
                    type = (String) st.nextToken();
                  }

                  String name = ddname.getStrid();
                  String customIndividualName = (String) hCols.get(name);

                  if (customIndividualName != null) {
                    if ((type != null) && type.equals("MULTIPLE")) {
                      String tempIndv = customIndividualName;

                      int indexName = name.indexOf("(");

                      if (indexName > 0) {
                        customIndividualName = customIndividualName + "*" + name.substring(0, indexName);
                      }

                      boolean customFlag = CustomFieldValues.containsKey(customIndividualName.trim());

                      if (!customFlag) {
                        errMsg = errMsg + "Custom Filed \"" + tempIndv + "\" mapped for Entity's Is Not Existing in the database ,";
                        flagInsert = false;
                      }
                    }
                  }
                }
              }

              if (!errMsg.equals("")) {
                errCounter++;
              }

              if (flagInsert) {
                int sourceId = 0;
                int sourceEn = 0;
                int entId = 0;

                boolean sourceFlag = sourceList.containsKey(sourceIndividual);

                if (sourceFlag) {
                  sourceId = Integer.parseInt((String) sourceList.get(sourceIndividual));
                } else {
                  if (sourceIndividual != null && !sourceIndividual.equals("")) {
                    try {
                      sourceId = remoteCommon.getSourceID(sourceIndividual);
                    } catch(Exception e) {
                      logger.error("[Exception] ListEJB.getImportList: ", e);
                    }
                  }
                }

                sourceFlag = sourceList.containsKey(sourceEntity);

                if (sourceFlag) {
                  sourceEn = Integer.parseInt((String) sourceList.get(sourceEntity));
                } else {
                  if (sourceEntity != null && !sourceEntity.equals("")) {
                    try {
                      sourceId = remoteCommon.getSourceID(sourceEntity);
                    } catch (Exception e) {
                      logger.error("[Exception] ListEJB.getImportList: ", e);
                      e.printStackTrace();
                    }
                  }
View Full Code Here

      IndividualLocalHome home = (IndividualLocalHome)ic.lookup("local/Individual");
      IndividualLocal remote =  home.findByPrimaryKey(new IndividualPK(indId,this.dataSource));
      // the ejbLoad will take care of setting the dataSource on a findByPrimaryKey.
      iv = remote.getIndividualVOWithBasicReferences();
      CommonHelperLocalHome chhome= (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
      CommonHelperLocal commonhelper= chhome.create();
      // we need to explicitly set the dataSource on a stateless session bean.
      commonhelper.setDataSource(dataSource);
      iv.setSourceName(commonhelper.getSourceName(iv.getSource()));
    }catch(Exception e){
      System.out.println("[Exception][ContactFacadeEJB.getIndividual] Exception Thrown: "+e);
      //e.printStackTrace();
    }
    return iv;
View Full Code Here

    {
      InitialContext ic = CVUtility.getInitialContext();
      EntityLocalHome home = (EntityLocalHome)ic.lookup("local/Entity");
      EntityLocal remote =  home.findByPrimaryKey(new EntityPK(entId,this.dataSource));
      CommonHelperLocalHome chhome= (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
      CommonHelperLocal commonhelper= chhome.create();
      // Explicitly set the dataSource on the stateless Session Bean.
      commonhelper.setDataSource(this.dataSource);
      ev = remote.getEntityVOWithBasicReferences();
      ev.setSourceName(commonhelper.getSourceName(ev.getSource()));
    } catch(Exception e)
    {
      System.out.println("[Exception][ContactFacadeEJB.getEntity] Exception Thrown: "+e);
      //e.printStackTrace();
    }
View Full Code Here

    HashMap sourceList = new HashMap();
    try
    {
      InitialContext ic = CVUtility.getInitialContext();
      CommonHelperLocalHome chhome= (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
      CommonHelperLocal commonhelper= chhome.create();
      commonhelper.setDataSource(dataSource);
      sourceList = commonhelper.getSourceList();
    } catch(Exception e)
    {
      System.out.println("[Exception][ContactFacadeEJB.getSourceList] Exception Thrown: "+e);
      //e.printStackTrace();
    }
View Full Code Here

    }else{
      String sourceName = entityVO.getSourceName();
      if (sourceName != null && !sourceName.equals("")) {
        try {
          CommonHelperLocalHome helperHome = (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
          CommonHelperLocal helperRemote =  helperHome.create();
          sourceID = helperRemote.getSourceID(sourceName);
        }catch(Exception e){
          logger.error("[ejbCreate] Exception thrown.", e);
        }
      }   // end if (sourceName != null && !sourceName.equals(""))
    }   // end if (entityVO.getSource() > 0)
View Full Code Here

        } else {
          String sourceName = this.envo.getSourceName();
          if (sourceName != null && !sourceName.equals("")) {
            try {
              CommonHelperLocalHome helperHome = (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
              CommonHelperLocal helperRemote = helperHome.create();
              sourceID = helperRemote.getSourceID(sourceName);
            } catch (Exception e) {
              logger.error("[ejbStore] Exception thrown.", e);
            }
          }
        }
View Full Code Here

        // Make sure we actually have a sourceName.
        if (sourceName != null && !sourceName.equals("")) {
          sourceID = 0; // just in case we fail
          try {
            CommonHelperLocalHome helperHome = (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
            CommonHelperLocal helperRemote = helperHome.create();
            // Give us an Id.
            sourceID = helperRemote.getSourceID(sourceName);
          } catch (Exception e) {
            logger.error("[ejbCreate] Exception thrown Adding new Source while Creating Individual", e);
          }
        } // end if (sourceName != null && !sourceName.equals(""))
      } // end if (individualDetail.getSource() > 0)
View Full Code Here

        } else {
          String sourceName = indVo.getSourceName();
          if (sourceName != null && !sourceName.equals("")) {
            try {
              CommonHelperLocalHome helperHome = (CommonHelperLocalHome)ic.lookup("local/CommonHelper");
              CommonHelperLocal helperRemote = helperHome.create();
              sourceID = helperRemote.getSourceID(sourceName);
            } catch (Exception e) {
              System.out.println("[Exception][IndividualEJB.ejbCreate] Exception Thrown: " + e);
              e.printStackTrace();
            }
          } // end if (sourceName != null && !sourceName.equals(""))
View Full Code Here

TOP

Related Classes of com.centraview.common.helper.CommonHelperLocal

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.