Package java.util

Examples of java.util.HashMap$KeyIterator


      {

        String[] lineSeprator = readline.split(lineDelimiter);
        for (int j = 0; j < lineSeprator.length; j++)
        {
          HashMap hm = new HashMap();
          int headerLen = listVector.size();
          String[] sFileFieldList = lineSeprator[j].split(tabDelimiter, (listVector.size() + 1));
          vectorColCounter = 0;
          int fieldLen = sFileFieldList.length;
          if (fieldLen == headerLen)
          {
            for (int k = 0; k < sFileFieldList.length; k++)
            {
              DDNameValue ddnamevalue = (DDNameValue)listVector.get(vectorColCounter);
              String name = ddnamevalue.getName() + vectorColCounter;
              String defValue = ddnamevalue.getName() + "DefaultValue" + vectorColCounter;
              String sDBFieldName = (String)request.getParameter(name);
              String defaultValue = (String)request.getParameter(defValue);
              if (sDBFieldName != null && !(sDBFieldName.equals("--- Select ---")))
              {

                String defaultNameList = sFileFieldList[k];
                if (defaultNameList == null && defaultValue != null)
                {
                  defaultNameList = defaultValue;
                } // end of if

                if (defaultNameList != null && defaultNameList.equals("") && defaultValue != null)
                {
                  defaultNameList = defaultValue;
                } // end of if

                defaultNameList = defaultNameList.replaceAll("\"", "");
                hm.put(sDBFieldName, defaultNameList.trim());
              } // end if block  to not allow (sDBFieldName.equals("--- Select ---")) and null
              vectorColCounter++;
            } // end of for block  used to parse every tabSeprator
          } //end of if block (fieldLen==headerLen)
          hm.put("Line", readline);
          importList.add(hm);
        } // end of for block  used to parse every lineSeprator
      } // end of while

      Collection CustomEntList = dyn.getCustomEntityList();
      Collection CustomIndList = dyn.getCustomIndividualList();

      if (tabDelimiter != null && tabDelimiter.equals("\\t"))
      {
        tabDelimiter = "\t";
      }

      if (lineDelimiter != null && lineDelimiter.equals("\\n"))
      {
        lineDelimiter = "\n";
      }

      //We will check for the instance of the BackgroundImportMembers. and start the import process in background
      BackgroundImportMembers backgroundImportMembers = (BackgroundImportMembers)session.getAttribute("backgroundImportMembers");
    if (backgroundImportMembers == null || !backgroundImportMembers.isAlive())
    {
    backgroundImportMembers = new BackgroundImportMembers(importList, headerRow, listid,
                indvID, CustomEntList, CustomIndList, tabDelimiter,
                lineDelimiter, headLine, dataSource,
                "backgroundImportMembers"+indvID);
    backgroundImportMembers.start();
    HashMap importMessage = backgroundImportMembers.getImportedMessages();
    request.setAttribute("Message", importMessage);
    session.setAttribute("backgroundImportMembers", backgroundImportMembers);
    }
   
    StringBuffer returnPath = new StringBuffer();
