Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Please give me the solution for this java.lang.VerifyError: (class: com/summit/cbms7/presentation/rfp/action/RFPViewSOPAction, method: getExcelStaticData signature: (Lorg/apache/poi/hssf/usermodel/HSSFSheet;Lorg/apache/poi/hssf/usermodel/HSSFWorkbook;Lja

harinath t July 2, 2013

CODE:

====


package com.summit.cbms7.presentation.rfp.action;

import com.summit.cbms7.core.dto.RFPAccountsBidGroupDTO;
import com.summit.cbms7.core.dto.RFPHeaderDTO;
import com.summit.cbms7.core.dto.RFPSupplierPriceCommentsArchiveDTO;
import com.summit.cbms7.core.dto.RFPViewBidsArrayDTO;
import com.summit.cbms7.core.dto.RFPViewBidsDTO;
import com.summit.cbms7.core.dto.RFPViewBidsHeaderDTO;
import com.summit.cbms7.presentation.CBMS7BaseAction;
import com.summit.cbms7.util.*;

import com.summit.common.core.BaseException;
import com.summit.common.core.dto.BaseDTO;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFFooter;
import org.apache.poi.hssf.usermodel.HSSFPalette;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFPicture;
import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.hssf.util.Region;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;

import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;

import java.io.*;

import java.util.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class RFPViewSOPAction extends CBMS7BaseAction {
public BaseDTO gatherInput(HttpServletRequest request,
HttpServletResponse response) {
RFPViewBidsDTO viewBidsDTO = new RFPViewBidsDTO();
RFPAccountsBidGroupDTO accountBidGroupDTO = new RFPAccountsBidGroupDTO();

try {
String rfpId = request.getParameter("rfpId");
String allTermsUnderAccount = request.getParameter("termsId");
String allSOPTermsUnderAccount = request.getParameter("SOPTermsId");
String rfpAccountGroupId = request.getParameter("rfpAccountGroupId");
String isBidGroupId = request.getParameter("isBidGroup");
String mode = request.getParameter("mode");
String productName = request.getParameter("productName");
String action = request.getParameter("action");

logger.fine("IN side RFPViewBidsAction rfpId " + rfpId);

if ((rfpId != null) && (rfpId.length() > 0) &&
(!rfpId.equals("null"))) {
accountBidGroupDTO.rfpId = Integer.parseInt(rfpId);
}

if ((rfpAccountGroupId != null) &&
(rfpAccountGroupId.length() > 0)) {
accountBidGroupDTO.accountBidGroupId = Integer.parseInt(rfpAccountGroupId);
}

if ((isBidGroupId != null) && (isBidGroupId.length() > 0)) {
accountBidGroupDTO.isBidGroup = Integer.parseInt(isBidGroupId);
}

accountBidGroupDTO.allTermsUnderAccount = allTermsUnderAccount;
accountBidGroupDTO.allSOPTermsUnderAccount = allSOPTermsUnderAccount;
accountBidGroupDTO.action = action;
accountBidGroupDTO.mode = mode;

if ((productName != null) && !productName.equalsIgnoreCase("null")) {
accountBidGroupDTO.productName = productName;
} else {
accountBidGroupDTO.productName = null;
}
} catch (Exception e) {
e.printStackTrace();
}

viewBidsDTO.rfpAccountsBidGroupDTO = accountBidGroupDTO;

return viewBidsDTO;
}

public void handleExceptions(BaseException[] exceptions,
ActionMessages errorMessages, BaseDTO inputDTO, BaseDTO outputDTO) {
}

public void postExecute(BaseDTO inputDTO, BaseDTO outputDTO,
HttpServletRequest request) {
generateSOPExcel((RFPViewBidsArrayDTO) outputDTO, request);
}

protected ActionForward selectView(ActionMapping mapping, BaseDTO inputDTO,
BaseDTO outputDTO) {
ActionForward forward = mapping.findForward("success");
RFPViewBidsDTO viewBidsDTO = (RFPViewBidsDTO) inputDTO;
RFPAccountsBidGroupDTO accountBidGroupDTO = viewBidsDTO.rfpAccountsBidGroupDTO;

logger.fine(" Inside select view " + accountBidGroupDTO.action);

if ((accountBidGroupDTO.action != null) &&
accountBidGroupDTO.action.equalsIgnoreCase("Excel")) {
forward = new ActionForward("/excelDownload.jsp");
logger.fine("Getting Excel ............. " + forward);
} else if ((accountBidGroupDTO.mode != null) &&
accountBidGroupDTO.mode.equals(CBMS7Constants.SR_RFP_VIEW_SOP)) {
forward = new ActionForward("/rfpSOP.jsp");
logger.fine(
"Doing Reset operation... for SOP Fetching current View bids " +
forward);
}

return forward;
}
//added method for sop enhancement by aparna maddukuri
@SuppressWarnings("deprecation")
private void generateSOPExcel(RFPViewBidsArrayDTO rfpViewBidsArrayDTO,
HttpServletRequest request) {
try {
RFPViewBidsHeaderDTO sopSummaryHeaderDTO = new RFPViewBidsHeaderDTO();
ArrayList noBidSupplierList = new ArrayList();
LinkedHashMap includedAccountsMap = new LinkedHashMap();
LinkedHashMap viewBidsMap = new LinkedHashMap();
boolean checkTerm = true;
ArrayList termList = new ArrayList();
RFPHeaderDTO headerOutputDTO = null;
String unit = null;
String text = null;
String parsedtext = null;

if (rfpViewBidsArrayDTO != null) {
sopSummaryHeaderDTO = rfpViewBidsArrayDTO.rfpViewBidsHeaderDTO;
noBidSupplierList = rfpViewBidsArrayDTO.noBidSupplierList;
includedAccountsMap = rfpViewBidsArrayDTO.includedAccountsMap;
viewBidsMap = rfpViewBidsArrayDTO.viewBidsMap;
termList = rfpViewBidsArrayDTO.termList;
headerOutputDTO = rfpViewBidsArrayDTO.rfpHeaderDTO;

if (headerOutputDTO.commodityName.equals(
CBMS7Constants.GAS_COMMODITY_TYPE)) {
unit = CBMS7Constants.NG_DEFAULT_UNIT;
} else {
unit = CBMS7Constants.EP_DEFAULT_UNIT;
}
}

HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet1 = wb.createSheet();
HSSFSheet sheet2 = wb.createSheet();
//modified by aparna maddukuri for bug 934
sheet1.setColumnWidth(0, (short) (22.71 * 256));
sheet1.setColumnWidth(1, (short) (28.29 * 256));
sheet1.setColumnWidth(2, (short) (17.29 * 256));
sheet1.setColumnWidth(3, (short) (16.43 * 256));
sheet1.setColumnWidth(4, (short) (16.14 * 256));
sheet1.setColumnWidth(5, (short) (16.29 * 256));
sheet1.setColumnWidth(6, (short) (38 * 256));
sheet1.setColumnWidth(7, (short) (16.14 * 256));
//sheet1.setColumnWidth((short) 8, (short) (16.14 * 256));
//sheet1.setColumnWidth((short) 9, (short) (16.14 * 256));

sheet2.setColumnWidth(0, (short) (2.7 * 256));//modified the column width by aparna maddukuri
sheet2.setColumnWidth(1, (short) (22 * 256));
sheet2.setColumnWidth(2, (short) (27.57 * 256));
sheet2.setColumnWidth(3, (short) (15.86 * 256));
sheet2.setColumnWidth(4, (short) (17.86 * 256));
sheet2.setColumnWidth(5, (short) (19.43 * 256));
sheet2.setColumnWidth(6, (short) (15.57 * 256));
sheet2.setColumnWidth(7, (short) (37.29 * 256));


//wb.setPrintArea(0, 0, 6, 0, 47);
//sheet1.setAutobreaks(true);
//sheet.setColumnBreak((short)9);
//sheet.setRowBreak(40);
//sheet.setPageBreak(40);
//sheet.setRowBreak(40);

/*HSSFPrintSetup ps = sheet.getPrintSetup();
ps.setFitWidth((short)3);
ps.setFitHeight((short)80);*/
HSSFPrintSetup setup = sheet1.getPrintSetup();
setup.setFitWidth((short) 1);
setup.setFitHeight((short) 0); //for bug 936 by aparna maddukuri

sheet1.setAutobreaks(true);
sheet1.setFitToPage(true);
setup.setLandscape(true);
setup.setPaperSize(HSSFPrintSetup.LETTER_PAPERSIZE);
//sheet1.addMergedRegion(CellRangeAddress.valueOf("G:H"));
setup.setFooterMargin(0.25);
//modified the margin settings by aparna maddukuri for bug 936
setup.setHeaderMargin(0);
sheet1.setMargin((short) 0, 0.5);
sheet1.setMargin((short) 1, 0.5);
sheet1.setMargin((short) 2, 0.15);
sheet1.setMargin((short) 3, 0.5);

sheet1.setHorizontallyCenter(true);


HSSFPrintSetup setup2 = sheet2.getPrintSetup();
setup2.setFitWidth((short) 1);
setup2.setFitHeight((short) 0);
sheet2.setAutobreaks(true);
setup2.setLandscape(true);
setup2.setPaperSize(HSSFPrintSetup.LETTER_PAPERSIZE);
setup2.setFooterMargin(0.25);
//modified the margin settings by aparna maddukuri for bug 936
setup2.setHeaderMargin(0);
sheet2.setMargin((short) 0, 0.5);
sheet2.setMargin((short) 1, 0.5);
sheet2.setMargin((short) 2, 0.15);
sheet2.setMargin((short) 3, 0.5);


sheet2.setHorizontallyCenter(true);

//modified by aparna maddukuri for sop bug 937
wb.setRepeatingRowsAndColumns(0, -1, -1, 0, 11);
wb.setRepeatingRowsAndColumns(1, -1, -1, 0, 11);


sheet1 = getExcelHeaderData(sopSummaryHeaderDTO, unit, request,
sheet1, wb,1);

sheet2 = getExcelHeaderData(sopSummaryHeaderDTO, unit, request,
sheet2, wb,2);
sheet2 = getExcelStaticData(sheet2, wb, request);

wb.setSheetName(0, "Summary of Proposals");//modified by aparna maddukuri
wb.setSheetName(1, "Recommendation");//modified by aparna maddukuri

//creation of supplier product table
HSSFCellStyle product_style = wb.createCellStyle();
HSSFFont font9 = wb.createFont();
font9.setFontName(HSSFFont.FONT_ARIAL);
font9.setFontHeightInPoints((short) 9);
font9.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
product_style.setFont(font9);
product_style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
product_style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//modified by saritha BZ.415 reopen 9.10.2008
product_style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//added for SENC-33.
// product_style.setFillForegroundColor(HSSFColor.CORNFLOWER_BLUE.index);
HSSFPalette palette = wb.getCustomPalette();
HSSFColor color = palette.findColor((byte) 160, (byte) 160, (byte) 160);
if(color == null){
palette.setColorAtIndex(HSSFColor.GREY_40_PERCENT.index,(byte)160,(byte)160,(byte)160);
color = palette.getColor(HSSFColor.GREY_40_PERCENT.index);
product_style.setFillForegroundColor(color.getIndex());
}
product_style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
product_style.setBorderRight(HSSFCellStyle.BORDER_THIN);
product_style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
product_style.setBorderTop(HSSFCellStyle.BORDER_THIN);

HSSFCellStyle product_data_style = wb.createCellStyle();
HSSFFont font10 = wb.createFont();
font10.setFontName(HSSFFont.FONT_ARIAL);
font10.setFontHeightInPoints((short) 8);
product_data_style.setFont(font10);
product_data_style.setWrapText(true);
product_data_style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
product_data_style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//VERTICAL_TOP modified by saritha BZ.415 reopen 9.10.2008
product_data_style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
product_data_style.setBorderRight(HSSFCellStyle.BORDER_THIN);
product_data_style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
product_data_style.setBorderTop(HSSFCellStyle.BORDER_THIN);

HSSFCellStyle product_data_comments_style = wb.createCellStyle();
product_data_comments_style.setFont(font10);
product_data_comments_style.setWrapText(true);
product_data_comments_style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
product_data_comments_style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//modified by saritha BZ.415 reopen 9.10.2008
product_data_comments_style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
product_data_comments_style.setBorderRight(HSSFCellStyle.BORDER_THIN);
product_data_comments_style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
product_data_comments_style.setBorderTop(HSSFCellStyle.BORDER_THIN);

//added the below two styles for sop reopen by aparna maddukuri on 11/09/2008
HSSFCellStyle product_data_no_comments_style = wb.createCellStyle();
product_data_no_comments_style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
product_data_no_comments_style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//modified by saritha BZ.415 reopen 9.10.2008
product_data_no_comments_style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
product_data_no_comments_style.setBorderRight(HSSFCellStyle.BORDER_THIN);

HSSFCellStyle product_data_no_comments_last_style = wb.createCellStyle();
product_data_no_comments_last_style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
product_data_no_comments_last_style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//modified by saritha BZ.415 reopen 9.10.2008
product_data_no_comments_last_style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
product_data_no_comments_last_style.setBorderRight(HSSFCellStyle.BORDER_THIN);
product_data_no_comments_last_style.setBorderBottom(HSSFCellStyle.BORDER_THIN);


int rownumber = 12;

if ((viewBidsMap != null) && (viewBidsMap.size() > 0)) {
Set keySet = viewBidsMap.keySet();
Iterator itr = keySet.iterator();
boolean check = false;

while (itr.hasNext()) {
checkTerm = true;

String supplierContact = (String) itr.next();
LinkedHashMap supplierContactMap = (LinkedHashMap) viewBidsMap.get(supplierContact);
Set keySet1 = supplierContactMap.keySet();
Iterator itr1 = keySet1.iterator();
int counter = 0;
int counter2=0;
HSSFRow row12;
HSSFCell cell120;
HSSFCell cell121;
int cellno;

while (itr1.hasNext()) {
if (counter == 0) {
row12 = sheet1.createRow((short) rownumber);
cell120 = row12.createCell((short) 0);
cell121 = row12.createCell((short) 1);
cell120.setCellValue(new HSSFRichTextString("Supplier"));
cell121.setCellValue(new HSSFRichTextString("Product"));
cell120.setCellStyle(product_style);
cell121.setCellStyle(product_style);
if ((termList != null) && (termList.size() > 0) &&
checkTerm) {
checkTerm = false;

String term = "";
cellno = 2;

for (int i = 0; i < termList.size(); i++) {
RFPViewBidsDTO viewBidsDTO = (RFPViewBidsDTO) termList.get(i);

if (viewBidsDTO.fromTermDate != null) {
Calendar cal = new GregorianCalendar();
cal.setTime(viewBidsDTO.fromTermDate);

int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
String fromDate = CBMS7Util.getShortMonthYear(month,
year);
cal.setTime(viewBidsDTO.toTermDate);

int month2 = cal.get(Calendar.MONTH);
int year2 = cal.get(Calendar.YEAR);
int diffmnths = ((year2 - year) * 12) +
(month2 - month) + 1;
term = fromDate + " (" + diffmnths +
" months)";
}

HSSFCell cell122 = row12.createCell((short) cellno);
cell122.setCellValue(new HSSFRichTextString(
term));
cell122.setCellStyle(product_style);
++cellno;
}
HSSFCell cell126 = row12.createCell((short) cellno);
cell126.setCellValue(new HSSFRichTextString("Comments"));
cell126.setCellStyle(product_style);
++rownumber;

}
} else {
String productName = (String) itr1.next();
ArrayList bidList = (ArrayList) supplierContactMap.get(productName);
productName = productName.trim();
if ((termList != null) && (termList.size() > 0)) {

row12 = sheet1.createRow((short) rownumber);
//row12.setHeightInPoints((float)30);

if(counter2 == 0){
//System.out.println("termsize--->"+termList.size());
sheet1.addMergedRegion(new Region(rownumber, (short) 0, rownumber+(keySet1.size()-1), (short) 0));
Region region = new Region(rownumber, (short) (termList.size()+2), rownumber+(keySet1.size()-1), (short) (termList.size()+2));
sheet1.addMergedRegion(region);

cell120 = row12.createCell((short) 0);
cell121 = row12.createCell((short) 1);
cell120.setCellValue(new HSSFRichTextString(
supplierContact.substring(0,
supplierContact.indexOf('~'))));
cell121.setCellValue(new HSSFRichTextString(
productName.replace('~', ':')));
cell120.setCellStyle(product_data_style);
cell121.setCellStyle(product_data_style);
}else{
cell120 = row12.createCell((short) 0);
cell121 = row12.createCell((short) 1);
cell121.setCellValue(new HSSFRichTextString(
productName.replace('~', ':').trim()));
cell120.setCellStyle(product_data_style);
cell121.setCellStyle(product_data_style);

}


cellno = 2;

boolean isBidTermChecked = false;
String sopSummaryComments=null;
for(int x = 0; x < bidList.size(); x++){
RFPViewBidsDTO viewBidDTO = (RFPViewBidsDTO)bidList.get(x);
if(viewBidDTO.sopSummaryComments!=null){
sopSummaryComments=viewBidDTO.sopSummaryComments;
}

}

for (int c = 0; c < termList.size(); c++) {
HSSFCell cell122 = row12.createCell((short) cellno);
cell122.setCellStyle(product_data_style);
RFPViewBidsDTO termViewBidsDTO = (RFPViewBidsDTO) termList.get(c);
RFPViewBidsDTO viewBidDTO = null;
isBidTermChecked = false;

for (int i = 0; i < bidList.size(); i++) {
RFPViewBidsDTO tempViewBidDTO = (RFPViewBidsDTO) bidList.get(i);

if (termViewBidsDTO.accountTermId == tempViewBidDTO.accountTermId) {
viewBidDTO = tempViewBidDTO;



isBidTermChecked = true;

break;
}
}

String priceResponseCommentsArchive = "";
int cnt = 1;

if ((viewBidDTO != null) &&
(viewBidDTO.rfpSupplierPriceCommentsArchiveDTOList != null) &&
(viewBidDTO.rfpSupplierPriceCommentsArchiveDTOList.size() > 0)) {
for (int j = 0;
j < viewBidDTO.rfpSupplierPriceCommentsArchiveDTOList.size();
j++) {
RFPSupplierPriceCommentsArchiveDTO rfpSupplierPriceCommentsArchiveDTO =
(RFPSupplierPriceCommentsArchiveDTO) viewBidDTO.rfpSupplierPriceCommentsArchiveDTOList.get(j);

if (rfpSupplierPriceCommentsArchiveDTO.priceResponseComments != null) {
priceResponseCommentsArchive = priceResponseCommentsArchive +
" (" + cnt + ") " +
rfpSupplierPriceCommentsArchiveDTO.priceResponseComments +
"\n";
}

cnt++;
}
}

if (isBidTermChecked) {
if (viewBidDTO.supplierPriceComments != null) {
if (!(viewBidDTO.supplierBOCId == 0)) {
if ((cnt > 1) &&
(viewBidDTO.supplierPriceComments != null) &&
!viewBidDTO.supplierPriceComments.equals(
"")) {
text = priceResponseCommentsArchive.trim() +
" (" + cnt + ") " +
viewBidDTO.supplierPriceComments.trim();
} else {
text = priceResponseCommentsArchive.trim() +
viewBidDTO.supplierPriceComments.trim();
}
parsedtext = null;
StringTokenizer st = new StringTokenizer(text);
while (st.hasMoreTokens()) {
if(parsedtext == null){
parsedtext = st.nextToken().trim();
}else{
parsedtext = parsedtext + " "+ st.nextToken().trim();
}
}



cell122.setCellValue(new HSSFRichTextString(
parsedtext));


}
}
}
++cellno;
}
HSSFCell cell122 = row12.createCell((short) cellno);
cell122.setCellStyle(product_data_comments_style);


if(counter2 == 0){


if (sopSummaryComments != null) {

parsedtext = null;
StringTokenizer st = new StringTokenizer(sopSummaryComments);
while (st.hasMoreTokens()) {
if(parsedtext == null){
parsedtext = st.nextToken().trim();
}else{
parsedtext = parsedtext + " "+ st.nextToken().trim();
}
}

cell122.setCellValue(new HSSFRichTextString(
parsedtext));


//HSSFCellUtil.createCell( row12, cellno,parsedtext ,product_data_comments_style);




}

}/*else{
if(itr1.hasNext()){
cell122.setCellStyle(product_data_no_comments_style);
}else{
cell122.setCellStyle(product_data_no_comments_last_style);
}

}*/

++counter2;
++rownumber;
}
}
counter = counter+1;
}

rownumber = rownumber + 2;
}
}



//end of supplier product table
HSSFCellStyle product_bottom_data_style = wb.createCellStyle();
HSSFFont font11 = wb.createFont();
font11.setFontName(HSSFFont.FONT_ARIAL);
font11.setFontHeightInPoints((short) 8);
font11.setItalic(true);
product_bottom_data_style.setFont(font11);
product_bottom_data_style.setWrapText(true);
product_bottom_data_style.setAlignment(HSSFCellStyle.ALIGN_LEFT);


rownumber = rownumber - 2;
sheet1.addMergedRegion(new Region(rownumber, (short) 0, rownumber, (short) 6));
HSSFRow row15 = sheet1.createRow((short) rownumber);
HSSFCell cell150 = row15.createCell(0);
HSSFCell cell151 = row15.createCell(1);
HSSFCell cell152 = row15.createCell(2);
HSSFCell cell153 = row15.createCell(3);
HSSFCell cell154 = row15.createCell(4);
HSSFCell cell155 = row15.createCell(5);
HSSFCell cell156 = row15.createCell(6);
cell150.setCellValue(new HSSFRichTextString(
"*All proposals offered through this RFP are contingent on market conditions upon executing the contract. Actual prices at the time of execution may differ from prices referenced in this summary."));
cell150.setCellStyle(product_bottom_data_style);
cell151.setCellStyle(product_bottom_data_style);
cell152.setCellStyle(product_bottom_data_style);
cell153.setCellStyle(product_bottom_data_style);
cell154.setCellStyle(product_bottom_data_style);
cell155.setCellStyle(product_bottom_data_style);
cell156.setCellStyle(product_bottom_data_style);
rownumber = rownumber+3;
HSSFRow row18 = sheet1.createRow((short) rownumber);
sheet1.addMergedRegion(new Region(rownumber, (short) 0, rownumber, (short) 1));
sheet1.addMergedRegion(new Region(rownumber, (short) 3, rownumber, (short) 4));

HSSFCell cell180 = row18.createCell(0);
HSSFCell cell183 = row18.createCell(3);
HSSFFont font12 = wb.createFont();
font12.setFontName(HSSFFont.FONT_ARIAL);
font12.setFontHeightInPoints((short) 8);
font12.setUnderline(HSSFFont.U_SINGLE);

HSSFCellStyle service_header_style = wb.createCellStyle();
service_header_style.setFont(font12);
service_header_style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
service_header_style.setVerticalAlignment(HSSFCellStyle.VERTICAL_BOTTOM);
service_header_style.setWrapText(true);
cell180.setCellValue(new HSSFRichTextString(
"Service addresses included in Request for Proposal:"));
cell180.setCellStyle(service_header_style);
cell183.setCellValue(new HSSFRichTextString("No Bid Suppliers:"));
cell183.setCellStyle(service_header_style);

HSSFFont font13 = wb.createFont();
font13.setFontName(HSSFFont.FONT_ARIAL);
font13.setFontHeightInPoints((short) 8);

HSSFCellStyle service_data_style = wb.createCellStyle();
service_data_style.setFont(font13);
++rownumber;
int rowno=rownumber;

HSSFRow rowname;
HSSFCell cellname;

if ((includedAccountsMap != null) &&
(includedAccountsMap.size() > 0)) {
ArrayList serviceAddressList = (ArrayList) includedAccountsMap.get(
"Service_Address");

if (serviceAddressList != null) {
for (int i = 0; i < serviceAddressList.size(); i++) {
rowname = sheet1.createRow((short) rownumber);
cellname = rowname.createCell((short) 0);
cellname.setCellValue(new HSSFRichTextString(
(String) serviceAddressList.get(i)));
cellname.setCellStyle(service_data_style);
++rownumber;
}
}
}



if ((noBidSupplierList != null) && (noBidSupplierList.size() > 0)) {
for (int i = 0; i < noBidSupplierList.size(); i++) {
RFPViewBidsDTO noBidSupplierDTO = (RFPViewBidsDTO) noBidSupplierList.get(i);
if(noBidSupplierDTO!=null){
rowname = sheet1.createRow((short) rowno);
cellname = rowname.createCell((short) 3);
cellname.setCellValue(new HSSFRichTextString(
noBidSupplierDTO.noBidSupplierName));
cellname.setCellStyle(service_data_style);
}
++rowno;
}
}
//added by aparna maddukuri for bug 415 on 09/11/2008
if(termList.size() < 5){
wb.setPrintArea(0, 0, 6, 0, rownumber-1);

}else if(termList.size() >= 5 && termList.size() < 7){
wb.setPrintArea(0, 0, termList.size()+2, 0, rownumber-1);
}
wb.setPrintArea(1, 0, 7, 0, 55);//modified by aparna maddukuri for 934 bug

HSSFPalette p1 = wb.getCustomPalette();

p1.setColorAtIndex(HSSFColor.CORNFLOWER_BLUE.index, (byte) 204, //RGB red (0-255)
(byte) 204, //RGB green
(byte) 255 //RGB blue
);

File f = new File(request.getRealPath("/rfp") + "/system_sop.xls");
FileOutputStream out1 = new FileOutputStream(f);
wb.write(out1);
out1.close();
} catch (Exception e) {
e.printStackTrace();
}
}
//added method for sop enhancement by aparna maddukuri
//modified the method by aparna maddukuri for 934 enhancement
private HSSFSheet getExcelHeaderData(
RFPViewBidsHeaderDTO sopSummaryHeaderDTO, String unit,
HttpServletRequest request, HSSFSheet sheet, HSSFWorkbook wb,int sheetno) {
try {
int increment;
if(sheetno == 2){
increment = 1;
}else{
increment = 0;
}
HSSFRow row0 = sheet.createRow((short) 0);
//row0.setHeightInPoints(75);
row0.setHeight((short)1040);

HSSFCell cell00 = row0.createCell((short) 0);

//setting header image
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor;
if(sheetno == 2){
anchor = new HSSFClientAnchor(0, 0, 0, 255, (short) 0, 0,
(short) (6 + increment), 0);
}else{
anchor = new HSSFClientAnchor(0, 0, 0, 255, (short) 0, 0,
(short) (6), 0);
}
anchor.setAnchorType(2);

HSSFPicture picture;
/*patriarch.createPicture(anchor,
OfficeDrawing.loadPicture(request.getRealPath("/assets/image") +
"/sop_logo.jpg", wb));*/

//below code modified by Jaya to call the loadPicture()newly added within this file
//instead of using OfficeDrawing.loadPicture for BZ8605
//added for SENC-33.
// patriarch.createPicture(anchor,loadPicture(request.getRealPath("/assets/image")+ "/sop_logo.jpg", wb));
// modified by Nagina for bug Maint-1800
// patriarch.createPicture(anchor,loadPicture(request.getRealPath("/assets/image")+ "/schneider_sopheader.jpg", wb));
patriarch.createPicture(anchor,loadPicture(request.getRealPath("/assets/image")+ "/schneider_sopheader_1.jpg", wb));

//setting the footer
HSSFFooter footer = sheet.getFooter();

//Commented by Suganya for Bz.7148
// footer.setLeft("Confidential: For Internal Use Only");
footer.setLeft("Confidential: The information is intended solely for the use of the entity named above.");
footer.setRight("Prepared By Schneider Electric");//SENC footer change

// header data
HSSFCellStyle headerstyle = wb.createCellStyle();
HSSFFont font = wb.createFont();
font.setFontName(HSSFFont.FONT_ARIAL);
font.setFontHeightInPoints((short) 18);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
headerstyle.setFont(font);
headerstyle.setAlignment(HSSFCellStyle.ALIGN_RIGHT);

HSSFRow row2 = sheet.createRow((short) 2);

HSSFCell cell26 = row2.createCell((short) (6 + increment));

cell26.setCellValue(new HSSFRichTextString(
sopSummaryHeaderDTO.clientName));
cell26.setCellStyle(headerstyle);

HSSFCellStyle subheader_style = wb.createCellStyle();
HSSFFont font1 = wb.createFont();
font1.setFontName(HSSFFont.FONT_ARIAL);
font1.setFontHeightInPoints((short) 10);
font1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
subheader_style.setFont(font1);
subheader_style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
subheader_style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//added for SENC-33.
//subheader_style.setFillForegroundColor(HSSFColor.CORNFLOWER_BLUE.index);
subheader_style.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
subheader_style.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
subheader_style.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
subheader_style.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
subheader_style.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
HSSFRow row3 = sheet.createRow((short) 3);
//Recommendation section

if(increment == 1){
HSSFCell cell30 = row3.createCell((short) (0));
HSSFCell cell31 = row3.createCell((short) (1));
HSSFCell cell32 = row3.createCell((short) (2));
cell30.setCellValue(new HSSFRichTextString("Recommendation"));
sheet.addMergedRegion(new Region(3, (short) (0) , 3, (short) (2)));
cell30.setCellStyle(subheader_style);
cell31.setCellStyle(subheader_style);
cell32.setCellStyle(subheader_style);
}else{

HSSFCell cell30 = row3.createCell((short) (0));
HSSFCell cell31 = row3.createCell((short) (1));
cell30.setCellValue(new HSSFRichTextString("Recommendation"));
sheet.addMergedRegion(new Region(3, (short) (0) , 3, (short) (1)));
cell30.setCellStyle(subheader_style);
cell31.setCellStyle(subheader_style);
}


HSSFCell cell36 = row3.createCell((short) (6 + increment));
if(sopSummaryHeaderDTO.bidGroupName!= null){
cell36.setCellValue(new HSSFRichTextString(sopSummaryHeaderDTO.bidGroupName.trim()));//modified by saritha BZ.415 reopen 9.10.2008
}else{
String city_statename = sopSummaryHeaderDTO.cityName.trim()+", "+sopSummaryHeaderDTO.stateName.trim();//modified by saritha BZ.415 reopen 9.10.2008
cell36.setCellValue(new HSSFRichTextString(city_statename));
}



cell36.setCellStyle(headerstyle);

HSSFCellStyle leftdata_style = wb.createCellStyle();
HSSFFont font2 = wb.createFont();
font2.setFontName(HSSFFont.FONT_ARIAL);
font2.setFontHeightInPoints((short) 10);
font2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
leftdata_style.setFont(font2);
leftdata_style.setAlignment(HSSFCellStyle.ALIGN_RIGHT);
leftdata_style.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);

HSSFCellStyle leftdata_style_bottom = wb.createCellStyle();
HSSFFont font4 = wb.createFont();
font4.setFontName(HSSFFont.FONT_ARIAL);
font4.setFontHeightInPoints((short) 10);
font4.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
leftdata_style_bottom.setFont(font4);
leftdata_style_bottom.setAlignment(HSSFCellStyle.ALIGN_RIGHT);
leftdata_style_bottom.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
leftdata_style_bottom.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);

HSSFCellStyle rightdata_style = wb.createCellStyle();
HSSFFont font3 = wb.createFont();
font3.setFontName(HSSFFont.FONT_ARIAL);
font3.setFontHeightInPoints((short) 10);
rightdata_style.setFont(font3);
rightdata_style.setWrapText(true);
rightdata_style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
rightdata_style.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);

HSSFCellStyle rightdata_style_bottom = wb.createCellStyle();
HSSFFont font5 = wb.createFont();
font5.setFontName(HSSFFont.FONT_ARIAL);
font5.setFontHeightInPoints((short) 10);
rightdata_style_bottom.setFont(font5);
rightdata_style_bottom.setWrapText(true);
rightdata_style_bottom.setAlignment(HSSFCellStyle.ALIGN_LEFT);
rightdata_style_bottom.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
rightdata_style_bottom.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);

HSSFCellStyle current_rightdata_style = wb.createCellStyle();
HSSFFont font6 = wb.createFont();
font6.setFontName(HSSFFont.FONT_ARIAL);
font6.setFontHeightInPoints((short) 10);
current_rightdata_style.setFont(font6);
current_rightdata_style.setWrapText(true);
current_rightdata_style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
current_rightdata_style.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
current_rightdata_style.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);

