Example usage for org.apache.poi.xssf.usermodel XSSFSheet createRow

List of usage examples for org.apache.poi.xssf.usermodel XSSFSheet createRow

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFSheet createRow.

Prototype

@Override
public XSSFRow createRow(int rownum) 

Source Link

Document

Create a new row within the sheet and return the high level representation Note: If a row already exists at this position, it is removed/overwritten and any existing cell is removed!

Usage

From source file:org.appdynamics.licensecount.file.WriteExcelDoc.java

public int addCustomer(XSSFSheet curSheet, int rowIndex) {
    // This going to add the customer information.
    int tempRowIndex = rowIndex;
    ArrayList<Row> rows = new ArrayList<Row>();
    for (int i = rowIndex; i < (rowIndex + 6); i++) {
        rows.add(curSheet.createRow(i));
    }//w w  w  . j a  v a  2 s  .  c  o  m

    Cell cell = null;
    for (int i = 0; i < 6; i++) {
        switch (i) {
        case 0:
            cell = rows.get(i).createCell(0);
            cell.setCellValue(customer.getName());
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.TOTAL_AGENT_COUNT);
            tempRowIndex++;
            break;
        case 1:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.JAVA_AGENT_COUNT);
            tempRowIndex++;
            break;

        case 2:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.DOTNET_AGENT_COUNT);
            tempRowIndex++;
            break;

        case 3:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.PHP_AGENT_COUNT);
            tempRowIndex++;
            break;

        case 4:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.NODEJS_AGENT_COUNT);
            tempRowIndex++;
            break;
        case 5:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.MACHINE_AGENT_COUNT);
            tempRowIndex++;
            break;
        default:
            break;
        }

    }

    int columnCount = 2;
    for (CustomerLicenseRange cRange : customer.getCustomerRangeValues()) {

        for (int i = 0; i < 6; i++) {
            switch (i) {
            case 0: //Total Count
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getTotalCount());
                break;
            case 1: //Java Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getJavaCount());
                break;

            case 2: //DotNet Agent
                cell = rows.get(i).createCell(columnCount);
                //cell.setCellValue(cRange.getIisCount());
                cell.setCellValue(cRange.getDotNetCount());
                cell.setCellStyle(style);
                break;

            case 3: //PHP Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getPhpCount());
                break;

            case 4: //NodeJS Agent
                cell = rows.get(i).createCell(columnCount);

                cell.setCellValue(cRange.getNodeJSCount_C());
                cell.setCellStyle(style);
                break;

            case 5: //Machine Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getMachineCount());
                break;

            default:
                break;
            }
        }
        columnCount++;
    }
    return tempRowIndex++;
}

From source file:org.appdynamics.licensecount.file.WriteExcelDoc.java

public int addApplication(XSSFSheet curSheet, int rowIndex, ApplicationLicenseCount appLicenseCount) {
    // This going to add the customer information.
    int tempRowIndex = rowIndex;
    ArrayList<Row> rows = new ArrayList<Row>();
    for (int i = rowIndex; i < (rowIndex + 6); i++) {
        rows.add(curSheet.createRow(i));
    }//from  w  w w  . ja va  2  s.  co m

    Cell cell = null;
    for (int i = 0; i < 6; i++) {
        switch (i) {
        case 0:
            cell = rows.get(i).createCell(0);
            cell.setCellValue(appLicenseCount.getApplicationName());
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.TOTAL_AGENT_COUNT);
            tempRowIndex++;
            break;
        case 1:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.JAVA_AGENT_COUNT);
            tempRowIndex++;
            break;

        case 2:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.DOTNET_AGENT_COUNT);
            tempRowIndex++;
            break;

        case 3:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.PHP_AGENT_COUNT);
            tempRowIndex++;
            break;

        case 4:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.NODEJS_AGENT_COUNT);
            tempRowIndex++;
            break;
        case 5:
            cell = rows.get(i).createCell(1);
            cell.setCellValue(LicenseS.MACHINE_AGENT_COUNT);
            tempRowIndex++;
            break;
        default:
            break;
        }

    }

    int columnCount = 2;
    for (ApplicationLicenseRange cRange : appLicenseCount.getAppLicenseRange()) {

        for (int i = 0; i < 6; i++) {
            switch (i) {
            case 0: //Total Count
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getTotalCount());
                break;
            case 1: //Java Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getJavaCount());

                break;

            case 2: //DotNet Agent
                cell = rows.get(i).createCell(columnCount);
                //logger.log(Level.INFO,new StringBuilder().append("Adding .Net ").append(cRange.getIisCount()).toString());
                //cell.setCellValue(new Double(cRange.getIisCount()));
                cell.setCellValue(cRange.getDotNetCount());
                cell.setCellStyle(style);

                break;

            case 3: //PHP Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(new Double(cRange.getPhpCount()));

                break;

            case 4: //NodeJS Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getNodeJSCount_TA());
                cell.setCellStyle(style);

                break;

            case 5: //Machine Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getMachineCount());

                break;

            default:
                break;
            }
        }
        columnCount++;
    }
    return tempRowIndex++;
}

