Package com.centraview.report.valueobject

Examples of com.centraview.report.valueobject.ReportContentString


  public void processReport(int i, Vector res, ArrayList result)
  {
    int size = 0;
    int rowSize = 0;
    ReportContentString contentRow = null;
    ArrayList row = null;
    ArrayList outputRow = null;
    Object column = null;
    ListElementMember element = null;
    int leaderCount = 0;
    String previousLeaderValue = null;
    String currentLeaderValue = "";
    int leaderHeaderIndex = 0;

    ReportColumn[] cols = getColumns();
    int colNumber = cols.length;
    int rowId = 0;

    switch (i) {
      case 0:
        size = res.size();

        // set leader line index
        leaderHeaderIndex = result.size();

        // set header line
        result.add(getTableHeader());

        for (int j = 0; j < size; ++j) {
          row = (ArrayList) res.get(j);
          contentRow = new ReportContentString();
          outputRow = new ArrayList();
          rowSize = row.size();
          for (int k = 0; k < rowSize; ++k) {
            if (k < colNumber) {
              column = row.get(k);
              element = outputObject(column, getColumnName(k));
              if (cols[k].isVisible()) {
                outputRow.add(element);
              }
              if (k == getLeader()) {
                // get leader column value
                currentLeaderValue = element.getDisplayString();
              }
              if (k == 0) {
                rowId = Integer.parseInt(column.toString());
              }
            }

          }
          if (previousLeaderValue == null || !previousLeaderValue.equals(currentLeaderValue)) {
            // leader changed, now we need form header for

            if (leaderCount > 0) {
              // add header line for previous leader(leader name and Record
              // Count)
              result.add(leaderHeaderIndex, getLeaderHeader(previousLeaderValue, leaderCount));
              // add end table line
              result.add(getTableEnd());
              // add table header line for new leader
              result.add(getTableHeader());
            }

            previousLeaderValue = currentLeaderValue; // set new leader

            leaderCount = 0; // reset leaderCount
            leaderHeaderIndex = result.size() - 1; // set new header index
          }
          ++leaderCount;

          contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);

          contentRow.setReportRow(outputRow);

          if (reportId == CONTACTS2_REPORT_ID) {
            try {
              addCustomFieldValues(contentRow, rowId);
            } catch (Exception e) {}
View Full Code Here


   * @param leaderCount int
   * @return ReportContentString
   */
  private ReportContentString getLeaderHeader(String leaderValue, int leaderCount)
  {
    ReportContentString headerRow = new ReportContentString();
    ArrayList header = new ArrayList();
    headerRow.setShowType(ReportContentString.SHOW_TYPE_LINE);

    header.add(new StringMember(getColumnName(getLeader()), getColumnName(getLeader()) + ":", 'r', "", 'T', false));

    header.add(new StringMember(getColumnName(getLeader()), leaderValue, 'r', "", 'T', false));

    header.add(new StringMember("Record Count", "Record Count" + ":", 'r', "", 'T', false));

    header.add(new IntMember("Record Count", leaderCount, 'r', "", 'T', false, 10));

    headerRow.setReportRow(header);

    return headerRow;
  }
View Full Code Here

     *
     */
    public void processReport(int i, Vector res, ArrayList result) {
        int size = 0;
        int rowSize = 0;
        ReportContentString contentRow = null;
        ArrayList row = null;
        ArrayList outputRow = null;
        Object column = null;
        ListElementMember element = null;
        int totalCommitted = 0;
        int totalCompleted = 0;
        ReportColumn[] cols = getColumns();
        int colNumber = cols.length;

        switch (i) {
            case 0:
                size = res.size();

                // set header line
                result.add(getTableHeader());

                for (int j = 0; j < size; ++j) {

                    row = (ArrayList) res.get(j);
                    contentRow = new ReportContentString();
                    outputRow = new ArrayList();
                    rowSize = row.size();
                    for (int k = 0; k < rowSize; ++k) {

                        if (k < colNumber) {

                            column = row.get(k);
                            element = outputObject(column, getColumnName(k));
                            if (k == 2) {
                                // calculate total time committed
                                try {
                                    totalCommitted +=
                                        Integer.parseInt(element.getDisplayString());
                                }
                                catch (Exception e) {}
                            }
                            else if (k == 3) {
                                // calculate total time completed
                                try {
                                    totalCompleted +=
                                        Integer.parseInt(element.getDisplayString());
                                }
                                catch (Exception e) {}
                            }
                            if (cols[k].isVisible()) {
                                outputRow.add(element);
                            }
                        }
                    }

                    contentRow.setShowType(ReportContentString.
                                           SHOW_TYPE_TABLE_ROW);
                    contentRow.setReportRow(outputRow);
                    result.add(contentRow);
                }

                // add Total times line
                if (size > 0) {
                    contentRow = new ReportContentString();
                    outputRow = new ArrayList();
                    outputRow.add(outputObject("Total", getColumnName(1)));
                    outputRow.add(outputObject(new Integer(totalCommitted),
                                               getColumnName(2)));
                    outputRow.add(outputObject(new Integer(totalCompleted),
                                               getColumnName(3)));
                    contentRow.setShowType(ReportContentString.
                                           SHOW_TYPE_TABLE_ROW);
                    contentRow.setReportRow(outputRow);
                    result.add(contentRow);
                }

                // add end table line
                result.add(getTableEnd());
View Full Code Here

   */

  public void processReport(int i,Vector res,ArrayList result){
    int size = 0;
    int rowSize = 0;
    ReportContentString contentRow = null;
    ArrayList row = null;
    ArrayList outputRow = null;
    Object column = null;
    ListElementMember element = null;
    int totalCount = 0;

    ReportColumn[] cols = getColumns();
    int colNumber = cols.length;

    switch (i) {
      case 0:
           size = res.size();

           // set header line
           result.add(getTableHeader());

           for (int j = 0; j<size; ++j) {

               row = (ArrayList)res.get(j);
               contentRow = new ReportContentString();
               outputRow = new ArrayList();
               rowSize = row.size();
               for (int k = 0; k < rowSize; ++k) {

                   if ( k < colNumber ) {

                     column = row.get(k);

                     element = outputObject(column, getColumnName(k));
                     if ( cols[k].isVisible() ) {
                         outputRow.add(element);
                     }

                     if ( k == 2 ) {
                        // calculate total activities
                        try {
                          totalCount += Integer.parseInt(element.getDisplayString());
                        }
                        catch (Exception e) {}
                     }
                   }
               }

               contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
               contentRow.setReportRow(outputRow);
               result.add(contentRow);
           }
           // add Total activities line
           contentRow = new ReportContentString();
           outputRow = new ArrayList();
           outputRow.add(outputObject("Total Activities",getColumnName(1)));
           outputRow.add(outputObject(new Integer(totalCount), getColumnName(1)));
           contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
           contentRow.setReportRow(outputRow);
           result.add(contentRow);
           // add end table line
           result.add(getTableEnd());
    }
  }
View Full Code Here

   *
   */
  public void processReport(int i,Vector res,ArrayList result){
    int size = 0;
    int rowSize = 0;
    ReportContentString contentRow = null;
    ArrayList row = null;
    ArrayList outputRow = null;
    Object column = null;
    ListElementMember element = null;
    int totalCount = 0;

    ReportColumn[] cols = getColumns();
    int colNumber = cols.length;

    switch (i) {
      case 0:
           size = res.size();

           // set header line
           result.add(getTableHeader());

           for (int j = 0; j<size; ++j) {

               row = (ArrayList)res.get(j);
               contentRow = new ReportContentString();
               outputRow = new ArrayList();
               rowSize = row.size();
               for (int k=0;k<rowSize;++k) {

                   if (k<colNumber && cols[k].isVisible()) {

                     column = row.get(k);
                     element = outputObject(column, getColumnName(k));
                     if (k==2) {
                        // calculate total activities
                        try {
                          totalCount += Integer.parseInt(element.getDisplayString());
                        }
                        catch (Exception e) {}
                     }
                     outputRow.add(element);
                   }
               }

               contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
               contentRow.setReportRow(outputRow);
               result.add(contentRow);
           }
           // add Total activities line
           if (size>0) {
             contentRow = new ReportContentString();
             outputRow = new ArrayList();
             outputRow.add(outputObject("Total Activities",getColumnName(1)));
             outputRow.add(outputObject(new Integer(totalCount), getColumnName(1)));
             contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
             contentRow.setReportRow(outputRow);
             result.add(contentRow);
           }
           // add end table line
           result.add(getTableEnd());
    }
View Full Code Here

   */
  public void processReport(int i, Vector queryResults, ArrayList reportOutput)
  {
    int numberOfRows = 0;
    int numberOfColumns = 0;
    ReportContentString contentRow = null;
    ArrayList row = null;
    ArrayList outputRow = null;
    Object column = null;
    ListElementMember element = null;
    String previousIndividualName = null;
    String currentIndividualName = "";
    int individualIndex = 0;
    String entityName = "";
    int entityIndex = 1;
    String accountManagerName = "";
    int amIndex = 2;
    int leaderHeaderIndex = 0;
   
    ReportColumn[] cols = getColumns();
    int colNumber = cols.length;
   
    numberOfRows = queryResults.size();
    // set leader line index
    leaderHeaderIndex = reportOutput.size();
    // set header line
    reportOutput.add(getTableHeader());
    // process each row.
    for (int j = 0; j < numberOfRows; ++j) {
      row = (ArrayList) queryResults.get(j);
      contentRow = new ReportContentString();
      outputRow = new ArrayList();
      numberOfColumns = row.size();
      // process each column
      for (int k = 0; k < numberOfColumns; ++k) {
        if (k < colNumber) {
          column = row.get(k);
          element = outputObject(column, getColumnName(k));
          if (cols[k].isVisible()) {
            outputRow.add(element);
          }
          if (k == individualIndex) {
            currentIndividualName = element.getDisplayString();
          }
          if (k == entityIndex) {
            entityName = element.getDisplayString();
          }
          if (k == amIndex) {
            accountManagerName = element.getDisplayString();
          }
        }
      }
      // update the leader info.
      if (previousIndividualName == null || !previousIndividualName.equals(currentIndividualName)) {
        // leader changed, now we need form header for
        reportOutput.add(leaderHeaderIndex, getLeaderHeader(previousIndividualName, entityName, accountManagerName));
        // add end table line
        reportOutput.add(getTableEnd());
        // add table header line for new leader
        reportOutput.add(getTableHeader());
        previousIndividualName = currentIndividualName; // set new leader
        leaderHeaderIndex = reportOutput.size() - 1; // set new header index
      }
      contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
      contentRow.setReportRow(outputRow);
      reportOutput.add(contentRow);
    }
    // add header line for last leader
    if (numberOfRows > 0) {
      reportOutput.add(leaderHeaderIndex, getLeaderHeader(previousIndividualName, entityName, accountManagerName));
View Full Code Here

    // add table end
    reportOutput.add(getTableEnd());
  }

  private ReportContentString getLeaderHeader(String individualName, String entityName, String accountManager) {
    ReportContentString headerRow = new ReportContentString();
    headerRow.setShowType(ReportContentString.SHOW_TYPE_LINE);
    ArrayList header = new ArrayList();
    header.add(new StringMember("Individual", "Individual:", 'r', "", 'T', false));
    header.add(new StringMember("Individual", individualName, 'r', "", 'T', false));
    header.add(new StringMember("Entity", "Entity:", 'r', "", 'T', false));
    header.add(new StringMember("Entity", entityName, 'r', "", 'T', false));
    header.add(new StringMember("AccountManager", "Account Manager:", 'r', "", 'T', false));
    header.add(new StringMember("AccountManager", accountManager, 'r', "", 'T', false));
    headerRow.setReportRow(header);
    return headerRow;
  }
View Full Code Here

   * @param subHeader boolean indicates type of table header
   * @return ReportContentString
   */
  private ReportContentString getTableHeader(boolean subHeader)
  {
    ReportContentString headerRow = new ReportContentString();
    ArrayList header = new ArrayList();
    int size = 0;
    headerRow.setShowType((subHeader) ? ReportContentString.SHOW_TYPE_TABLE_HEADER : ReportContentString.SHOW_TYPE_TABLE_SUBHEADER);

    ReportColumn[] colName = getColumns();
    // main fields
    size = (colName == null) ? 0 : colName.length;
    for (int i = 0; i < size; ++i) {
      if (colName[i].isVisible()) {
        header.add(new StringMember(colName[i].colName, colName[i].colName, 'r', "", 'T', false));
      }
    }
    // custom fields
    DDNameValue ddName = null;
    size = (customFields == null) ? 0 : customFields.size();
    for (int i = 0; i < size; ++i) {
      ddName = (DDNameValue) customFields.get(i);
      header.add(new StringMember(ddName.getName(), ddName.getName(), 'r', "", 'T', false));
    }

    headerRow.setReportRow(header);
    return headerRow;
  }
View Full Code Here

   * Returns empty table row
   * @return ReportContentString
   */
  public ReportContentString getEmptyTableRow()
  {
    ReportContentString headerRow = new ReportContentString();
    ArrayList header = new ArrayList();
    int size = 0;
    headerRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
    ReportColumn[] colName = getColumns();
    // main fields
    size = (colName == null) ? 0 : colName.length;
    for (int i = 0; i < size; ++i) {
      if (colName[i].isVisible()) {
        header.add(new StringMember(colName[i].colName, "", 'r', "", 'T', false));
      }
    }
    // custom fields
    DDNameValue ddName = null;
    size = (customFields == null) ? 0 : customFields.size();
    for (int i = 0; i < size; ++i) {
      ddName = (DDNameValue) customFields.get(i);
      header.add(new StringMember(ddName.getName(), "", 'r', "", 'T', false));
    }

    headerRow.setReportRow(header);
    return headerRow;
  }
View Full Code Here

   * Returns table end row
   * @return ReportContentString
   */
  public ReportContentString getTableEnd()
  {
    ReportContentString headerRow = new ReportContentString();
    headerRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_END);
    return headerRow;
  }
View Full Code Here

TOP

Related Classes of com.centraview.report.valueobject.ReportContentString

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.