HSSFCellStyle current_rightdata_style_bottom = wb.createCellStyle();
HSSFFont font7 = wb.createFont();
font7.setFontName(HSSFFont.FONT_ARIAL);
font7.setFontHeightInPoints((short) 10);
current_rightdata_style_bottom.setFont(font7);
current_rightdata_style_bottom.setWrapText(true);
current_rightdata_style_bottom.setAlignment(HSSFCellStyle.ALIGN_LEFT);
current_rightdata_style_bottom.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
current_rightdata_style_bottom.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
current_rightdata_style_bottom.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);

HSSFRow row4 = sheet.createRow((short) 4);
HSSFCell cell40 = row4.createCell((short) (0 + increment));
HSSFCell cell41 = row4.createCell((short) (1 + increment));
if(increment == 1){
HSSFCell cell42 = row4.createCell((short) (0));
sheet.addMergedRegion(new Region(4, (short) (0) , 4, (short) (1)));
cell42.setCellValue(new HSSFRichTextString("Supplier:"));
cell42.setCellStyle(leftdata_style);
cell40.setCellStyle(leftdata_style);
}else{
cell40.setCellValue(new HSSFRichTextString("Supplier:"));
cell40.setCellStyle(leftdata_style);
}


if (sopSummaryHeaderDTO.recommendedSupplierNames != null) {
cell41.setCellValue(new HSSFRichTextString(
sopSummaryHeaderDTO.recommendedSupplierNames.substring(
0,
sopSummaryHeaderDTO.recommendedSupplierNames.indexOf(
'~'))));
}