From source file:org.appdynamics.licensecount.file.WriteExcelDoc.java

public int addTier(XSSFSheet curSheet, int rowIndex, TierLicenseCount tLicenseCount, String appName,
        int inCount) {
    // This going to add the customer information.
    int tempRowIndex = rowIndex;
    ArrayList<Row> rows = new ArrayList<Row>();
    for (int i = rowIndex; i < (rowIndex + 6); i++) {
        rows.add(curSheet.createRow(i));
    }//  w  w w  . j a v a  2s.  c  o  m

    Cell cell = null;
    for (int i = 0; i < 6; i++) {
        switch (i) {
        case 0:
            if (inCount == 0) {
                cell = rows.get(i).createCell(0);
                cell.setCellValue(appName);
            }
            cell = rows.get(i).createCell(1);
            cell.setCellValue(tLicenseCount.getName());
            cell = rows.get(i).createCell(2);
            cell.setCellValue(LicenseS.TOTAL_AGENT_COUNT);
            tempRowIndex++;
            break;
        case 1:
            cell = rows.get(i).createCell(2);
            cell.setCellValue(LicenseS.JAVA_AGENT_COUNT);
            tempRowIndex++;
            break;

        case 2:
            cell = rows.get(i).createCell(2);
            cell.setCellValue(LicenseS.DOTNET_AGENT_COUNT);
            tempRowIndex++;
            break;

        case 3:
            cell = rows.get(i).createCell(2);
            cell.setCellValue(LicenseS.PHP_AGENT_COUNT);
            tempRowIndex++;
            break;

        case 4:
            cell = rows.get(i).createCell(2);
            cell.setCellValue(LicenseS.NODEJS_AGENT_COUNT);
            tempRowIndex++;
            break;
        case 5:
            cell = rows.get(i).createCell(2);
            cell.setCellValue(LicenseS.MACHINE_AGENT_COUNT);
            tempRowIndex++;
            break;
        default:
            break;
        }

    }

    int columnCount = 3;
    for (TierLicenseRange cRange : tLicenseCount.getTierLicenseRange()) {

        for (int i = 0; i < 6; i++) {
            switch (i) {
            case 0: //Total Count
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getTotalCount());
                break;
            case 1: //Java Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getJavaCount());

                break;

            case 2: //DotNet Agent
                cell = rows.get(i).createCell(columnCount);
                //logger.log(Level.INFO,new StringBuilder().append("Adding .Net ").append(cRange.getIisCount()).toString());
                //cell.setCellValue(new Double(cRange.getIisCount()));
                cell.setCellValue(cRange.getDotNetCount());
                cell.setCellStyle(style);
                break;

            case 3: //PHP Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(new Double(cRange.getPhpCount()));

                break;

            case 4: //NodeJS Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getNodeJSCount_TA());
                cell.setCellStyle(style);

                break;

            case 5: //Machine Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getMachineCount());

                break;

            default:
                break;
            }
        }
        columnCount++;
    }
    tempRowIndex++;
    return tempRowIndex++;
}