View Full Code Here


  /**
   *
   * Constructor
   */
  public QuestionList() {
    columnMap=new HashMap();


    columnMap.put("Question",new Integer(15));
    columnMap.put("Answer",new Integer(15));

View Full Code Here

    public int doStartTag() throws JspException {

      HttpSession session = ((HttpServletRequest)(pageContext.getRequest())).getSession();
     
      ModuleFieldRightMatrix mfrmx = ((UserObject)session.getAttribute("userobject")).getUserPref().getModuleAuthorizationMatrix();
      HashMap hm = mfrmx.getFieldRights(getModulename());
     
      if (hm != null && hm.containsKey(getFieldname()))
      {
        fieldRight =  ((Integer)hm.get(getFieldname())).intValue();
      }
   

        // Create an appropriate "input" element based on our parameters
        StringBuffer results = new StringBuffer("<input type=\"checkbox\"");
View Full Code Here

      String subject = (String) dynaform.get("templatesubject");
      String templatefrom = (String) dynaform.get("templatefrom");
      String templatereplyto = (String) dynaform.get("templatereplyto");
      String mergeType = (String) dynaform.get("mergetype");
      // list of Individual's ID
      HashMap individualIds = (HashMap) dynaform.get("toIndividuals");
      ArrayList templateList = new ArrayList();
      ArrayList emailList = new ArrayList();
      Vector fieldList = new Vector();
      fieldList.add("IndividualID");
      fieldList.add("EntityID");
      fieldList.add("Company");
      fieldList.add("FirstName");
      fieldList.add("MiddleInitial");
      fieldList.add("LastName");
      fieldList.add("Title");
      fieldList.add("PrimaryAddress");
      fieldList.add("Street1");
      fieldList.add("Street2");
      fieldList.add("City");
      fieldList.add("State");
      fieldList.add("Zip");
      fieldList.add("Country");
      fieldList.add("Website");
      fieldList.add("ExternalID");
      fieldList.add("Source");
      fieldList.add("Fax");
      fieldList.add("Home");
      fieldList.add("Main");
      fieldList.add("Mobile");
      fieldList.add("Other");
      fieldList.add("Pager");
      fieldList.add("Work");
      fieldList.add("Email");

      if (mergeType.equals("EMAIL")) {
        // Populating the ArrayList with the DDNameValue.
        ArrayList attachments = new ArrayList();
        String[] tempAttachmentMap = (String[]) dynaform.get("attachments");
        if (tempAttachmentMap != null && tempAttachmentMap.length > 0) {
          for (int i = 0; i < tempAttachmentMap.length; i++) {
            String fileKeyName = tempAttachmentMap[i];
            if (fileKeyName != null) {
              int indexOfHash = fileKeyName.indexOf("#");
              if (indexOfHash != -1) {
                int lenString = fileKeyName.length();
                String fileID = fileKeyName.substring(0, indexOfHash);
                String fileName = fileKeyName.substring(indexOfHash + 1, lenString);
                attachments.add(new DDNameValue(fileID + "#" + fileName, fileName));
              }
            }
          }// end of for(int i = 0; i < tempAttachmentMap.length; i++)
        }// end of if (tempAttachmentMap != null && tempAttachmentMap.size() >
          // 0)
        dynaform.set("attachmentList", attachments);
      }
      if (individualIds != null && individualIds.size() != 0) {
        Set key = individualIds.keySet();
        Iterator iterator = key.iterator();
        while (iterator.hasNext()) {
          String keyValue = (String) iterator.next();
          String tempData = ptData;
          int individualId = 0;
View Full Code Here

      HttpSession session = request.getSession(true);
      UserObject userobjectd = (UserObject)session.getAttribute("userobject");
      int individualid = userobjectd.getIndividualID();
      int eventid = Integer.parseInt(request.getParameter("eventid").toString());

      HashMap mapEvent = new HashMap();
      mapEvent.put("eventid", "" + eventid);
      mapEvent.put("individualid", "" + individualid);

      MarketingFacadeHome home = (MarketingFacadeHome)CVUtility.getHomeObject("com.centraview.marketing.marketingfacade.MarketingFacadeHome", "MarketingFacade");
      MarketingFacade remote = home.create();
      remote.setDataSource(dataSource);
      boolean isRegistered = remote.hasUserAcceptedEvent(eventid, individualid);

      String newAcceptedString = (!isRegistered) ? "YES" : "NO";

      mapEvent.put("accepted", newAcceptedString);

      remote.registerAttendee(mapEvent);

      request.setAttribute("eventid", "" + eventid);
View Full Code Here

  /**
   *
   * Constructor
   */
  public ThreadList() {
    columnMap=new HashMap();


    columnMap.put("Title",new Integer(15));
    columnMap.put("Description",new Integer(15));   
    columnMap.put("Created",new Integer(15));
View Full Code Here

      // get the list of individuals from the ejb layer
      Collection individualList = sfremote.getIndividualList(individualIDsession);

      ModuleFieldRightMatrix rightsMatrix = userObject.getUserPref().getModuleAuthorizationMatrix();
      HashMap indivFieldRights = rightsMatrix.getFieldRights("Individual");
      HashMap entityFieldRights = rightsMatrix.getFieldRights("Entity");

      // individualList shouldn't be null. If it is, there's a problem.
      // SyncFacadeEJB should always return a valid collection (an
      // empty Collection is still a valid Collection, but null is not).
      if (individualList != null)
      {
        // print the header row. Do it even if there are no individuals in the list
        writer.print("ContactID\tlastModified\tcompanyName\tfirstName\tMI\tlastName\ttitle\t");
        writer.print("street1\tstreet2\tcity\tstate\tzipCode\tcountry\t");
        writer.print("email\tworkPhone\thomePhone\tfaxPhone\totherPhone\tmainPhone\t");
        writer.print("pagerPhone\tmobilePhone\tworkPhoneExt\thomePhoneExt\tfaxPhoneExt\t");
        writer.print("otherPhoneExt\tmainPhoneExt\tpagerPhoneExt\tmobilePhoneExt\tnotes\n");

        // we successfully got the IndividualList, let's process it :-)
        if (individualList.size() > 0)
        {
          Iterator it = individualList.iterator();
         
          while (it.hasNext())
          {
            HashMap individualDetails = (HashMap)it.next();

            int individualID = ((Number)individualDetails.get("contactID")).intValue();

            // This hashmap will temporarily hold all field values until
            // we are ready to print them out. It will be helpful to us
            // when we need to encode special characters.
            HashMap record = new HashMap();

            // IndividualID
            record.put("ContactID", String.valueOf(individualID));

            //lastModifiedDate
            record.put("lastModified", syncUtils.formatDate((Timestamp)individualDetails.get("lastModified")));

            // First check field rights privileges (of certain fields),
            // if user has sufficient privilege, print field, if user
            // does not have sufficient privilege, print a "-".

            // ***IMPORTANT!!*** If the user does not have privilege to
            // a given field, CompanionLink expects a "-". Sending a null
            // or blank string will cause CompanionLink to believe this
            // is the CONTENT of the field, and will update the record
            // with that information. It is extremely important to make
            // sure this is done properly.

            // ***IMPORTANT!!*** It is also extremely important to note
            // that we can never set any field to the java NULL value. This
            // will cause "null" to be printed out to the CompanionLink
            // client, in which case CompanionLink will evaluate the String
            // "null" as the content of the field. Therefore, ALWAYS CHECK
            // FOR NULL VALUES BEFORE PRINTING!!! (or adding to our temp
            // HashMap)...

            // companyName
            if (((Integer)entityFieldRights.get("name")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String companyName = (String)individualDetails.get("companyName");
              record.put("companyName", (companyName != null) ? companyName : "");
            }else{
              record.put("companyName", "-");
            }
           
            // firstName
            if (((Integer)indivFieldRights.get("firstname")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String firstName = (String)individualDetails.get("firstName");
              record.put("firstName", (firstName != null) ? firstName : "");
            }else{
              record.put("firstName", "-");
            }
           
            // MI
            if (((Integer)indivFieldRights.get("middlename")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String middleName = (String)individualDetails.get("middleName");
              record.put("MI", (middleName != null) ? middleName : "");
            }else{
              record.put("MI", "-");
            }

            // lastName
            if (((Integer)indivFieldRights.get("lastname")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String lastName = (String)individualDetails.get("lastName");
              record.put("lastName", (lastName != null) ? lastName : "");
            }else{
              record.put("lastName", "-");
            }

            // title
            if (((Integer)indivFieldRights.get("title")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String title = (String)individualDetails.get("title");
              record.put("title", (title != null) ? title : "");
            }else{
              record.put("title", "-");
            }

            // Check field rights for address
            if (((Integer)indivFieldRights.get("address")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              // if user has view rights to address, show address data
              String street1 = (String)individualDetails.get("street1");
              record.put("street1", (street1 != null) ? street1 : "");
             
              String street2 = (String)individualDetails.get("street2");
              record.put("street2", (street2 != null) ? street2 : "");
             
              String city = (String)individualDetails.get("city");
              record.put("city", (city != null) ? city : "");
             
              String state = (String)individualDetails.get("state");
              record.put("state", (state != null) ? state : "");
             
              String zipCode = (String)individualDetails.get("zipCode");
              record.put("zipCode", (zipCode != null) ? zipCode : "");
             
              String country = (String)individualDetails.get("country");
              record.put("country", (country != null) ? country : "");
            }else{
              // user does not have field rights for address, so send dashes to CompanionLink
              record.put("street1", "-");
              record.put("street2", "-");
              record.put("city", "-");
              record.put("state", "-");
              record.put("zipCode", "-");
              record.put("country", "-");
            }

            String emailContent = new String("");
            String workPhone    = new String("");
            String workPhoneExt   = new String("");
            String homePhone    = new String("");
            String homePhoneExt   = new String("");
            String faxPhone     = new String("");
            String faxPhoneExt    = new String("");
            String otherPhone   = new String("");
            String otherPhoneExt  = new String("");
            String mainPhone    = new String("");
            String mainPhoneExt   = new String("");
            String pagerPhone   = new String("");
            String pagerPhoneExt  = new String("");
            String mobilePhone  = new String("");
            String mobilePhoneExt = new String("");
           
            if (((Integer)indivFieldRights.get("contactmethod")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              // If the user has privilege to view contact methods (they are not limited
              // individually; ie: "email" cannot be different than "homePhome"), then
              // get the data from the database and stick it in temp variables
              emailContent = (String)individualDetails.get("email");

              // NOTE that for all phone fields, we need to extract the extension
              // and store it in a separate variable because it's a separate field
              workPhone = (String)individualDetails.get("workPhone");
              if (workPhone != null && workPhone.indexOf("EXT") > 0)
              {
                String temp = workPhone;
                workPhone = temp.substring(0, temp.indexOf("EXT"));
                workPhoneExt = temp.substring(temp.indexOf("EXT") + 3, temp.length());
              }
             
              homePhone = (String)individualDetails.get("homePhone");
              if (homePhone != null && homePhone.indexOf("EXT") > 0)
              {
                String temp = homePhone;
                homePhone = temp.substring(0, temp.indexOf("EXT"));
                homePhoneExt = temp.substring(temp.indexOf("EXT") + 3, temp.length());
              }

              faxPhone = (String)individualDetails.get("faxPhone");
              if (faxPhone != null && faxPhone.indexOf("EXT") > 0)
              {
                String temp = faxPhone;
                faxPhone = temp.substring(0, temp.indexOf("EXT"));
                faxPhoneExt = temp.substring(temp.indexOf("EXT") + 3, temp.length());
              }

              otherPhone = (String)individualDetails.get("otherPhone");
              if (otherPhone != null && otherPhone.indexOf("EXT") > 0)
              {
                String temp = otherPhone;
                otherPhone = temp.substring(0, temp.indexOf("EXT"));
                otherPhoneExt = temp.substring(temp.indexOf("EXT") + 3, temp.length());
              }

              mainPhone = (String)individualDetails.get("mainPhone");
              if (mainPhone != null && mainPhone.indexOf("EXT") > 0)
              {
                String temp = mainPhone;
                mainPhone = temp.substring(0, temp.indexOf("EXT"));
                mainPhoneExt = temp.substring(temp.indexOf("EXT") + 3, temp.length());
              }

              pagerPhone = (String)individualDetails.get("pagerPhone");
              if (pagerPhone != null && pagerPhone.indexOf("EXT") > 0)
              {
                String temp = pagerPhone;
                pagerPhone = temp.substring(0, temp.indexOf("EXT"));
                pagerPhoneExt = temp.substring(temp.indexOf("EXT") + 3, temp.length());
              }

              mobilePhone = (String)individualDetails.get("mobilePhone");
              if (mobilePhone != null && mobilePhone.indexOf("EXT") > 0)
              {
                String temp = mobilePhone;
                mobilePhone = temp.substring(0, temp.indexOf("EXT"));
                mobilePhoneExt = temp.substring(temp.indexOf("EXT") + 3, temp.length());
              }
            }else{
              // If the user does NOT have privilege to view contact methods, then
              // set the content of all contact method variables to "-", which tells
              // CompanionLink that this is a restricted field.
              emailContent   = "-";
              workPhone      = "-";
              workPhoneExt   = "-";
              homePhone      = "-";
              homePhoneExt   = "-";
              faxPhone       = "-";
              faxPhoneExt    = "-";
              otherPhone     = "-";
              otherPhoneExt  = "-";
              mainPhone      = "-";
              mainPhoneExt   = "-";
              pagerPhone     = "-";
              pagerPhoneExt  = "-";
              mobilePhone    = "-";
              mobilePhoneExt = "-";
            }

            record.put("email", (emailContent != null) ? emailContent : "");
            record.put("workPhone", (workPhone != null) ? workPhone : "");
            record.put("workPhoneExt", (workPhoneExt != null) ? workPhoneExt : "");
            record.put("homePhone", (homePhone != null) ? homePhone : "");
            record.put("homePhoneExt", (homePhoneExt != null) ? homePhoneExt : "");
            record.put("faxPhone", (faxPhone != null) ? faxPhone : "");
            record.put("faxPhoneExt", (faxPhoneExt != null) ? faxPhoneExt : "");
            record.put("otherPhone", (otherPhone != null) ? otherPhone : "");
            record.put("otherPhoneExt", (otherPhoneExt != null) ? otherPhoneExt : "");
            record.put("mainPhone", (mainPhone != null) ? mainPhone : "");
            record.put("mainPhoneExt", (mainPhoneExt != null) ? mainPhoneExt : "");
            record.put("pagerPhone", (pagerPhone != null) ? pagerPhone : "");
            record.put("pagerPhoneExt", (pagerPhoneExt != null) ? pagerPhoneExt : "");
            record.put("mobilePhone", (mobilePhone != null) ? mobilePhone : "");
            record.put("mobilePhoneExt", (mobilePhoneExt != null) ? mobilePhoneExt : "");

            // notes
            String notes = (String)individualDetails.get("notes");
            record.put("notes", (notes != null) ? notes : "");

            // now encode all strings in the record properly
            record = syncUtils.encodeRecord(record);

            // time to print out the record and move on
            // DO NOT CHANGE THE ORDER OF THESE FIELDS!
            // NOTE that we did not add the "\t" delimiter
            // to each field, but instead we're adding it here
            // as we print out each field. That is because we
            // encode the "record" HashMap as a whole, and part
            // of that encoding encodes tabs into a non-printable
            // character. If we had added the tab to our fields,
            // then we would lose our field delimiter...
            writer.print(record.get("ContactID") + "\t");
            writer.print(record.get("lastModified") + "\t");
            writer.print(record.get("companyName") + "\t");
            writer.print(record.get("firstName") + "\t");
            writer.print(record.get("MI") + "\t");
            writer.print(record.get("lastName") + "\t");
            writer.print(record.get("title") + "\t");
            writer.print(record.get("street1") + "\t");
            writer.print(record.get("street2") + "\t");
            writer.print(record.get("city") + "\t");
            writer.print(record.get("state") + "\t");
            writer.print(record.get("zipCode") + "\t");
            writer.print(record.get("country") + "\t");
            writer.print(record.get("email") + "\t");
            writer.print(record.get("workPhone") + "\t");
            writer.print(record.get("homePhone") + "\t");
            writer.print(record.get("faxPhone") + "\t");
            writer.print(record.get("otherPhone") + "\t");
            writer.print(record.get("mainPhone") + "\t");
            writer.print(record.get("pagerPhone") + "\t");
            writer.print(record.get("mobilePhone") + "\t");
            writer.print(record.get("workPhoneExt") + "\t");
            writer.print(record.get("homePhoneExt") + "\t");
            writer.print(record.get("faxPhoneExt") + "\t");
            writer.print(record.get("otherPhoneExt") + "\t");
            writer.print(record.get("mainPhoneExt") + "\t");
            writer.print(record.get("pagerPhoneExt") + "\t");
            writer.print(record.get("mobilePhoneExt") + "\t");
            writer.print(record.get("notes") + "\n")// NOTE THE NEWLINE HERE!!!
          }   // end while (it.hasNext())  (individualList)

          ListGenerator lg = ListGenerator.getListGenerator(dataSource);
          lg.makeListDirty("Individual");
        }
View Full Code Here

    /**
     * Constructor.
     */
    public CodecCache() {
        m_codecMap = new HashMap();
    }
View Full Code Here

    /**
     * Constructor. This creates a pool for each supported media type, initially with a single instance of that codec.
     */
    public CodecPool() {
        m_codecMap = new HashMap();
        List mediaTypes = CodecDirectory.getMediaTypes();
        for (int i = 0; i < mediaTypes.size(); i++) {
            MediaType mediaType = (MediaType)mediaTypes.get(i);
            XmlCodec codec = CodecDirectory.getCodec(mediaType);
            if (codec != null) {
View Full Code Here

   * VO that is passed in.  The DBVO.  This method uses reflection to do all the dirty
   * work.
   */
  public static Object replaceVO(Object objDBVO, Object objUIVO, String moduleName, int individualId, String dataSource)
  {
    HashMap hm = new HashMap();
    try {
      InitialContext ic = CVUtility.getInitialContext();
      AuthorizationLocalHome home = (AuthorizationLocalHome) ic.lookup("local/Authorization");
      AuthorizationLocal local = home.create();
      local.setDataSource(dataSource);

      hm = local.getNoneRightFieldMethod(moduleName, individualId);
      if (hm != null) {
        Collection col = hm.values();
        Iterator it = col.iterator();

        Class clDB = objDBVO.getClass();
        Class clUI = objUIVO.getClass();

View Full Code Here

TOP

Related Classes of java.util.HashMap$KeyIterator

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.