cell41.setCellStyle(rightdata_style);

HSSFRow row5 = sheet.createRow((short) 5);
HSSFCell cell50 = row5.createCell((short) (0+increment));
HSSFCell cell51 = row5.createCell((short) (1+increment));
if(increment == 1){
HSSFCell cell52 = row5.createCell((short) (0));
sheet.addMergedRegion(new Region(5, (short) (0) , 5, (short) (1)));
cell52.setCellValue(new HSSFRichTextString("Indicative Pricing:"));
cell52.setCellStyle(leftdata_style);
cell50.setCellStyle(leftdata_style);
}else{
cell50.setCellValue(new HSSFRichTextString("Indicative Pricing:"));
cell50.setCellStyle(leftdata_style);
}


String productname = new String();
String parsedproductNames = null;
String parsedpriceProducts = null;
if (sopSummaryHeaderDTO.productNames != null) {
productname = sopSummaryHeaderDTO.productNames.trim();//modified by saritha BZ.415 reopen 9.10.2008
StringTokenizer st = new StringTokenizer(productname);//added the code to remove the extra spaces by aparna maddukuri for bug 415 on 09/11/2008
while (st.hasMoreTokens()) {
if(parsedproductNames == null){
parsedproductNames = st.nextToken().trim();
}else{
parsedproductNames = parsedproductNames + " "+ st.nextToken().trim();
}
}
if (sopSummaryHeaderDTO.priceProducts != null) {

productname = sopSummaryHeaderDTO.priceProducts.trim();//modified by saritha BZ.415 reopen 9.10.2008
StringTokenizer st1 = new StringTokenizer(productname);//added the code to remove the extra spaces by aparna maddukuri for bug 415 on 09/11/2008
while (st1.hasMoreTokens()) {
if(parsedpriceProducts == null){
parsedpriceProducts = st1.nextToken().trim();
}else{
parsedpriceProducts = parsedpriceProducts + " "+ st1.nextToken().trim();
}
}


}
if(parsedpriceProducts !=null){
productname = parsedproductNames + ", " +parsedpriceProducts;
}else{
productname = parsedproductNames;
}

cell51.setCellType(HSSFCell.CELL_TYPE_STRING);
cell51.setCellValue(productname);
}