From source file:org.appdynamics.licensecount.file.WriteExcelDoc.java

public int addHourlyTier(XSSFSheet curSheet, int rowIndex, TierLicenseCount tLicenseCount, String appName,
        int inCount) {
    // This going to add the customer information.
    int tempRowIndex = rowIndex;
    ArrayList<Row> rows = new ArrayList<Row>();
    for (int i = rowIndex; i < (rowIndex + 2); i++) {
        rows.add(curSheet.createRow(i));
    }/*from  ww  w.  j a v a 2  s  . co m*/

    Cell cell = null;
    for (int i = 0; i < 2; i++) {
        switch (i) {
        case 0:
            if (inCount == 0) {
                //cell = rows.get(i).createCell(0);
                //cell.setCellValue(appName); 
            }
            cell = rows.get(i).createCell(1);
            cell.setCellValue(tLicenseCount.getName());
            cell = rows.get(i).createCell(2);
            cell.setCellValue(LicenseS.MACHINE_AGENT_COUNT);
            tempRowIndex++;
            break;
        case 1:
            cell = rows.get(i).createCell(2);
            cell.setCellValue(LicenseS.APPLICATION_AGENT_COUNT);
            tempRowIndex++;
            break;

        default:
            break;
        }

    }

    int columnCount = 3;
    for (TierHourLicenseRange cRange : tLicenseCount.getTierHourLicenseRange()) {

        for (int i = 0; i < 2; i++) {
            switch (i) {
            case 0: //Total Count
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getMachineAgent());
                break;
            case 1: //Java Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getAppAgent());

                break;

            default:
                break;
            }
        }
        columnCount++;
    }
    tempRowIndex++;
    return tempRowIndex++;
}

From source file:org.appdynamics.licensecount.file.WriteExcelDoc.java

public int addHourlyApp(XSSFSheet curSheet, int rowIndex, ApplicationLicenseCount appLicenseCount,
        int inCount) {
    // This going to add the customer information.
    int tempRowIndex = rowIndex;
    ArrayList<Row> rows = new ArrayList<Row>();
    for (int i = rowIndex; i < (rowIndex + 2); i++) {
        rows.add(curSheet.createRow(i));
    }/*  w  w w .  j  av a 2  s .co  m*/

    Cell cell = null;
    for (int i = 0; i < 2; i++) {
        switch (i) {
        case 0:
            if (inCount == 0) {
                cell = rows.get(i).createCell(0);
                cell.setCellValue(appLicenseCount.getApplicationName());

                cell = rows.get(i).createCell(2);
                cell.setCellValue(LicenseS.MACHINE_AGENT_COUNT);
                tempRowIndex++;
            }
            break;
        case 1:
            cell = rows.get(i).createCell(2);
            cell.setCellValue(LicenseS.APPLICATION_AGENT_COUNT);
            tempRowIndex++;
            break;

        default:
            break;
        }

    }

    int columnCount = 3;
    for (AppHourLicenseRange cRange : appLicenseCount.getAppHourLicenseRange()) {

        for (int i = 0; i < 2; i++) {
            switch (i) {
            case 0: //Total Count
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getMachineAgent());
                break;
            case 1: //Java Agent
                cell = rows.get(i).createCell(columnCount);
                cell.setCellValue(cRange.getAppAgent());

                break;

            default:
                break;
            }
        }
        columnCount++;
    }
    tempRowIndex++;
    return tempRowIndex++;
}

From source file:org.appdynamics.licensecount.file.WriteExcelDoc.java

