Examples of HashMap


Examples of java.util.HashMap

   *         this license.
   */
  private static final HashMap getEntityNameAndIndividualName(String dataSource)
  {
    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());
        individualName.append(" ");
        individualName.append(individualVO.getLastName());
      }
      names.put("entityName", entityName);
      names.put("individualName", individualName.toString());
    } catch (Exception e) {
      logger.error("[getEntityNameAndIndividualName] Exception thrown.", e);
    }
    return names;
  } //end of getEntityName method
View Full Code Here

Examples of java.util.HashMap

      if (flag == true)
      {
        MailMessage mailmessage = null;
        EmailFacade remote = (EmailFacade)cfh.create();

        HashMap hm = new HashMap();
        hm.put("MessageID", new Integer(messageID));
        mailmessage = remote.getMailMessage(individualID, hm);
        remote.setDataSource(dataSource);

        String mailIdList[] = { rowId };

        remote.emailMarkasRead(Integer.parseInt(folderid), 1, mailIdList);

        ArrayList to = mailmessage.getTo();
        ArrayList cc = mailmessage.getCc();

        String arrayTO[] = new String[to.size()];
        for (int i = 0; i < arrayTO.length; i++)
        {
          MailAddress ma = (MailAddress)to.get(i);
          arrayTO[i] = ma.getAddress();
        }

        String arrayCC[] = new String[cc.size()];
        for (int j = 0; j < arrayCC.length; j++)
        {
          com.centraview.email.getmail.MailAddress macc = (MailAddress)cc.get(j);
          arrayCC[j] = macc.getAddress();
        }

        dynaForm.set("MessageID", Integer.toString(messageID));

        //From
        if (mailmessage.getMailFrom() != null)
        {
          dynaForm.set("from", mailmessage.getMailFrom());
        }
        // To
        if (arrayTO.length != 0)
        {
          dynaForm.set("to", arrayTO);
        }

        // CC
        if (arrayCC.length != 0)
        {
          dynaForm.set("cc", arrayCC);
        }

        //date
        if (mailmessage.getMessageDate() != null)
        {
          dynaForm.set("date", mailmessage.getMessageDate());
        }

        //subject
        if (mailmessage.getSubject() != null)
        {
          dynaForm.set("subject", mailmessage.getSubject());
        }

System.out.println("mailmessage.getSubject()"+mailmessage.getSubject());
        // body
        if (mailmessage.getBody() != null)
        {
          dynaForm.set("message", mailmessage.getBody());
        }
        if (mailmessage.getHeadersHM() != null)
        {
          HashMap hmHeader = (HashMap)mailmessage.getHeadersHM();
          String headerKey = (String)hmHeader.get(Constants.EH_SERVICE_KEY);
          if (headerKey != null)
          {
            String headerValue = null;
            if (headerKey.equals(Constants.EH_SERVICE_VALUE_ACTIVITY_INVITATION))
            {
              headerValue = (String)hmHeader.get(Constants.EH_ATTENDEE_STATUS_KEY);
              request.setAttribute("header", headerValue);
              String activityId = (String)hmHeader.get(Constants.EH_ACTIVITYID_KEY);
              request.setAttribute("activityId", activityId);

            }
            else if (headerKey.equals(Constants.EH_SERVICE_VALUE_CREATEINDIVIDUAL))
            {
              headerValue = (String)hmHeader.get(headerKey);
              headerValue = Constants.EH_SERVICE_VALUE_CREATEINDIVIDUAL;
              request.setAttribute("header", headerValue);
            }
            else if (headerKey.equals(Constants.EH_SERVICE_VALUE_INDIVIDUALIMPORTED))
            {
View Full Code Here

Examples of java.util.HashMap

      // get from session the form associated with windowid
      HttpSession session = request.getSession();

      // hashMap
      HashMap threadHashMap = null;
      // file form from session
      ThreadForm sessionForm = null;

      // get from request windowid
      String windowId = (String) request.getParameter(ThreadConstantKeys.WINDOWID);
      System.out.println("1");     
      if ((request.getParameter(ThreadConstantKeys.TYPEOFOPERATION).toString()).equals(ThreadConstantKeys.ADD)) {
        // hash map for add folder
        threadHashMap = (HashMap) session.getAttribute(ThreadConstantKeys.NEWTHREADHASHMAP);
        // get form from hashmap
        sessionForm = (ThreadForm) threadHashMap.get(windowId);
      }
      else if ((request.getParameter(ThreadConstantKeys.TYPEOFOPERATION).toString()).equals(ThreadConstantKeys.EDIT)) {
        // hash map for edit activity
        threadHashMap = (HashMap) session.getAttribute(ThreadConstantKeys.EDITTHREADHASHMAP);
        // get form from hashmap
        sessionForm = (ThreadForm) threadHashMap.get(windowId);
      }

      // get previous form values 
      ThreadForm previousForm = (ThreadForm) form;

      // set activity id if present
      if (previousForm.getThreadId() != null)
        sessionForm.setThreadId(previousForm.getThreadId());     

      // set form for previous permission values
      if (ThreadConstantKeys.DETAIL.equals(""))//(previousTab)) 
      {
        sessionForm.setTitle(previousForm.getTitle());
        sessionForm.setDetail(previousForm.getDetail());
        sessionForm.setPriorityId(previousForm.getPriorityId());
        sessionForm.setPriorityName(previousForm.getPriorityName());
      }

      // set the form back in session
      if ((request.getParameter(ThreadConstantKeys.TYPEOFOPERATION).toString()).equals(ThreadConstantKeys.ADD)) {     
        threadHashMap.put(windowId, sessionForm);
        session.setAttribute(ThreadConstantKeys.NEWTHREADHASHMAP, threadHashMap);
      }
      else if ((request.getParameter(ThreadConstantKeys.TYPEOFOPERATION).toString()).equals(ThreadConstantKeys.EDIT)) {
        threadHashMap.put(windowId, sessionForm);
        session.setAttribute(ThreadConstantKeys.EDITTHREADHASHMAP, threadHashMap);
      }
    }
    catch (Exception e) {
      e.printStackTrace();   
View Full Code Here

Examples of java.util.HashMap

      // get from session the form associated with windowid
      HttpSession session = request.getSession();

      // hashMap
      HashMap threadHashMap = null;
      // form from session
      ThreadForm sessionForm = null;

      // get from request windowid
      String windowId = (String) request.getParameter(ThreadConstantKeys.WINDOWID);

      if ((request.getParameter(ThreadConstantKeys.TYPEOFOPERATION).toString()).equals(ThreadConstantKeys.ADD)) {
        // hash map for add activity
        threadHashMap = (HashMap) session.getAttribute(ThreadConstantKeys.NEWTHREADHASHMAP);
        // get form from hashmap
        sessionForm = (ThreadForm) threadHashMap.get(windowId);
      }
      else if ((request.getParameter(ThreadConstantKeys.TYPEOFOPERATION).toString()).equals(ThreadConstantKeys.EDIT)) {
        // hash map for edit activity
        threadHashMap = (HashMap) session.getAttribute(ThreadConstantKeys.EDITTHREADHASHMAP);
        // get form from hashmap
        sessionForm = (ThreadForm) threadHashMap.get(windowId);
      }

      // get previous form values 
      ThreadForm currentForm = (ThreadForm) form;
View Full Code Here

Examples of org.apache.cocoon.util.HashMap

    public Map act( Redirector redirector, SourceResolver resolver, Map objectModel,
                    String source, Parameters param ) throws Exception {

        DataSourceComponent datasource = null;
        Connection conn = null;
        Map results = new HashMap();
        int rows = 0;

        // read global parameter settings
        boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;

        // call specific default modes apart from output mode are not supported
        // set request attribute
        String outputMode = param.getParameter("output", (String) defaultModeNames.get(MODE_OUTPUT));

        if (this.settings.containsKey("reloadable"))
            reloadable = Boolean.valueOf((String) this.settings.get("reloadable")).booleanValue();

        // read local parameter settings
        try {
            Configuration conf =
                this.getConfiguration(param.getParameter("descriptor", (String) this.settings.get("descriptor")),
                                      resolver,
                                      param.getParameterAsBoolean("reloadable",reloadable));

            // get database connection and try to turn off autocommit
            datasource = this.getDataSource(conf, param);
            conn = datasource.getConnection();
            if (conn.getAutoCommit() == true) {
                try {
                    conn.setAutoCommit(false);
                } catch (Exception ex) {
                    String tmp = param.getParameter("use-transactions",(String) this.settings.get("use-transactions",null));
                    if (tmp != null &&  (tmp.equalsIgnoreCase("no") || tmp.equalsIgnoreCase("false") || tmp.equalsIgnoreCase("0"))) {
                        if (getLogger().isErrorEnabled())
                            getLogger().error("This DB connection does not support transactions. If you want to risk your data's integrity by continuing nonetheless set parameter \"use-transactions\" to \"no\".");
                        throw ex;
                    }
                }
            }

            // find tables to work with
            Configuration[] tables = conf.getChildren("table");
            String tablesetname = param.getParameter("table-set", (String) this.settings.get("table-set"));

            Map modeTypes = null;

            if (tablesetname == null) {
                modeTypes = new HashMap(6);
                modeTypes.put( MODE_AUTOINCR, "autoincr" );
                modeTypes.put( MODE_OTHERS, "others" );
                modeTypes.put( MODE_OUTPUT, outputMode );
                for (int i=0; i<tables.length; i++) {
                    rows += processTable( tables[i], conn, objectModel, results, modeTypes );
                }
            } else {
                // new set based behaviour

                // create index for table names / aliases
                Map tableIndex = new HashMap(2*tables.length);
                String tableName = null;
                Object result = null;
                for (int i=0; i<tables.length; i++) {
                    tableName = tables[i].getAttribute("alias",tables[i].getAttribute("name",""));
                    result = tableIndex.put(tableName,new Integer(i));
                    if (result != null) {
                        throw new IOException("Duplicate table entry for "+tableName+" at positions "+result+" and "+i);
                    }
                }

                Configuration[] tablesets = conf.getChildren("table-set");
                String setname = null;
                boolean found = false;

                // find tables contained in tableset
                int j = 0;
                for (j=0; j<tablesets.length; j++) {
                    setname = tablesets[j].getAttribute ("name", "");
                    if (tablesetname.trim().equals (setname.trim ())) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    throw new IOException(" given set " + tablesetname + " does not exists in a description file.");
                }

                Configuration[] set = tablesets[j].getChildren("table");

                for (int i=0; i<set.length; i++) {
                    // look for alternative mode types
                    modeTypes = new HashMap(6);
                    modeTypes.put( MODE_AUTOINCR, set[i].getAttribute( "autoincr-mode", "autoincr" ) );
                    modeTypes.put( MODE_OTHERS, set[i].getAttribute( "others-mode",   "others" ) );
                    modeTypes.put( MODE_OUTPUT, outputMode );
                    tableName=set[i].getAttribute("name","");
                    if (tableIndex.containsKey(tableName)) {
                        j = ((Integer)tableIndex.get(tableName)).intValue();
                        rows += processTable( tables[j], conn, objectModel, results, modeTypes );
                    } else {
                        throw new IOException(" given table " + tableName + " does not exists in a description file.");
                    }
                }
            }

            if (conn.getAutoCommit()==false)
                conn.commit();

            // obtain output mode module and rollback output
            ComponentSelector outputSelector = null;
            OutputModule output = null;
            try {
                outputSelector=(ComponentSelector) this.manager.lookup(OUTPUT_MODULE_SELECTOR);
                if (outputMode != null && outputSelector != null && outputSelector.hasComponent(outputMode)){
                    output = (OutputModule) outputSelector.select(outputMode);
                }
                output.commit( null, objectModel );
            } catch (Exception e) {
                if (getLogger().isWarnEnabled()) {
                    getLogger().warn("Could not select output mode "
                                     + outputMode + ":" + e.getMessage());
                }
            } finally {
                if (outputSelector != null) {
                    if (output != null)
                        outputSelector.release(output);
                    this.manager.release(outputSelector);
                }
            }

        } catch (Exception e) {
            if ( conn != null ) {
                try {
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug( "Rolling back transaction. Caused by " + e.getMessage() );
                        e.printStackTrace();
                    }
                    conn.rollback();
                    results = null;

                    // obtain output mode module and commit output
                    ComponentSelector outputSelector = null;
                    OutputModule output = null;
                    try {
                        outputSelector=(ComponentSelector) this.manager.lookup(OUTPUT_MODULE_SELECTOR);
                        if (outputMode != null && outputSelector != null && outputSelector.hasComponent(outputMode)){
                            output = (OutputModule) outputSelector.select(outputMode);
                        }
                        output.rollback( null, objectModel, e);
                    } catch (Exception e2) {
                        if (getLogger().isWarnEnabled()) {
                            getLogger().warn("Could not select output mode "
                                       + outputMode + ":" + e2.getMessage());
                        }
                    } finally {
                        if (outputSelector != null) {
                            if (output != null)
                                outputSelector.release(output);
                            this.manager.release(outputSelector);
                        }
                    }

                } catch (SQLException se) {
                    if (getLogger().isDebugEnabled())
                        getLogger().debug("There was an error rolling back the transaction", se);
                }
            }

            //throw new ProcessingException("Could not add record :position = " + currentIndex, e);

            // don't throw an exception, an error has been signalled, that should suffice

            String throwException = (String) this.settings.get( "throw-exception",
                                                                param.getParameter( "throw-exception", null ) );
            if ( throwException != null &&
                 ( throwException.equalsIgnoreCase( "true" ) || throwException.equalsIgnoreCase( "yes" ) ) ) {
                throw new ProcessingException("Could not add record",e);
            }
        } finally {
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException sqe) {
                    getLogger().warn("There was an error closing the datasource", sqe);
                }
            }

            if (datasource != null)
                this.dbselector.release(datasource);
        }
        if (results != null) {
            if (rows>0) {
                results.put("row-count",new Integer(rows));
            } else {
                results = null;
            }
        } else {
            if (rows>0) {
                results = new HashMap(1);
                results.put("row-count",new Integer(rows));
            }
        }

        return results; // (results == null? results : Collections.unmodifiableMap(results));
View Full Code Here

Examples of org.hsqldb.lib.HashMap

    /**
     * Constructor.
     */
    Grantee(HsqlName name, GranteeManager man) {

        fullRightsMap       = new HashMap();
        directRightsMap     = new MultiValueHashMap();
        grantedRightsMap    = new MultiValueHashMap();
        granteeName         = name;
        granteeManager      = man;
        roles               = new OrderedHashSet();
View Full Code Here

Examples of org.hsqldb_voltpatches.lib.HashMap

                map = new HashMappedList();
                break;

            case SchemaObject.CONSTRAINT :
            case SchemaObject.INDEX :
                map = new HashMap();
                break;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.