cell51.setCellStyle(rightdata_style);

HSSFRow row6 = sheet.createRow((short) 6);
HSSFCell cell60 = row6.createCell((short) (0+increment));
HSSFCell cell61 = row6.createCell((short) (1+increment));
if(increment == 1){
HSSFCell cell62 = row6.createCell((short) (0));
sheet.addMergedRegion(new Region(6, (short) (0) , 6, (short) (1)));
cell62.setCellValue(new HSSFRichTextString("Term:"));
cell62.setCellStyle(leftdata_style);
cell60.setCellStyle(leftdata_style);
}else{
cell60.setCellValue(new HSSFRichTextString("Term:"));
cell60.setCellStyle(leftdata_style);
}



if (sopSummaryHeaderDTO.terms != null) {
cell61.setCellValue(new HSSFRichTextString(
sopSummaryHeaderDTO.terms));
}

cell61.setCellStyle(rightdata_style);

HSSFRow row7 = sheet.createRow((short) 7);
HSSFCell cell70 = row7.createCell((short) (0+increment));
HSSFCell cell71 = row7.createCell((short) (1+increment));
if(increment == 1){
HSSFCell cell72 = row7.createCell((short) (0));
sheet.addMergedRegion(new Region(7, (short) (0) , 7, (short) (1)));
cell72.setCellValue(new HSSFRichTextString("LDC(s):"));
cell72.setCellStyle(leftdata_style);
cell70.setCellStyle(leftdata_style);
}else{
cell70.setCellValue(new HSSFRichTextString("LDC(s):"));
cell70.setCellStyle(leftdata_style);
}