public void addNodeInfo(XSSFSheet curSheet) {
    // Create the header
    int row = 0;//from ww  w .  j  a v  a  2 s  .  c  o  m
    Row mainRow = curSheet.createRow(row);
    row += 2;

    Cell cell = mainRow.createCell(0);
    cell.setCellValue(LicenseS.APPLICATION_NAME);
    cell = mainRow.createCell(1);
    cell.setCellValue(LicenseS.TIER_NAME);
    cell = mainRow.createCell(2);
    cell.setCellValue(LicenseS.NODE_NAME);
    cell = mainRow.createCell(3);
    cell.setCellValue(LicenseS.AGENT_TYPE);
    cell = mainRow.createCell(4);
    cell.setCellValue(LicenseS.AGENT_NAME_MACHINE_AGENT);
    cell = mainRow.createCell(5);
    cell.setCellValue(LicenseS.DESCRIPTION);

    Iterator<Integer> appIter = customer.getApplications().keySet().iterator();
    while (appIter.hasNext()) {
        Integer appId = appIter.next();
        ApplicationLicenseCount appCount = customer.getApplications().get(appId);
        Iterator<Integer> tierIter = appCount.getTierLicenses().keySet().iterator();
        while (tierIter.hasNext()) {
            Integer tierId = tierIter.next();
            TierLicenseCount tierCount = appCount.getTierLicenses().get(tierId);
            for (NodeLicenseCount nodeCount : tierCount.getNodeLicenseCount()) {
                mainRow = curSheet.createRow(row);
                cell = mainRow.createCell(0);
                cell.setCellValue(appCount.getApplicationName());
                cell = mainRow.createCell(1);
                cell.setCellValue(tierCount.getName());
                cell = mainRow.createCell(2);
                cell.setCellValue(nodeCount.getName());
                // This is when we pick the agent type
                cell = mainRow.createCell(3);
                if (nodeCount.getNode().isAppAgentPresent()) {
                    cell.setCellValue(nodeCount.getAgentName(nodeCount.getType()));
                } else {
                    cell.setCellValue(LicenseS.NONE);
                }

                cell = mainRow.createCell(4);
                if (nodeCount.getNode().isMachineAgentPresent()) {
                    cell.setCellValue(LicenseS.PRESENT);
                } else {
                    cell.setCellValue(LicenseS.NONE);
                }

                cell = mainRow.createCell(5);
                cell.setCellValue(getDescription(nodeCount));
                row++;
            }
        }
    }

}

From source file:org.appdynamics.licensecount.file.WriteExcelDoc.java

public void addTierWNoNodeInfo(XSSFSheet curSheet) {
    // Create the header
    int row = 0;//from  w  ww. ja  v  a  2  s .c o  m
    Row mainRow = curSheet.createRow(row);
    row += 2;

    Cell cell = mainRow.createCell(0);
    cell.setCellValue(LicenseS.APPLICATION_NAME);
    cell = mainRow.createCell(1);
    cell.setCellValue(LicenseS.TIER_ID);
    cell = mainRow.createCell(2);
    cell.setCellValue(LicenseS.TIER_NAME);
    cell = mainRow.createCell(3);
    cell.setCellValue(LicenseS.TIER_TYPE);
    cell = mainRow.createCell(4);
    cell.setCellValue(LicenseS.TIER_AGENT_TYPE);

    Iterator<Integer> appIter = customer.getApplications().keySet().iterator();
    while (appIter.hasNext()) {
        Integer appId = appIter.next();
        ApplicationLicenseCount appCount = customer.getApplications().get(appId);
        Iterator<Integer> tierIter = appCount.getTierLicensesNoNodes().keySet().iterator();
        while (tierIter.hasNext()) {
            Integer tierId = tierIter.next();
            Tier tierCount = appCount.getTierLicensesNoNodes().get(tierId);
            mainRow = curSheet.createRow(row);
            cell = mainRow.createCell(0);
            cell.setCellValue(appCount.getApplicationName());
            cell = mainRow.createCell(1);
            cell.setCellValue(tierCount.getId());
            cell = mainRow.createCell(2);
            cell.setCellValue(tierCount.getName());
            // This is when we pick the agent type
            cell = mainRow.createCell(3);
            cell.setCellValue(tierCount.getType());
            cell = mainRow.createCell(4);
            cell.setCellValue(tierCount.getAgentType());
            row++;
        }
    }

}

