Package java.util

Examples of java.util.Collection


    {
      CVDal dl = new CVDal(dataSource);
      dl.setSql("projecttask.gettaskactivity");
      dl.setInt(1, taskId);
      tdbvo.setActivityID(taskId);
      Collection col = dl.executeQuery();
      Iterator ite = col.iterator();
      if (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        tdbvo.setTitle((String)hm.get("title"));
        tdbvo.setActivityDetails((String)hm.get("details"));
        tdbvo.setCreatedBy(((Integer)hm.get("creator")).intValue());
        tdbvo.setCreatedOn((Timestamp)hm.get("created"));

        if (hm.get("modified") != null)
        {
          tdbvo.setModifiedOn((Timestamp)hm.get("modified"));
        }

        if (hm.get("owner") != null)
        {
          tdbvo.setOwner(((Integer)hm.get("owner")).intValue());
        }

        if (hm.get("modifiedby") != null)
        {
          tdbvo.setModifiedBy(((Integer)hm.get("modifiedby")).intValue());
        }

        if (hm.get("status") != null)
        {
          tdbvo.setStatus(((Integer)hm.get("status")).intValue());
        }

        if (hm.get("name") != null)
        {
          tdbvo.setSelectedStatus((String)hm.get("name"));
        }

        if (hm.get("start") != null)
        {
          Object o = hm.get("start");
          tdbvo.setStart((java.sql.Timestamp)o);
        }

        if (hm.get("duedate") != null)
        {
          Object ox = hm.get("duedate");
          tdbvo.setEnd((java.sql.Timestamp)ox);
        }

        tdbvo.fillAuditDetails(this.dataSource);
      }
      dl.clearParameters();

      dl.setSql("projecttask.gettask");
      dl.setInt(1, taskId);
      col = dl.executeQuery();
      ite = col.iterator();
      if (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        if (hm.get("projectid") != null)
        {
          tdbvo.setProjectID(((Long)hm.get("projectid")).intValue());
        }

        if (hm.get("parent") != null)
        {
          tdbvo.setParentID(((Long)hm.get("parent")).intValue());
        }

        if (hm.get("milestone") != null)
        {
          tdbvo.setIsMileStone((String)hm.get("milestone"));
        }

        if (hm.get("percentcomplete") != null)
        {
          tdbvo.setPercentComplete(((Long)hm.get("percentcomplete")).intValue());
        }

        if (hm.get("projecttitle") != null)
        {
          tdbvo.setProjectName((String)hm.get("projecttitle"));
        }

        if (hm.get("projecttaskcount") != null)
        {
          tdbvo.setProjectTaskCount(((Integer)hm.get("projecttaskcount")).intValue());
        }
      }   // end if (ite.hasNext())
      dl.clearParameters();

      dl.setSql("projecttask.gettaskassigned");
      dl.setInt(1, taskId);
      col = dl.executeQuery();
      ite = col.iterator();
      while (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        if (hm.get("individualid") != null)
        {
          tdbvo.setAssignedTo(((Long)hm.get("individualid")).intValue(), (String)hm.get("CONCAT(firstname, ' ' , lastname)"));
        }
      }
      dl.clearParameters();

      Collection col1 = null;
      Iterator ite1 = null;

      int activityid = -1;
      dl.setSql("projecttask.gettaskalert");
      dl.setInt(1, taskId);
      col = dl.executeQuery();
      ite = col.iterator();

      HashMap emaila = new HashMap();
      HashMap alerta = new HashMap();

      boolean email = false;
      boolean alert = false;

      while (ite.hasNext())
      {
        HashMap hm = (HashMap)ite.next();
        if (hm.get("actionid") != null)
        {
          activityid = ((Long)hm.get("actionid")).intValue();
        }
        dl.setSql("projecttask.gettaskalertaction");
        dl.setInt(1, activityid);
        col1 = dl.executeQuery();
        ite1 = col1.iterator();
        if (ite1.hasNext())
        {
          Object o = ite1.next();

          HashMap hhm = (HashMap)o;
View Full Code Here


  public int deleteTask(int taskId,int individualID)
  {
    CVDal cvdl = new CVDal(dataSource);
    cvdl.setSql("projecttask.getsubtask");
    cvdl.setInt(1, taskId);
    Collection col = cvdl.executeQuery();
    cvdl.clearParameters();

    deleteTask1(taskId,individualID);
    int activityID = 0;

    if (col != null)
    {
      Iterator it = col.iterator();
      while (it.hasNext())
      {
        HashMap hm = (HashMap)it.next();
        activityID = ((Long)hm.get("ActivityID")).intValue();
        deleteTask1(activityID,individualID);
View Full Code Here

      remote.setDataSource(dataSource);
      remote.deleteActivity(taskId,individualID);

      cvdl.setSql("projecttask.selecttaskaction");
      cvdl.setInt(1, taskId);
      Collection col = cvdl.executeQuery();
      Iterator itCount = col.iterator();
      if (itCount.hasNext())
      {
        HashMap hm = (HashMap)itCount.next();
        int actionId = ((Long)hm.get("actionid")).intValue();
        cvdl.setSql("projecttask.deletetaskalertaction");
View Full Code Here

    try
    {
      String query = "SELECT f.name, f.fieldName FROM mailimportfields f LEFT JOIN mailimporttypes t ON (f.typeID=t.typeID) WHERE t.name=?";
      cvdal.setSqlQuery(query);
      cvdal.setString(1, importType);
      Collection results = cvdal.executeQuery();
      if (results != null && results.size() > 0)
      {
        Iterator iter = results.iterator();
        while (iter.hasNext())
        {
          HashMap row = (HashMap)iter.next();
          validFields.add(row);
        }
View Full Code Here

      remote.setDataSource(this.dataSource);

      if (fieldType.equals("Both") || fieldType.equals("Individual"))
      {
        // Collections of hashmaps
        Collection individualCustomFields = remote.getCustomFieldImportData("individual");
        if (individualCustomFields != null && individualCustomFields.size() > 0)
        {
          Iterator indivIter = individualCustomFields.iterator();
          while (indivIter.hasNext())
          {
            HashMap field = (HashMap)indivIter.next();
            // hashmap to be added to the arraylist returned from this method
            HashMap fieldMap = new HashMap();
            String fieldName = (String)field.get("name");
            Number fieldID = (Number)field.get("customfieldid");
            fieldMap.put("fieldID", fieldID);
           
            fieldMap.put("name", fieldName);
            // strip all non-alphanumeric chars from fieldName
            fieldName = fieldName.replaceAll("[^\\w]", "");
            // prepend fieldname with "cf_" so we know this is a custom field
            fieldMap.put("fieldName", "cf_" + fieldName);
            validFields.add(fieldMap);
          }
        }
      }
     
      if (fieldType.equals("Both") || fieldType.equals("Entity"))
      {
        Collection entityCustomFields = remote.getCustomFieldImportData("entity");
        if (entityCustomFields != null && entityCustomFields.size() > 0)
        {
          Iterator entityIter = entityCustomFields.iterator();
          while (entityIter.hasNext())
          {
            HashMap field = (HashMap)entityIter.next();
            // hashmap to be added to the arraylist returned from this method
            HashMap fieldMap = new HashMap();
View Full Code Here

    }

    public static void print( java.io.PrintStream stream, Properties props ) {
        if (props != null) {
            Collection sorted = sortPropertiesForPrinting(props);
            for (Iterator it=sorted.iterator(); it.hasNext(); ) {
                String value = (String) it.next();
                stream.println(value);
            }
        }
    }
View Full Code Here

    }

    private static final String NEWLINE = "\n"; //$NON-NLS-1$
    public static String prettyPrint( Properties props ) {
        if (props != null) {
            Collection sorted = sortPropertiesForPrinting(props);
   
            StringBuffer outBuf = new StringBuffer();
   
            for (Iterator it=sorted.iterator(); it.hasNext(); ) {
                String value = (String) it.next();
                outBuf.append(value);
                outBuf.append(NEWLINE);
            }
   
View Full Code Here

    private static final String ASUFFIX = "'"; //$NON-NLS-1$
    private static final String TAB = "\t"; //$NON-NLS-1$

    public static Collection sortPropertiesForPrinting(Properties props) {

        Collection sortedProps = new ArrayList(props.size());

        List names = new ArrayList();
        Enumeration enumeration = props.propertyNames();
        while ( enumeration.hasMoreElements() ) {
            String name = (String) enumeration.nextElement();
            names.add(name);
        }
        Collections.sort(names);

        StringBuffer sb;

        for (Iterator nIt=names.iterator(); nIt.hasNext(); ) {
          String name = (String) nIt.next();

          String value = null;
          if (PasswordMaskUtil.doesNameEndWithPasswordSuffix(name)){
                value = PasswordMaskUtil.MASK_STRING;
          } else {
                value = props.getProperty(name);
                value= saveConvert(value, false);
          }

          name = saveConvert(name, true);

          sb = new StringBuffer(APREFIX);

          sb.append(name);
          sb.append(TAB);
          sb.append(AEQUAL);
          sb.append(value);
          sb.append(ASUFFIX);

//          sortedProps.add(APREFIX + name + TAB + AEQUAL + value + ASUFFIX);
          sortedProps.add(sb.toString());
        }

        return sortedProps;

    }
View Full Code Here

      }
    }
  }

  private Collection createReportResultList(List fieldNameList, Iterator objectIter) {
    Collection reportResultList = new ArrayList();

    while (objectIter.hasNext()) {
      Object object = objectIter.next();

      Class cls = null;
      try {
        cls = object.getClass();
        Iterator methodIter = fieldNameList.iterator();
        Map reportValueMap = new HashMap<String, String>();
        while (methodIter.hasNext()) {
          String fieldName = (String) methodIter.next();
          String methodName = fieldName;
          Method meth = cls.getMethod(methodName, (Class[]) null);
          Object retObj = meth.invoke(object, (Object[]) null);
          reportValueMap.put(fieldName, retObj);
        }
        reportResultList.add(reportValueMap);
      } catch (Throwable e) {
        System.err.println(e);
      }
    }
    return reportResultList;
View Full Code Here

    }
    return reportResultList;
  }

  private Collection createReportResultListForMatViewQuery(List fieldNameList, Iterator objectIter) {
    Collection reportResultList = new ArrayList();

    // Iterate through rows
    while (objectIter.hasNext()) {
      ArrayList<Object> columnValues = (ArrayList<Object>) objectIter.next();

      try {
        Iterator fieldIter = fieldNameList.iterator();
        Map reportValueMap = new HashMap<String, Object>();
        // Iterate through columns with a row
        for (Object columnValue : columnValues) {
          String fieldName = (String) fieldIter.next();
          reportValueMap.put(fieldName, columnValue);
        }
        reportResultList.add(reportValueMap);
      } catch (Throwable e) {
        System.err.println(e);
      }
    }
    return reportResultList;
View Full Code Here

TOP

Related Classes of java.util.Collection

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.