if (sopSummaryHeaderDTO.utilityNames != null) {
cell71.setCellValue(new HSSFRichTextString(
sopSummaryHeaderDTO.utilityNames));
}

cell71.setCellStyle(rightdata_style);

HSSFRow row8 = sheet.createRow((short) 8);
HSSFCell cell80 = row8.createCell((short) (0+increment));
HSSFCell cell81 = row8.createCell((short) (1+increment));
if(increment == 1){
HSSFCell cell82 = row8.createCell((short) (0));
sheet.addMergedRegion(new Region(8, (short) (0) , 8, (short) (1)));
cell82.setCellValue(new HSSFRichTextString("Estimated Volume:"));
cell82.setCellStyle(leftdata_style);
cell80.setCellStyle(leftdata_style);
}else{
cell80.setCellValue(new HSSFRichTextString("Estimated Volume:"));
cell80.setCellStyle(leftdata_style);
}


String text = CBMS7Util.getDiffernceVolume(sopSummaryHeaderDTO.lpSize) +" "+unit;

if (sopSummaryHeaderDTO.lpSize > 0.0) {
cell81.setCellValue(new HSSFRichTextString(text));
}

cell81.setCellStyle(rightdata_style);

HSSFRow row9 = sheet.createRow((short) 9);
HSSFCell cell90 = row9.createCell((short) (0+increment));
HSSFCell cell91 = row9.createCell((short) (1+increment));
if(increment == 1){
HSSFCell cell92 = row9.createCell((short) (0));
sheet.addMergedRegion(new Region(9, (short) (0) , 9, (short) (1)));
cell92.setCellValue(new HSSFRichTextString("Level of Service:"));
cell92.setCellStyle(leftdata_style_bottom);
cell90.setCellStyle(leftdata_style_bottom);
}else{
cell90.setCellValue(new HSSFRichTextString("Level of Service:"));
cell90.setCellStyle(leftdata_style_bottom);
}