From source file:org.appdynamics.utilreports.files.ProcessExcelFile.java

private void processCheck(XSSFSheet xsf, LoadCheck lc) {

    //First row is the application
    int rowIndex = 0;
    int cellIndex = 0;
    Row headerRow = xsf.createRow(rowIndex);
    Cell cell_0 = headerRow.createCell(cellIndex);
    cell_0.setCellValue(new StringBuilder().append(AppDUtilReportS.APPLICATION_EQ).append(lc.getAppName())
            .append(" (id=").append(lc.getAppId()).append(")").toString());
    cellIndex++;/*from ww  w.  j  a v a 2 s .  c om*/
    Cell cell_1;

    rowIndex += 2;
    headerRow = xsf.createRow(rowIndex);
    //Second row is the header
    cellIndex = 0;
    cell_0 = headerRow.createCell(cellIndex);
    cell_0.setCellValue(AppDUtilReportS.TIME_RANGE);
    cellIndex++;
    cell_1 = headerRow.createCell(cellIndex);
    cell_1.setCellValue(lc.getHeader());
    cellIndex++;
    Cell cell_2 = headerRow.createCell(cellIndex);
    cell_2.setCellValue(AppDUtilReportS.REQUEST_COUNTS);
    Cell cell_3;
    if (lc.getMetricIndex() == 5) {
        cellIndex++;
        cell_3 = headerRow.createCell(cellIndex);
        cell_3.setCellValue("Tier Name");
    }
    cellIndex = 0;

    for (CheckAll check : lc.getChecks()) {
        for (QInfo info : check.getMyList()) {
            rowIndex++;
            headerRow = xsf.createRow(rowIndex);
            cell_0 = headerRow.createCell(cellIndex);
            cell_0.setCellValue(check.getName());
            cellIndex++;
            cell_1 = headerRow.createCell(cellIndex);
            cell_1.setCellValue(info.getName());
            cellIndex++;
            cell_2 = headerRow.createCell(cellIndex);
            cell_2.setCellValue(info.getValue());
            cellIndex++;
            if (lc.getMetricIndex() == 5) {
                cell_3 = headerRow.createCell(cellIndex);
                cell_3.setCellValue(info.getTierName());
            }
            cellIndex = 0;
        }

    }
    for (QInfo info : lc.getBase()) {
        if (!info.isPassed()) { //this are the badones.
            rowIndex++;
            headerRow = xsf.createRow(rowIndex);
            cell_0 = headerRow.createCell(cellIndex);
            cell_0.setCellValue("Past the Time");
            cellIndex++;
            cell_1 = headerRow.createCell(cellIndex);
            cell_1.setCellValue(info.getName());
            cellIndex++;
            cell_2 = headerRow.createCell(cellIndex);
            cell_2.setCellValue(info.getValue());
            cellIndex++;
            if (lc.getMetricIndex() == 5) {
                cell_3 = headerRow.createCell(cellIndex);
                cell_3.setCellValue(info.getTierName());
            }
            cellIndex = 0;
        }

    }

}

From source file:org.appdynamics.utilreports.files.ProcessExcelFile.java