if (sopSummaryHeaderDTO.serviceLevels != null) {
cell91.setCellValue(new HSSFRichTextString(
sopSummaryHeaderDTO.serviceLevels));
}

cell91.setCellStyle(rightdata_style_bottom);

HSSFDataFormat myformat = wb.createDataFormat();

HSSFCellStyle dateStyle = wb.createCellStyle();
dateStyle.setDataFormat(myformat.getFormat("mmmm d, yyyy"));

HSSFFont font8 = wb.createFont();
font8.setFontName(HSSFFont.FONT_ARIAL);
font8.setFontHeightInPoints((short) 12);
font8.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
dateStyle.setFont(font8);
dateStyle.setAlignment(HSSFCellStyle.ALIGN_RIGHT);

Date d = new Date();
HSSFCell cell46 = row4.createCell((short) (6+increment));
if(sopSummaryHeaderDTO.sopCreationDate != null){
cell46.setCellValue(sopSummaryHeaderDTO.sopCreationDate);
}
cell46.setCellStyle(dateStyle);

//Current Position section
HSSFCell cell66 = row6.createCell((short) (6+increment));
cell66.setCellValue(new HSSFRichTextString("Current Position"));
cell66.setCellStyle(subheader_style);

HSSFCell cell76 = row7.createCell((short) (6+increment));

if (sopSummaryHeaderDTO.currentVendorName != null) {
cell76.setCellValue(new HSSFRichTextString("Supplier: " +
sopSummaryHeaderDTO.currentVendorName));
} else {
cell76.setCellValue(new HSSFRichTextString("Supplier: "));
}

cell76.setCellStyle(current_rightdata_style);

HSSFCell cell86 = row8.createCell((short) (6+increment));

if (sopSummaryHeaderDTO.priceSummary != null) {
cell86.setCellValue(new HSSFRichTextString("Price: " +
sopSummaryHeaderDTO.priceSummary));
} else {
cell86.setCellValue(new HSSFRichTextString("Price: "));
}

cell86.setCellStyle(current_rightdata_style);

HSSFCell cell96 = row9.createCell((short) (6+increment));
String longestDate = "";

if ((sopSummaryHeaderDTO.startDate != null) &&
(sopSummaryHeaderDTO.endDate != null)) {
Calendar cal = new GregorianCalendar();
cal.setTime(sopSummaryHeaderDTO.startDate);

int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
String fromDate = CBMS7Util.getShortMonthYear(month, year);
cal.setTime(sopSummaryHeaderDTO.endDate);

int month2 = cal.get(Calendar.MONTH);
int year2 = cal.get(Calendar.YEAR);
int diffmnths = ((year2 - year) * 12) + (month2 - month) + 1;
longestDate = fromDate + " (" + diffmnths + " months)";
cell96.setCellValue(new HSSFRichTextString("Term: " +
longestDate));
} else {
cell96.setCellValue(new HSSFRichTextString("Term: "));
}

cell96.setCellStyle(current_rightdata_style_bottom);
} catch (Exception e) {
e.printStackTrace();
}

return sheet;
}

//start added by Jaya for displaying logo in Excel Downlaod

private int loadPicture( String path, HSSFWorkbook wb ) throws IOException
{
int pictureIndex;
FileInputStream fis = null;
ByteArrayOutputStream bos = null;
try
{
fis = new FileInputStream( path);
bos = new ByteArrayOutputStream( );
int c;
while ( (c = fis.read()) != -1)
bos.write( c );
pictureIndex = wb.addPicture(bos.toByteArray(),HSSFWorkbook.PICTURE_TYPE_JPEG);
}
finally
{
if (fis != null)
fis.close();
if (bos != null)
bos.close();
}
return pictureIndex;
}

//end added by Jaya for displaying logo in Excel Downlaod

//added method for sop enhancement by aparna maddukuri
//modified the method by aparna maddukuri for 934 enhancement
private HSSFSheet getExcelStaticData(HSSFSheet sheet, HSSFWorkbook wb,
HttpServletRequest request) {
try {
HSSFCellStyle boldheader_style = wb.createCellStyle();
HSSFFont font = wb.createFont();
font.setFontName(HSSFFont.FONT_ARIAL);
font.setFontHeightInPoints((short) 14);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
boldheader_style.setFont(font);

HSSFCellStyle text_style = wb.createCellStyle();
HSSFFont font1 = wb.createFont();
font1.setFontName(HSSFFont.FONT_ARIAL);
font1.setFontHeightInPoints((short) 12);
text_style.setFont(font1);
text_style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
text_style.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP);

HSSFCellStyle smrfooter_style = wb.createCellStyle();
HSSFFont font2 = wb.createFont();
font2.setFontName("Times New Roman");
font2.setFontHeightInPoints((short) 8);
font2.setItalic(true);
//smrfooter_style.setFont(font2);
smrfooter_style.setWrapText(true);
smrfooter_style.setAlignment(HSSFCellStyle.ALIGN_JUSTIFY);
smrfooter_style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

HSSFFont font3 = wb.createFont();
font3.setFontName("Times New Roman");
font3.setFontHeightInPoints((short) 8);
font3.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font3.setItalic(true);

HSSFCellStyle bullet_style = wb.createCellStyle();
//smrfooter_style.setFont(font2);
bullet_style.setWrapText(true);
bullet_style.setAlignment(HSSFCellStyle.ALIGN_GENERAL);
bullet_style.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP);
bullet_style.setFont(font1);



HSSFRow row12 = sheet.createRow((short) 12);
HSSFCell cell120 = row12.createCell((short) 0);
cell120.setCellValue(new HSSFRichTextString("ANALYSIS"));
cell120.setCellStyle(boldheader_style);

InputStream inp = new FileInputStream(request.getRealPath("/rfp") +
"/sop_staticdata.xls");
HSSFWorkbook wb1 = new HSSFWorkbook(new POIFSFileSystem(inp));
int sheetrow = 0;
HSSFRow rowname;
HSSFCell cellname;
HSSFCell datacell;


rowname = sheet.createRow((short) 13);
cellname = rowname.createCell((short) 0);
datacell = wb1.getSheetAt(0).getRow(sheetrow).getCell((short) 0);
cellname.setCellValue(datacell.getStringCellValue());
cellname.setCellStyle(text_style);
cellname = rowname.createCell((short) 1);
sheet.addMergedRegion(new Region(13, (short) 1 , 13, (short) 7) );
cellname.setCellStyle(bullet_style);