private void processBT(XSSFSheet xsf, GatherBTInfo bt, String app) {
    //First row is the application
    int rowIndex = 0;
    int cellIndex = 0;
    Row headerRow = xsf.createRow(rowIndex);
    Cell cell_0 = headerRow.createCell(cellIndex);
    cell_0.setCellValue(new StringBuilder().append(AppDUtilReportS.APPLICATION_EQ).append(app).toString());
    cellIndex++;/*from w ww. j a v a 2  s .c o m*/
    Cell cell_1 = headerRow.createCell(cellIndex);
    cell_1.setCellValue(
            new StringBuilder().append("BT query end time ").append(getDate(bt.getEnd())).toString());

    rowIndex += 2;
    headerRow = xsf.createRow(rowIndex);
    //Second row is the header
    cellIndex = 0;
    cell_0 = headerRow.createCell(cellIndex);
    cell_0.setCellValue(AppDUtilReportS.TIME_RANGE);
    cellIndex++;
    cell_1 = headerRow.createCell(cellIndex);
    cell_1.setCellValue("Business Transaction Name");
    cellIndex++;
    Cell cell_2 = headerRow.createCell(cellIndex);
    cell_2.setCellValue(AppDUtilReportS.REQUEST_COUNTS);
    cellIndex++;
    Cell cell_3 = headerRow.createCell(cellIndex);
    cell_3.setCellValue("Tier Name");

    cellIndex = 0;

    rowIndex++;
    //Now we start putting down the data
    String hourRange = AppDUtilReportS.LAST_4_HOURS;
    for (BusinessTransaction dBt : bt.get4HourBT().keySet()) {
        rowIndex++;
        headerRow = xsf.createRow(rowIndex);
        cell_0 = headerRow.createCell(cellIndex);
        cell_0.setCellValue(hourRange);
        cellIndex++;
        cell_1 = headerRow.createCell(cellIndex);
        cell_1.setCellValue(dBt.getName());
        cellIndex++;
        cell_2 = headerRow.createCell(cellIndex);
        cell_2.setCellValue(bt.get4HourBT().get(dBt));
        cellIndex++;
        cell_3 = headerRow.createCell(cellIndex);
        cell_3.setCellValue(dBt.getTierName());
        cellIndex = 0;
    }

    hourRange = AppDUtilReportS.LAST_24_HOURS;
    for (BusinessTransaction dBt : bt.get24HourBT().keySet()) {
        rowIndex++;
        headerRow = xsf.createRow(rowIndex);
        cell_0 = headerRow.createCell(cellIndex);
        cell_0.setCellValue(hourRange);
        cellIndex++;
        cell_1 = headerRow.createCell(cellIndex);
        cell_1.setCellValue(dBt.getName());
        cellIndex++;
        cell_2 = headerRow.createCell(cellIndex);
        cell_2.setCellValue(bt.get24HourBT().get(dBt));
        cellIndex++;
        cell_3 = headerRow.createCell(cellIndex);
        cell_3.setCellValue(dBt.getTierName());
        cellIndex = 0;
    }

    hourRange = AppDUtilReportS.LAST_48_HOURS;
    for (BusinessTransaction dBt : bt.get48HourBT().keySet()) {
        rowIndex++;
        headerRow = xsf.createRow(rowIndex);
        cell_0 = headerRow.createCell(cellIndex);
        cell_0.setCellValue(hourRange);
        cellIndex++;
        cell_1 = headerRow.createCell(cellIndex);
        cell_1.setCellValue(dBt.getName());
        cellIndex++;
        cell_2 = headerRow.createCell(cellIndex);
        cell_2.setCellValue(bt.get48HourBT().get(dBt));
        cellIndex++;
        cell_3 = headerRow.createCell(cellIndex);
        cell_3.setCellValue(dBt.getTierName());
        cellIndex = 0;
    }
    //We are going to create row 0 first 
    hourRange = AppDUtilReportS.NORMAL;
    for (BusinessTransaction dBt : bt.getNormalBT().keySet()) {
        rowIndex++;
        headerRow = xsf.createRow(rowIndex);
        cell_0 = headerRow.createCell(cellIndex);
        cell_0.setCellValue(hourRange);
        cellIndex++;
        cell_1 = headerRow.createCell(cellIndex);
        cell_1.setCellValue(dBt.getName());
        cellIndex++;
        cell_2 = headerRow.createCell(cellIndex);
        cell_2.setCellValue(bt.getNormalBT().get(dBt));
        cellIndex++;
        cell_3 = headerRow.createCell(cellIndex);
        cell_3.setCellValue(dBt.getTierName());
        cellIndex = 0;
    }
}

From source file:org.appdynamics.utilreports.files.ProcessExcelFile.java

private void processBE(XSSFSheet xsf, GatherBKInfo bk, String app) {
    //First row is the application
    int rowIndex = 0;
    int cellIndex = 0;
    Row headerRow = xsf.createRow(rowIndex);
    Cell cell_0 = headerRow.createCell(cellIndex);
    cell_0.setCellValue(new StringBuilder().append(AppDUtilReportS.APPLICATION_EQ).append(app).toString());
    cellIndex++;//from w  ww.  j a v  a 2  s.  c  o m
    Cell cell_1 = headerRow.createCell(cellIndex);
    cell_1.setCellValue(
            new StringBuilder().append("BE query end time ").append(getDate(bk.getEnd())).toString());

    rowIndex += 2;
    headerRow = xsf.createRow(rowIndex);
    //Second row is the header
    cellIndex = 0;
    cell_0 = headerRow.createCell(cellIndex);
    cell_0.setCellValue(AppDUtilReportS.TIME_RANGE);
    cellIndex++;
    cell_1 = headerRow.createCell(cellIndex);
    cell_1.setCellValue("Backend Name");
    cellIndex++;
    Cell cell_2 = headerRow.createCell(cellIndex);
    cell_2.setCellValue(AppDUtilReportS.REQUEST_COUNTS);

    cellIndex = 0;

    rowIndex++;
    //Now we start putting down the data
    String hourRange = AppDUtilReportS.LAST_4_HOURS;
    for (String dBt : bk.get4HourBK().keySet()) {
        rowIndex++;
        headerRow = xsf.createRow(rowIndex);
        cell_0 = headerRow.createCell(cellIndex);
        cell_0.setCellValue(hourRange);
        cellIndex++;
        cell_1 = headerRow.createCell(cellIndex);
        cell_1.setCellValue(dBt);
        cellIndex++;
        cell_2 = headerRow.createCell(cellIndex);
        cell_2.setCellValue(bk.get4HourBK().get(dBt));
        cellIndex = 0;
    }

    hourRange = AppDUtilReportS.LAST_24_HOURS;
    for (String dBt : bk.get24HourBK().keySet()) {
        rowIndex++;
        headerRow = xsf.createRow(rowIndex);
        cell_0 = headerRow.createCell(cellIndex);
        cell_0.setCellValue(hourRange);
        cellIndex++;
        cell_1 = headerRow.createCell(cellIndex);
        cell_1.setCellValue(dBt);
        cellIndex++;
        cell_2 = headerRow.createCell(cellIndex);
        cell_2.setCellValue(bk.get24HourBK().get(dBt));
        cellIndex = 0;
    }

    hourRange = AppDUtilReportS.LAST_48_HOURS;
    for (String dBt : bk.get48HourBK().keySet()) {
        rowIndex++;
        headerRow = xsf.createRow(rowIndex);
        cell_0 = headerRow.createCell(cellIndex);
        cell_0.setCellValue(hourRange);
        cellIndex++;
        cell_1 = headerRow.createCell(cellIndex);
        cell_1.setCellValue(dBt);
        cellIndex++;
        cell_2 = headerRow.createCell(cellIndex);
        cell_2.setCellValue(bk.get48HourBK().get(dBt));
        cellIndex = 0;
    }
    //We are going to create row 0 first
    hourRange = AppDUtilReportS.NORMAL;
    for (String dBt : bk.getNormalBK().keySet()) {
        rowIndex++;
        headerRow = xsf.createRow(rowIndex);
        cell_0 = headerRow.createCell(cellIndex);
        cell_0.setCellValue(hourRange);
        cellIndex++;
        cell_1 = headerRow.createCell(cellIndex);
        cell_1.setCellValue(dBt);
        cellIndex++;
        cell_2 = headerRow.createCell(cellIndex);
        cell_2.setCellValue(bk.getNormalBK().get(dBt));
        cellIndex = 0;
    }
}