HSSFRow row18 = sheet.createRow((short) 15);
HSSFCell cell180 = row18.createCell((short) 0);
cell180.setCellValue(new HSSFRichTextString("BENEFITS"));
cell180.setCellStyle(boldheader_style);


rowname = sheet.createRow((short) 16);
cellname = rowname.createCell((short) 0);
datacell = wb1.getSheetAt(0).getRow(sheetrow).getCell((short) 0);
cellname.setCellValue(datacell.getStringCellValue());
cellname.setCellStyle(text_style);
cellname = rowname.createCell((short) 1);
sheet.addMergedRegion(new Region(16, (short) 1 , 16, (short) 7) );
cellname.setCellStyle(bullet_style);



HSSFRow row23 = sheet.createRow((short) 18);
HSSFCell cell230 = row23.createCell((short) 0);
cell230.setCellValue(new HSSFRichTextString("RISKS"));
cell230.setCellStyle(boldheader_style);


rowname = sheet.createRow((short) 19);
cellname = rowname.createCell((short) 0);
datacell = wb1.getSheetAt(0).getRow(sheetrow).getCell((short) 0);
cellname.setCellValue(datacell.getStringCellValue());
cellname.setCellStyle(text_style);
cellname = rowname.createCell((short) 1);
sheet.addMergedRegion(new Region(19, (short) 1 , 19, (short) 7) );
cellname.setCellStyle(bullet_style);


HSSFRow row28 = sheet.createRow((short) 21);
HSSFCell cell280 = row28.createCell((short) 0);
cell280.setCellValue(new HSSFRichTextString("IMPLEMENTATION"));
cell280.setCellStyle(boldheader_style);


rowname = sheet.createRow((short) 22);
cellname = rowname.createCell((short) 0);
datacell = wb1.getSheetAt(0).getRow(sheetrow).getCell((short) 0);
cellname.setCellValue(datacell.getStringCellValue());
cellname.setCellStyle(text_style);
cellname = rowname.createCell((short) 1);
sheet.addMergedRegion(new Region(22, (short) 1 , 22, (short) 7) );
cellname.setCellStyle(bullet_style);


HSSFRow row32 = sheet.createRow((short) 25);
HSSFCell cell320 = row32.createCell((short) 0);
cell320.setCellValue(new HSSFRichTextString(
"Prepared By: XXXXXXXX"));
cell320.setCellStyle(boldheader_style);

HSSFRow row33 = sheet.createRow((short) 26);
HSSFCell cell330 = row33.createCell((short) 0);
cell330.setCellValue(new HSSFRichTextString(
"Sourcing - XXXXXXXX Region"));
cell330.setCellStyle(boldheader_style);

HSSFRow row36 = sheet.createRow((short) 29);
row36.setHeightInPoints((float) 65.25);
sheet.addMergedRegion(new Region(29, (short) 0, 29, (short) 7));

// Commented by Suganya for Bz.7148
//String text="All proposals offered through this RFP are contingent on market conditions upon executing the contract. Actual prices at the time of execution may differ from prices referenced in this recommendation. Savings referenced in this document are based on information available to Summit at this time; client’s actual savings experience may differ. In implementing, or requesting that Summit implement, this recommendation, Client acknowledges that they have read and understood the information contained herein. Client reserves final authority over all contract language previously negotiated by Summit. Client may ask Summit for clarification of information above, and for additional information as required to make a decision regarding this recommendation. Schneider Electric makes no guarantee that client will achieve any savings described in this document. Schneider Electric Services, Inc. has reviewed financial information and references provided by the recommended supplier. Prior to implementing this recommendation, Client is invited to conduct an independent review of the supplier. Confidential Information: For Internal Use Only.";
//added for SENC-33.
String text= "All proposals and associated savings benefit offered through this RFP are contingent on market conditions upon executing the contract. Client reserves final authority over all contract language previously negotiated by Schneider Electric. Confidential Information: The information contained in this document, constitutes confidential information, which belongs to Schneider Electric. This information is intended solely for the use of the individual(s) or entity named above. You are hereby notified that any disclosure, copying, distribution, or the taking of any action in reliance on this information, is strictly prohibited.";

int startindex=text.indexOf("Confidential");
int lastindex=text.indexOf("d.");
HSSFRichTextString smr_footer = new HSSFRichTextString(text);
smr_footer.applyFont(0,startindex,font2);
smr_footer.applyFont(startindex,lastindex+1,font3);
smr_footer.applyFont(lastindex+1,text.length()-1,font2);
HSSFCell cell360 = row36.createCell((short) 0);
cell360.setCellValue(smr_footer);
cell360.setCellStyle(smrfooter_style);
} catch (Exception e) {
e.printStackTrace();
}

return sheet;
}
}

=======================================================

and i am getting the following error while running the application at perticular place..

ERROR [[action]] Servlet.service() for servlet action threw exception

java.lang.VerifyError: (class: com/summit/cbms7/presentation/rfp/action/RFPViewSOPAction, method: getExcelStaticData signature: (Lorg/apache/poi/hssf/usermodel/HSSFSheet;Lorg/apache/poi/hssf/usermodel/HSSFWorkbook;Ljavax/servlet/http/HttpServletRequest;)Lorg/apache/poi/hssf/usermodel/HSSFSheet;) Incompatible argument to function

at java.lang.Class.getDeclaredConstructors0(Native Method)

at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)

at java.lang.Class.getConstructor0(Class.java:2699)

at java.lang.Class.newInstance0(Class.java:326)

at java.lang.Class.newInstance(Class.java:308)

at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:231)

at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:326)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

at com.summit.common.presentation.SummitActionServlet.process(SummitActionServlet.java:159)

at com.summit.cbms3.presentation.CBMS3ActionServlet.process(CBMS3ActionServlet.java:152)

at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)

at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Thread.java:619)

=======================================================

am using jboss server in ecplise configuaraton...

============================================

3 answers

Suggest an answer

Log in or Sign up to answer
0 votes
harinath t July 8, 2013
jbos server library holding poi jar files thats y it throws the servletException
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 2, 2013

I think you've posted this as a new question instead of a comment under

https://answers.atlassian.com/questions/186237/please-give-me-the-solution-for-this-java-lang-verifyerror-incompatible-argument-to-function

Alex does have a point though - you've mentioned "excel download", which I've assumed means "within Jira", but we really can't help you if you're not talking about an Atlassian product.

Except to tell you again that your code is wrong - it's passing the wrong object type to a function call. But we don't know what the libraries are because they don't look like Atlassian ones.

0 votes
Alex Perez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 2, 2013

This is the Atlassian community forums and the code has nothing to do with Atlassian products

TAGS
AUG Leaders

Atlassian Community Events