Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.Connection;
- import java.sql.ResultSet;
- import java.sql.Statement;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Calendar;
- import java.util.Date;
- import java.util.Enumeration;
- import java.util.GregorianCalendar;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Properties;
- import java.util.Vector;
- import javax.activation.DataHandler;
- import javax.activation.DataSource;
- import javax.activation.FileDataSource;
- import javax.mail.Message;
- import javax.mail.MessagingException;
- import javax.mail.Multipart;
- import javax.mail.Session;
- import javax.mail.Transport;
- import javax.mail.internet.InternetAddress;
- import javax.mail.internet.MimeBodyPart;
- import javax.mail.internet.MimeMessage;
- import javax.mail.internet.MimeMultipart;
- import mshtml.IHTMLElement;
- import mshtml.IHTMLInputElement;
- import mshtml.IHTMLTextAreaElement;
- import org.apache.poi.hssf.usermodel.HSSFCell;
- import org.apache.poi.hssf.usermodel.HSSFCellStyle;
- import org.apache.poi.hssf.usermodel.HSSFFont;
- 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 yodlee.gather.ClassArgs;
- import yodlee.gather.IYodRobot;
- import yodlee.gather.LoginInfo;
- import yodlee.gather.RequestItem;
- import yodlee.gather.Script;
- import yodlee.gather.User;
- import yodlee.gather.content.Site;
- import yodlee.gather.exceptions.GeneralException;
- import yodlee.util.JavaComBridgeHelper;
- public class TestScraping1 extends Script {
- private final boolean revisedEta = false;
- static HSSFCellStyle styleHeader;
- static HSSFCellStyle styleHeader_formula;
- static HSSFCellStyle styleHeader_row = null;
- static HSSFWorkbook wb = new HSSFWorkbook();
- static SimpleDateFormat sdf = new SimpleDateFormat(ScriptConstants.DATEFORMAT_MM_SL_DD_SL_YYYY);
- static Date date = new Date();
- Date yestdate;
- String strLine;
- static Connection connection = null;
- static Statement st;
- static ResultSet result = null;
- static int rownumber=0;
- static String attachedFileName = null;
- List<Bug> freshBugList = new ArrayList<Bug>();
- List<Bug> revisedETABugList = new ArrayList<Bug>();
- List<Bug> reopenedETABugList = new ArrayList<Bug>();
- List<Bug> freshBugListFI = new ArrayList<Bug>();
- List<Bug> revisedETABugListFI = new ArrayList<Bug>();
- List<Bug> reopenedETABugListFI = new ArrayList<Bug>();
- List<Bug> freshBugListNW = new ArrayList<Bug>();
- List<Bug> revisedETABugListNW = new ArrayList<Bug>();
- List<Bug> reopenedETABugListNW = new ArrayList<Bug>();
- List<Bug> freshBugListNDD = new ArrayList<Bug>();
- List<Bug> revisedETABugListNDD = new ArrayList<Bug>();
- List<Bug> reopenedETABugListNDD = new ArrayList<Bug>();
- List<Bug> freshBugListWL = new ArrayList<Bug>();
- List<Bug> revisedETABugListWL = new ArrayList<Bug>();
- List<Bug> reopenedETABugListWL = new ArrayList<Bug>();
- static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ScriptConstants.DATEFORMAT_DD_HYP_MM_HYP_YYYY);
- private final String triageDate = simpleDateFormat.format(date);
- public int login(LoginInfo loginInfo, User user, ClassArgs args, IYodRobot pRobot) throws Exception{
- pRobot.get("https://blrbugzilla.yodlee.com/");
- ScriptUtil.sleep(3);
- IHTMLElement loginEle = HTMLUtils.getElementWithAttribute(pRobot, ScriptConstants.HREF_TAG, ScriptConstants.INNERTEXT_ATB, "Log In", false);
- pRobot.clickWithEvents(loginEle, false);
- ScriptUtil.setInputAny(pRobot,"Bugzilla_login","mmanjunath");
- ScriptUtil.setInputAny(pRobot,"Bugzilla_password","Ivbgod@bz");
- pRobot.click(ScriptConstants.INPUT_TAG,ScriptConstants.VALUE_ATB,"Log in");
- pRobot.checkFailString(loginInfo);
- ScriptUtil.sleep(3);
- if(pRobot.isTextFoundOnPage("I18N- YI CURRENT", false)){
- pRobot.clickLinkWithText("Open Bugs I18N- YI");
- }else{
- pRobot.clickLinkWithText("Open Bugs I18N- YI");
- }
- ScriptUtil.sleep(6);
- pRobot.clickLinkWithText("Change Columns");
- pRobot.selectOptionWithEvents(ScriptConstants.NAME_ATB, "available_columns", ScriptConstants.VALUE_ATB, "cf_workflow_status");
- IHTMLElement clickStatusElement1 = HTMLUtils.getElementWithAttribute(pRobot, "button", "id", "select_button", false);
- YDataLogger.out("2^^^loginEle : "+clickStatusElement1.getInnerText());
- pRobot.click(clickStatusElement1, false);
- pRobot.selectOptionWithEvents(ScriptConstants.NAME_ATB, "available_columns", ScriptConstants.VALUE_ATB, "cf_rca");
- IHTMLElement clickStatusElement2 = HTMLUtils.getElementWithAttribute(pRobot, "button", "id", "select_button", false);
- pRobot.click(clickStatusElement2, false);
- pRobot.selectOptionWithEvents(ScriptConstants.NAME_ATB, "available_columns", ScriptConstants.VALUE_ATB, "status_whiteboard");
- IHTMLElement clickStatusElement3 = HTMLUtils.getElementWithAttribute(pRobot, "button", "id", "select_button", false);
- pRobot.click(clickStatusElement3, false);
- pRobot.selectOptionWithEvents(ScriptConstants.NAME_ATB, "available_columns", ScriptConstants.VALUE_ATB, "short_desc");
- IHTMLElement clickStatusElement4 = HTMLUtils.getElementWithAttribute(pRobot, "button", "id", "select_button", false);
- pRobot.click(clickStatusElement4, false);
- pRobot.clickInputWithValue("Change Columns");
- ScriptUtil.sleep(16);
- ScriptUtil.sleep(16);
- ScriptUtil.sleep(16);
- return RequestItem.RETURN_CODE_SUCCESS;
- }
- protected List<HashMap<String, String>> scrapBugList(IYodRobot pRobot) throws Exception{
- ScriptUtil.sleep(5);
- Enumeration tableEnum = pRobot.getInnermostTablesContainingText("ID", false, -1);
- if(tableEnum.hasMoreElements()){
- IHTMLElement tableElement = JavaComBridgeHelper.toIHTMLElement(tableEnum.nextElement());
- //YDataLogger.out("2^^^innertext : "+tableElement.getInnerText());
- String[][] columnHeaders = new String[][] {{"ID"},{"Whiteboard"},{"Summary"},{"Workflow Status"},{"RCA IAE"}};
- String [] valueHeaders = new String[]{"ID", "Whiteboard","Summary", "Workflow Status", "RCA IAE"};
- int [] valueHeaderCellType = new int [] {HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT};
- return HTMLUtils.getTableData(pRobot,tableElement,"ID",columnHeaders,null,new boolean[]{false,false,false,false,false},1,0, valueHeaderCellType, valueHeaders);
- }else{
- throw new GeneralException("Table identifier is changed");
- }
- }
- protected List getRevisedBugsList(IYodRobot pRobot) throws Exception{
- List<Bug> bugList = new ArrayList<Bug>();
- List<HashMap<String, String>> list = scrapBugList(pRobot);
- for(HashMap<String,String> prop :list){
- String bugID =prop.get("ID");
- String rcaIAE =prop.get("RCA IAE");
- String workFlowStatus = prop.get("Workflow Status");
- String whiteboard = prop.get("Whiteboard");
- //YDataLogger.out("2^^^^^^^^bugID::"+bugID+" ^^^^rcaIAE : " +rcaIAE +" ^^workFlowStatus : "+ workFlowStatus+" ^^^whiteBoard : "+whiteBoard);
- if(!workFlowStatus.equalsIgnoreCase("Analyzed") || !whiteboard.toLowerCase().contains("triage")){
- continue;
- }
- if(whiteboard.contains("ETA") && whiteboard.contains("Triage")){
- //YDataLogger.out("2^^^revised ETA : "+whiteboard+" ^^^bugID : "+bugID);
- String oldEtaDate = whiteboard.substring(whiteboard.lastIndexOf(":")+1);
- YDataLogger.out("2^^^^^^^oldEtaDate::"+oldEtaDate);
- Date etaDate = simpleDateFormat.parse(oldEtaDate);
- Date newTriagDate = simpleDateFormat.parse(triageDate);
- if(etaDate.before(newTriagDate)){
- YDataLogger.out("2^^^^reviseETAbugID : "+bugID);
- Bug bug = new Bug();
- bug.setBugid(bugID);
- bug.setRcaIae(rcaIAE);
- bug.setWhiteBoard(whiteboard);
- bug.setWorkFlowStatus(workFlowStatus);
- bugList.add(bug);
- }
- }
- }
- return bugList;
- }
- /**
- * This method is used to scrape the accounts summary table.
- * @param pRobot
- * @return accountsList
- */
- protected void getBugsList(IYodRobot pRobot) throws Exception{
- List<HashMap<String, String>> list = scrapBugList(pRobot);
- for(HashMap<String,String> prop :list){
- String bugID =prop.get("ID");
- String rcaIAE =prop.get("RCA IAE");
- String workFlowStatus = prop.get("Workflow Status");
- String whiteBoard = prop.get("Whiteboard");
- YDataLogger.out("2^^^^^^^^bugID::"+bugID+" ^^^^rcaIAE : " +rcaIAE +" ^^workFlowStatus : "+ workFlowStatus+" ^^^whiteBoard : "+whiteBoard);
- Bug bug = new Bug();
- /*
- * Those bugs which contains "reopened eta" is reopen bug triaged by the team on the current date
- * For revised ETA we have to update the old Triaged Date with New Triaged Date
- * */
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("reopened eta") && (whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- || whiteBoard.toLowerCase().contains("triaged:"+triageDate) || whiteBoard.toLowerCase().contains("triage:"+triageDate))){
- bug.setBugid(bugID);
- reopenedETABugList.add(bug);
- continue;
- }
- if(!workFlowStatus.equalsIgnoreCase("Analyzed") || rcaIAE.equals("---")){
- continue;
- }
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("triage" )){
- continue;
- }
- YDataLogger.out("2^^^^freshbugID : "+bugID);
- bug.setBugid(bugID);
- bug.setRcaIae(rcaIAE);
- bug.setWhiteBoard(whiteBoard);
- bug.setWorkFlowStatus(workFlowStatus);
- freshBugList.add(bug);
- }
- }
- protected void getBugsListCommon(IYodRobot pRobot, String teamName) throws Exception{
- YDataLogger.out("2^^^^date : "+triageDate);
- YDataLogger.out("2^^^teamName : "+teamName);
- Enumeration tableEnum = pRobot.getInnermostTablesContainingText("ID", false, -1);
- while(tableEnum.hasMoreElements()){
- IHTMLElement tableElement = JavaComBridgeHelper.toIHTMLElement(tableEnum.nextElement());
- YDataLogger.out("2^^^innertext : "+tableElement.getInnerText());
- String[][] columnHeaders = new String[][] {{"ID"},{"Whiteboard"},{"Summary"},{"Workflow Status"},{"RCA IAE"}};
- String [] valueHeaders = new String[]{"ID", "Whiteboard","Summary", "Workflow Status", "RCA IAE"};
- int [] valueHeaderCellType = new int [] {HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT};
- List<HashMap<String, String>> list = HTMLUtils.getTableData(pRobot,tableElement,"ID",columnHeaders,null,new boolean[]{false,false,false,false,false},1,0, valueHeaderCellType, valueHeaders);
- for(HashMap<String,String> prop :list){
- String bugID =prop.get("ID");
- String rcaIAE =prop.get("RCA IAE");
- String workFlowStatus = prop.get("Workflow Status");
- String whiteBoard = prop.get("Whiteboard");
- YDataLogger.out("2^^^^^^^^bugID::"+bugID+" ^^^^rcaIAE : " +rcaIAE +" ^^workFlowStatus : "+ workFlowStatus+" ^^^whiteBoard : "+whiteBoard);
- Bug bug = new Bug();
- /*
- * Those bugs which contains "reopened eta" is reopen bug triaged by the team on the current date
- * For revised ETA we have to update the old Triaged Date with New Triaged Date
- * */
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("reopened eta") && (whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- || whiteBoard.toLowerCase().contains("triaged:"+triageDate) || whiteBoard.toLowerCase().contains("triaged – "+triageDate))){
- YDataLogger.out("inside it ropened");
- bug.setBugid(bugID);
- if(teamName.equals("YI")){
- reopenedETABugList.add(bug);
- }else if(teamName.equals("FI")){
- reopenedETABugListFI.add(bug);
- }else if(teamName.equals("NW")){
- reopenedETABugListNW.add(bug);
- }else if(teamName.equals("NDD")){
- reopenedETABugListNDD.add(bug);
- }else if(teamName.equals("WEALTH")){
- reopenedETABugListWL.add(bug);
- }
- continue;
- }
- /*
- * Those bugs which contains "revised eta" is revised eta bug triaged by the team on the current date
- * For revised ETA we have to update the old Triaged Date with New Triaged Date
- * */
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("revised eta") && (whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- || whiteBoard.toLowerCase().contains("triaged:"+triageDate))){
- YDataLogger.out("inside it revised");
- bug.setBugid(bugID);
- if(teamName.equals("YI")){
- revisedETABugList.add(bug);
- }else if(teamName.equals("FI")){
- revisedETABugListFI.add(bug);
- }else if(teamName.equals("NW")){
- revisedETABugListNW.add(bug);
- }else if(teamName.equals("NDD")){
- revisedETABugListNDD.add(bug);
- }else if(teamName.equals("WEALTH")){
- revisedETABugListWL.add(bug);
- }
- continue;
- }
- //Those bugs which contains "triage - currentdate" is freshed bug triaged by the team on the current date
- if(ScriptUtil.isNullValue(whiteBoard) || (!ScriptUtil.isNullValue(whiteBoard) && !whiteBoard.toLowerCase().contains("triaged – "+triageDate) && !whiteBoard.toLowerCase().contains("triaged - "+triageDate))){
- YDataLogger.out("inside it fresh");
- continue;
- }
- bug.setBugid(bugID);
- if(teamName.equals("YI")){
- freshBugList.add(bug);
- }else if(teamName.equals("FI")){
- freshBugListFI.add(bug);
- }else if(teamName.equals("NW")){
- freshBugListNW.add(bug);
- }else if(teamName.equals("NDD")){
- freshBugListNDD.add(bug);
- }else if(teamName.equals("WEALTH")){
- freshBugListWL.add(bug);
- }
- }
- }
- YDataLogger.out("2^^^freshBugListNW : "+freshBugListNW.size()+" ^^^reopenedETABugListNW : "+reopenedETABugListNW);
- }
- protected void getYIDomesticBugsList(IYodRobot pRobot) throws Exception{
- YDataLogger.out("2^^^^date : "+triageDate);
- Enumeration tableEnum = pRobot.getInnermostTablesContainingText("ID", false, -1);
- while(tableEnum.hasMoreElements()){
- IHTMLElement tableElement = JavaComBridgeHelper.toIHTMLElement(tableEnum.nextElement());
- //YDataLogger.out("2^^^innertext : "+tableElement.getInnerText());
- String[][] columnHeaders = new String[][] {{"ID"},{"Whiteboard"},{"Summary"},{"Workflow Status"},{"RCA IAE"}};
- String [] valueHeaders = new String[]{"ID", "Whiteboard","Summary", "Workflow Status", "RCA IAE"};
- int [] valueHeaderCellType = new int [] {HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT};
- List<HashMap<String, String>> list = HTMLUtils.getTableData(pRobot,tableElement,"ID",columnHeaders,null,new boolean[]{false,false,false,false,false},1,0, valueHeaderCellType, valueHeaders);
- for(HashMap<String,String> prop :list){
- String bugID =prop.get("ID");
- String rcaIAE =prop.get("RCA IAE");
- String workFlowStatus = prop.get("Workflow Status");
- String whiteBoard = prop.get("Whiteboard");
- //YDataLogger.out("2^^^^^^^^bugID::"+bugID+" ^^^^rcaIAE : " +rcaIAE +" ^^workFlowStatus : "+ workFlowStatus+" ^^^whiteBoard : "+whiteBoard);
- Bug bug = new Bug();
- /*
- * Those bugs which contains "reopened eta" is reopen bug triaged by the team on the current date
- * For revised ETA we have to update the old Triaged Date with New Triaged Date
- * */
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("reopened eta") && (whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- || whiteBoard.toLowerCase().contains("triaged:"+triageDate))){
- YDataLogger.out("inside it");
- bug.setBugid(bugID);
- reopenedETABugList.add(bug);
- continue;
- }
- /*
- * Those bugs which contains "revised eta" is revised eta bug triaged by the team on the current date
- * For revised ETA we have to update the old Triaged Date with New Triaged Date
- * */
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("revised eta") && (whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- || whiteBoard.toLowerCase().contains("triaged:"+triageDate))){
- YDataLogger.out("inside it");
- bug.setBugid(bugID);
- revisedETABugList.add(bug);
- continue;
- }
- //Those bugs which contains "triage - currentdate" is freshed bug triaged by the team on the current date
- if(ScriptUtil.isNullValue(whiteBoard) || (!ScriptUtil.isNullValue(whiteBoard) && !whiteBoard.toLowerCase().contains("triaged – "+triageDate))){
- continue;
- }
- bug.setBugid(bugID);
- freshBugList.add(bug);
- }
- }
- }
- private void setKeyWords(IYodRobot pRobot)
- {
- IHTMLElement elem=HTMLUtils.getElementWithAttribute(pRobot,ScriptConstants.INPUT_TAG,ScriptConstants.NAME_ATB,"keywords",false);
- IHTMLInputElement inputEle=JavaComBridgeHelper.toIHTMLInputElement(elem);
- inputEle.setValue("I18N_Sites");
- }
- //method to set RevisedEta of a bug
- public void setRevisedEta(IYodRobot pRobot, String whiteboard, Bug bug) throws ParseException{
- String triagedDay=simpleDateFormat.parse(triageDate).toString();
- YDataLogger.out("2^^^^^^^triagedDay::"+triagedDay);
- int days = 1;
- if(triagedDay.indexOf("Fri")>=0){
- days+=2;
- }
- Date newTriagDate = simpleDateFormat.parse(triageDate);
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(newTriagDate);
- calendar.add(Calendar.DAY_OF_MONTH, days);
- Date eta = calendar.getTime();
- String newEtaDate = simpleDateFormat.format(eta);
- //updating new ETA
- //whiteboard = YUtilities.removeAndReplace(whiteboard, oldEtaDate, newEtaDate);
- whiteboard = whiteboard + ",Revised ETA: "+newEtaDate;
- String URL="https://blrbugzilla.yodlee.com/show_bug.cgi?id=";
- pRobot.get(URL+bug.getBugid());
- IHTMLElement elem=HTMLUtils.getElementWithAttribute(pRobot,ScriptConstants.INPUT_TAG,ScriptConstants.NAME_ATB,"status_whiteboard", false);
- IHTMLInputElement inputEle=JavaComBridgeHelper.toIHTMLInputElement(elem);
- inputEle.setValue(whiteboard);
- //variable to get the count of revised eta bug
- revisedETABugList.add(bug);
- this.setKeyWords(pRobot);
- IHTMLElement sameEle = HTMLUtils.getElementWithAttribute(pRobot, "b", ScriptConstants.INNERTEXT_ATB, "Additional Comments", false);
- sameEle = HTMLUtils.getNextHTMLElement(sameEle, ScriptConstants.TEXTAREA_TAG, 1);
- IHTMLTextAreaElement commentEle = JavaComBridgeHelper.toIHTMLTextAreaElement(sameEle);
- commentEle.setValue("Updating ETA");
- pRobot.clickInputWithValue("Save Changes");
- }
- //method to set ETA of a bug
- public void setETA(IYodRobot pRobot, String rcaIAE) throws ParseException{
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(date);
- String etaDate = null;
- String triagedDay=simpleDateFormat.parse(triageDate).toString();
- YDataLogger.out("2^^^^^^^triagedDay::"+triagedDay);
- int days = 0;
- if(rcaIAE.contains("Information Only") || rcaIAE.contains("Feed Issue") || rcaIAE.contains("Site Temporary Issue") || rcaIAE.contains("MFA Quality")){
- days = 2;
- if(triagedDay.indexOf("Thu")>=0 || triagedDay.indexOf("Fri")>=0)
- {
- days+=2;
- }
- calendar.add(Calendar.DAY_OF_MONTH, days);
- Date eta = calendar.getTime();
- etaDate = simpleDateFormat.format(eta);
- }else if(rcaIAE.contains("New Variation") || rcaIAE.contains("Unhandled Condition") || rcaIAE.contains("Missing Acct") || rcaIAE.contains("Duplicate Acct")
- || rcaIAE.contains("Incorrect Acct Details") || rcaIAE.contains("Duplicate Transaction") || rcaIAE.contains("Incorrect Transaction Details") || rcaIAE.contains("Duplicate Acct")
- || rcaIAE.contains("Missing Transaction") || rcaIAE.contains("Site Change") || rcaIAE.contains("Site temporary message handling")
- || rcaIAE.contains("Quality Other")){
- days = 3;
- if(triagedDay.indexOf("Wed")>=0 || triagedDay.indexOf("Thu")>=0 || triagedDay.indexOf("Fri")>=0)
- {
- days+=2;
- }
- calendar.add(Calendar.DAY_OF_MONTH, days);
- Date eta = calendar.getTime();
- etaDate = simpleDateFormat.format(eta);
- }else{
- return;
- }
- YDataLogger.out("2^^^^triageDate : "+triageDate+" ^^^etaDate : "+etaDate);
- IHTMLElement elem=HTMLUtils.getElementWithAttribute(pRobot,ScriptConstants.INPUT_TAG,ScriptConstants.NAME_ATB,"status_whiteboard", false);
- IHTMLInputElement inputEle=JavaComBridgeHelper.toIHTMLInputElement(elem);
- String input = inputEle.getValue();
- if(!ScriptUtil.isNullValue(input)){
- input = input.trim()+",";
- }
- inputEle.setValue(input + "Triaged – "+triageDate+" ,ETA : "+etaDate);
- }
- private static String getDate() {
- GregorianCalendar c = new GregorianCalendar();
- String month = String.valueOf(c.get(GregorianCalendar.MONTH) + 1);
- String day = String.valueOf(c.get(GregorianCalendar.DATE));
- String year = String.valueOf(c.get(GregorianCalendar.YEAR));
- String returnVal = day + "-" + month + "-" + year;
- return returnVal;
- }
- private static HSSFCellStyle getStyle(HSSFCellStyle styleHeader2) {
- styleHeader = wb.createCellStyle();
- HSSFFont font = wb.createFont();
- font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
- font.setColor(HSSFColor.WHITE.index);
- styleHeader.setFont(font);
- styleHeader.setFillForegroundColor(HSSFColor.BLUE.index);
- styleHeader.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
- return styleHeader;
- }
- private static HSSFCellStyle getStyle_row(HSSFCellStyle styleHeader) {
- styleHeader = wb.createCellStyle();
- HSSFFont font = wb.createFont();
- styleHeader.setFillForegroundColor(HSSFColor.BLUE.index);
- styleHeader.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
- return styleHeader;
- }
- private static HSSFCellStyle getStyle_formula(HSSFCellStyle styleHeader) {
- styleHeader = wb.createCellStyle();
- HSSFFont font = wb.createFont();
- font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
- font.setColor(HSSFColor.BLACK.index);
- styleHeader.setFont(font);
- styleHeader.setFillForegroundColor(HSSFColor.YELLOW.index);
- styleHeader.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
- styleHeader.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
- return styleHeader;
- }
- protected void getNonWealthBugList(IYodRobot pRobot) throws Exception{
- YDataLogger.out("2^^^^date : "+triageDate);
- Enumeration tableEnum = pRobot.getInnermostTablesContainingText("ID", false, -1);
- while(tableEnum.hasMoreElements()){
- IHTMLElement tableElement = JavaComBridgeHelper.toIHTMLElement(tableEnum.nextElement());
- //YDataLogger.out("2^^^innertext11 : "+tableElement.getInnerText());
- String[][] columnHeaders = new String[][] {{"ID"},{"Whiteboard"},{"Summary"},{"Workflow Status"},{"RCA IAE"}};
- String [] valueHeaders = new String[]{"ID", "Whiteboard","Summary", "Workflow Status", "RCA IAE"};
- int [] valueHeaderCellType = new int [] {HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT};
- List<HashMap<String, String>> list = HTMLUtils.getTableData(pRobot,tableElement,"ID",columnHeaders,null,new boolean[]{false,false,false,false,false},1,0, valueHeaderCellType, valueHeaders);
- for(HashMap<String,String> prop :list){
- String bugID =prop.get("ID");
- String rcaIAE =prop.get("RCA IAE");
- String workFlowStatus = prop.get("Workflow Status");
- String whiteBoard = prop.get("Whiteboard");
- Bug bug = new Bug();
- /*
- * Those bugs which contains "reopened eta" is reopen bug triaged by the team on the current date
- * For revised ETA we have to update the old Triaged Date with New Triaged Date
- * */
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("reopened eta") && (whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- || whiteBoard.toLowerCase().contains("triaged:"+triageDate))){
- YDataLogger.out("inside it");
- bug.setBugid(bugID);
- reopenedETABugListNW.add(bug);
- continue;
- }
- /*
- * Those bugs which contains "revised eta" is revised eta bug triaged by the team on the current date
- * For revised ETA we have to update the old Triaged Date with New Triaged Date
- * */
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("revised") && (whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- || whiteBoard.toLowerCase().contains("triaged:"+triageDate))){
- YDataLogger.out("inside it");
- bug.setBugid(bugID);
- revisedETABugListNW.add(bug);
- continue;
- }
- YDataLogger.out("2^^^^^^^^bugID::"+bugID+" ^^^^rcaIAE : " +rcaIAE +" ^^workFlowStatus : "+ workFlowStatus+" ^^^whiteBoard : "+whiteBoard);
- //Those bugs which contains "triaged - currentdate" is freshed bug triaged by the team on the current date
- if(ScriptUtil.isNullValue(whiteBoard) || (!ScriptUtil.isNullValue(whiteBoard) && !whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- && !whiteBoard.toLowerCase().contains("triaged : "+triageDate) && !whiteBoard.toLowerCase().contains("triaged û "+triageDate))){
- YDataLogger.out("inside it continue");
- continue;
- }
- //YDataLogger.out("2^^^^YIDomesticID : "+bugID);
- bug.setBugid(bugID);
- freshBugListNW.add(bug);
- }
- }
- }
- protected void getI18NFIBugList(IYodRobot pRobot) throws Exception{
- YDataLogger.out("2^^^^date : "+triageDate);
- Enumeration tableEnum = pRobot.getInnermostTablesContainingText("ID", false, -1);
- while(tableEnum.hasMoreElements()){
- IHTMLElement tableElement = JavaComBridgeHelper.toIHTMLElement(tableEnum.nextElement());
- //YDataLogger.out("2^^^innertext11 : "+tableElement.getInnerText());
- String[][] columnHeaders = new String[][] {{"ID"},{"Whiteboard"},{"Summary"},{"Workflow Status"},{"RCA IAE"}};
- String [] valueHeaders = new String[]{"ID", "Whiteboard","Summary", "Workflow Status", "RCA IAE"};
- int [] valueHeaderCellType = new int [] {HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT,HTMLUtils.TABLE_CELL_TEXT};
- List<HashMap<String, String>> list = HTMLUtils.getTableData(pRobot,tableElement,"ID",columnHeaders,null,new boolean[]{false,false,false,false,false},1,0, valueHeaderCellType, valueHeaders);
- for(HashMap<String,String> prop :list){
- String bugID =prop.get("ID");
- String rcaIAE =prop.get("RCA IAE");
- String workFlowStatus = prop.get("Workflow Status");
- String whiteBoard = prop.get("Whiteboard");
- Bug bug = new Bug();
- /*
- * Those bugs which contains "reopened eta" is reopen bug triaged by the team on the current date
- * For revised ETA we have to update the old Triaged Date with New Triaged Date
- * */
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("reopened eta") && (whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- || whiteBoard.toLowerCase().contains("triaged:"+triageDate))){
- YDataLogger.out("inside it");
- bug.setBugid(bugID);
- reopenedETABugListFI.add(bug);
- continue;
- }
- /*
- * Those bugs which contains "revised eta" is revised eta bug triaged by the team on the current date
- * For revised ETA we have to update the old Triaged Date with New Triaged Date
- * */
- if(!ScriptUtil.isNullValue(whiteBoard) && whiteBoard.toLowerCase().contains("revised") && (whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- || whiteBoard.toLowerCase().contains("triaged:"+triageDate))){
- YDataLogger.out("inside it");
- bug.setBugid(bugID);
- revisedETABugListFI.add(bug);
- continue;
- }
- YDataLogger.out("2^^^^^^^^bugID::"+bugID+" ^^^^rcaIAE : " +rcaIAE +" ^^workFlowStatus : "+ workFlowStatus+" ^^^whiteBoard : "+whiteBoard);
- //Those bugs which contains "triaged - currentdate" is freshed bug triaged by the team on the current date
- if(ScriptUtil.isNullValue(whiteBoard) || (!ScriptUtil.isNullValue(whiteBoard) && !whiteBoard.toLowerCase().contains("triaged – "+triageDate)
- && !whiteBoard.toLowerCase().contains("triaged : "+triageDate) && !whiteBoard.toLowerCase().contains("triaged û "+triageDate))){
- YDataLogger.out("inside it continue");
- continue;
- }
- //YDataLogger.out("2^^^^YIDomesticID : "+bugID);
- bug.setBugid(bugID);
- freshBugListFI.add(bug);
- }
- }
- }
- @Override
- public int execute(RequestItem item, ClassArgs arg1, IYodRobot pRobot) throws Exception {
- Site site = new Site("TestDD");
- this.getBugsList(pRobot);
- YDataLogger.out("2^^freshBugList size() : "+freshBugList.size());
- return RequestItem.RETURN_CODE_SUCCESS;
- }
- private void createConsolidatedList( HSSFSheet sheetname, String teamName, int rowid, String date){
- List<Bug> tempFreshBugList = new ArrayList<Bug>();
- List<Bug> tempRevisedETABugList = new ArrayList<Bug>();
- List<Bug> tempReopenedETABugList = new ArrayList<Bug>();
- if(teamName.equals("YI")){
- YDataLogger.out("2^^^^inside it");
- tempFreshBugList = freshBugList;
- tempRevisedETABugList = revisedETABugList;
- tempReopenedETABugList = reopenedETABugList;
- }else if(teamName.equals("FI")){
- YDataLogger.out("2^^^^inside it else");
- tempFreshBugList = freshBugListFI;
- tempRevisedETABugList = revisedETABugListFI;
- tempReopenedETABugList = reopenedETABugListFI;
- }else if(teamName.equals("NW")){
- YDataLogger.out("2^^^^inside it else if1");
- tempFreshBugList = freshBugListNW;
- tempRevisedETABugList = revisedETABugListNW;
- tempReopenedETABugList = reopenedETABugListNW;
- }else if(teamName.equals("NDD")){
- YDataLogger.out("2^^^^inside it else if2");
- tempFreshBugList = freshBugListNDD;
- tempRevisedETABugList = revisedETABugListNDD;
- tempReopenedETABugList = reopenedETABugListNDD;
- }else if(teamName.equals("WEALTH")){
- YDataLogger.out("2^^^^inside it else if3");
- tempFreshBugList = freshBugListWL;
- tempRevisedETABugList = revisedETABugListWL;
- tempReopenedETABugList = reopenedETABugListWL;
- }
- HSSFRow rownum = sheetname.createRow((short) (rowid+1));
- rownum.createCell((short) 0).setCellValue(new HSSFRichTextString(date));
- rownum.createCell((short) 1).setCellValue(new Integer((tempFreshBugList.size()+tempReopenedETABugList.size())));
- rownum.createCell((short) 2).setCellValue(new Integer(tempFreshBugList.size()));
- rownum.createCell((short) 3).setCellValue(new Integer(tempRevisedETABugList.size()));
- rownum.createCell((short) 4).setCellValue(new Integer(tempReopenedETABugList.size()));
- YDataLogger.out("2^^^total : "+(tempFreshBugList.size()+tempReopenedETABugList.size())+" ^^^"+tempRevisedETABugList.size());
- }
- private void createBugList( HSSFSheet sheetname, boolean flag, String teamName){
- List<Bug> tempFreshBugList = new ArrayList<Bug>();
- List<Bug> tempRevisedETABugList = new ArrayList<Bug>();
- List<Bug> tempReopenedETABugList = new ArrayList<Bug>();
- if(teamName.equals("YI")){
- YDataLogger.out("2^^^^inside it");
- tempFreshBugList = freshBugList;
- tempRevisedETABugList = revisedETABugList;
- tempReopenedETABugList = reopenedETABugList;
- }else if(teamName.equals("FI")){
- YDataLogger.out("2^^^^inside it else");
- tempFreshBugList = freshBugListFI;
- tempRevisedETABugList = revisedETABugListFI;
- tempReopenedETABugList = reopenedETABugListFI;
- }else if(teamName.equals("NW")){
- YDataLogger.out("2^^^^inside it else if1");
- tempFreshBugList = freshBugListNW;
- tempRevisedETABugList = revisedETABugListNW;
- tempReopenedETABugList = reopenedETABugListNW;
- }else if(teamName.equals("NDD")){
- YDataLogger.out("2^^^^inside it else if2");
- tempFreshBugList = freshBugListNDD;
- tempRevisedETABugList = revisedETABugListNDD;
- tempReopenedETABugList = reopenedETABugListNDD;
- }else if(teamName.equals("WEALTH")){
- YDataLogger.out("2^^^^inside it else if3");
- tempFreshBugList = freshBugListWL;
- tempRevisedETABugList = revisedETABugListWL;
- tempReopenedETABugList = reopenedETABugListWL;
- }
- rownumber = 0;
- for(Bug bug :tempFreshBugList){
- String bug_id = bug.getBugid();
- if(rownumber == 0){
- rownumber++;
- }
- HSSFRow rownum = sheetname.createRow((short) rownumber);
- rownum.createCell((short) 0).setCellValue(new HSSFRichTextString(bug_id));
- rownumber++;
- flag = false;
- }
- //code to set revised ETA bug
- rownumber = 0;
- YDataLogger.out("2^^^revisedETABugList : "+revisedETABugList.size());
- for(Bug bug :tempRevisedETABugList){
- String bug_id = bug.getBugid();
- if(rownumber == 0){
- rownumber++;
- }
- HSSFRow rownum = sheetname.createRow((short) rownumber);
- rownum.createCell((short) 1).setCellValue(new HSSFRichTextString(bug_id));
- rownumber++;
- flag = false;
- }
- //code to add reopened bug
- rownumber = 0;
- YDataLogger.out("2^^^reopenedETABugList : "+reopenedETABugList.size());
- for(Bug bug :tempReopenedETABugList){
- String bug_id = bug.getBugid();
- if(rownumber == 0){
- rownumber++;
- }
- HSSFRow rownum = sheetname.createRow((short) rownumber);
- rownum.createCell((short) 2).setCellValue(new HSSFRichTextString(bug_id));
- rownumber++;
- flag = false;
- }
- }
- private void createCellHeaderConsolidate(HSSFSheet sheetname, HSSFRow row){
- HSSFCell Date_header = row.createCell((short) 0);
- HSSFCell Count_Incoming_bugs_header = row.createCell((short) 1);
- HSSFCell Count_Fresh_bug_Traiged_header = row.createCell((short) 2);
- HSSFCell Count_Revised_ETA_Bugs_Header = row.createCell((short) 3);
- HSSFCell Count_Reopen_bug_Traiged_Header = row.createCell((short) 4);
- Date_header.setCellValue(new HSSFRichTextString("Date"));
- Count_Incoming_bugs_header.setCellValue(new HSSFRichTextString("Incoming_bugs"));
- Count_Fresh_bug_Traiged_header.setCellValue(new HSSFRichTextString("Fresh_bug_Traiged"));
- Count_Revised_ETA_Bugs_Header.setCellValue(new HSSFRichTextString("Revised_ETA_Bugs"));
- Count_Reopen_bug_Traiged_Header.setCellValue(new HSSFRichTextString("Reopen_bug_Traiged"));
- Date_header.setCellStyle(styleHeader);
- Count_Incoming_bugs_header.setCellStyle(styleHeader);
- Count_Fresh_bug_Traiged_header.setCellStyle(styleHeader);
- Count_Revised_ETA_Bugs_Header.setCellStyle(styleHeader);
- Count_Reopen_bug_Traiged_Header.setCellStyle(styleHeader);
- }
- private void createCellHeader(HSSFSheet sheetname, HSSFRow row){
- int lastRowNumber = sheetname.getLastRowNum();
- for(int i=1; i<=lastRowNumber; i++){
- try{
- sheetname.removeRow(sheetname.getRow(i));
- }catch(NullPointerException e){
- e.printStackTrace();
- }
- }
- HSSFCell Fresh_bugs_header = row.createCell((short) 0);
- HSSFCell Revised_ETA_Bugs_header = row.createCell((short) 1);
- HSSFCell Reopen_bug_Traiged_header = row.createCell((short) 2);
- HSSFCell Non_Traige_Closed_Bugs_Header = row.createCell((short) 3);
- Fresh_bugs_header.setCellValue(new HSSFRichTextString("Fresh_bugs"));
- Revised_ETA_Bugs_header.setCellValue(new HSSFRichTextString("Revised_ETA_Bugs"));
- Reopen_bug_Traiged_header.setCellValue(new HSSFRichTextString("Reopen_bug_Traiged"));
- Non_Traige_Closed_Bugs_Header.setCellValue(new HSSFRichTextString("Non_Traige_Closed_Bugs"));
- Fresh_bugs_header.setCellStyle(styleHeader);
- Revised_ETA_Bugs_header.setCellStyle(styleHeader);
- Reopen_bug_Traiged_header.setCellStyle(styleHeader);
- Non_Traige_Closed_Bugs_Header.setCellStyle(styleHeader);
- }
- private void sendMail(String attacmentLocation,String fileNm) throws Exception {
- Properties props = new Properties();
- //props.put("mail.smtp.host","192.168.234.200");
- props.put("mail.smtp.host","192.168.211.175");
- Session session = Session.getInstance(props, null);
- String from = "ckalita@yodlee.com";
- Vector<String> aliasHolder = new Vector<String>();
- aliasHolder.add("ckalita@yodlee.com");
- aliasHolder.add("nkumar4@yodlee.com");
- aliasHolder.add("akumar7@yodlee.com");
- aliasHolder.add("ggupta@yodlee.com");
- aliasHolder.add("ptiwari@yodlee.com");
- aliasHolder.add("kshubham@yodlee.com");
- aliasHolder.add("dsingh1@yodlee.com");
- aliasHolder.add("bsingh1@yodlee.com");
- aliasHolder.add("rraghuva@yodlee.com");
- aliasHolder.add("kshubham@yodlee.com");
- aliasHolder.add("VMuddana@yodlee.com");
- aliasHolder.add("VMarisetti@yodlee.com");
- aliasHolder.add("malam@yodlee.com");
- Vector<String> aliasHolderCC = new Vector<String>();
- aliasHolderCC.add("ckalita@yodlee.com");
- InternetAddress fromAddress = null;
- MimeMessage msg = new MimeMessage(session);
- for (int i = 0; i < aliasHolder.size(); i++) {
- System.out.println("2^^^^^^^aliasHolder:"+aliasHolder.elementAt(i));
- String add = aliasHolder.get(i);
- InternetAddress to = new InternetAddress(add);
- msg.addRecipient(Message.RecipientType.TO, to);
- }
- for (int i = 0; i < aliasHolderCC.size(); i++) {
- System.out.println("2^^^^^^^aliasHolderCC:"+aliasHolderCC.elementAt(i));
- String add = aliasHolderCC.get(i);
- InternetAddress cc = new InternetAddress(add);
- msg.addRecipient(Message.RecipientType.CC, cc);
- }
- try {
- msg.setFrom();
- fromAddress = new InternetAddress(from);
- msg.setFrom(fromAddress);
- //msg.addRecipient(Message.RecipientType.CC, to);
- msg.setSubject("Bug Triaging Report_"+ sdf.format(date));
- msg.setSentDate(new Date());
- msg.setText("Attachment");
- /*
- * ************************Test for
- * attachment*************************
- */
- String fileAttachment = attacmentLocation;
- // create the message part
- MimeBodyPart messageBodyPart = new MimeBodyPart();
- MimeBodyPart attachmentBodyPart = new MimeBodyPart();
- String tableBodytext = "";
- String bodytext = "Hi Team,<br>";
- bodytext = bodytext +"<br>";
- bodytext = bodytext
- + "Bugs triaged for today. Please check and update the ETA as applicable. PFA of bugs for the same (Consolidated list)."
- + date + ".";
- bodytext = bodytext +"<br>"+"<br>";
- /*bodytext = bodytext + "<h3>"+"YI Domestic and YI-I18N : "+"</h3>";
- bodytext = bodytext + "<html><head><meta content=\"text/html; charset=ISO-8859-1\"http-equiv=\"content-type\"><title></title></head><body>";
- bodytext = bodytext + "<table style=\"width: 100px; height: 60px; text-align: left; margin-left: auto; margin-right: auto;\"border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
- bodytext = bodytext + "<tbody><tr>";
- bodytext = bodytext + "<td>Date</td>";
- bodytext = bodytext + "<td>Incoming_bugs</td>";
- bodytext = bodytext + "<td>Fresh_bug_Traiged</td>";
- bodytext = bodytext + "<td style=\"text-align: center;\">Revised_ETA_Bugs</td>";
- bodytext = bodytext + "<td>Reopen_bug_Traiged</td>";
- bodytext = bodytext + "</tr>";
- bodytext = bodytext + "<tr>";
- bodytext = bodytext + "<td>"+sdf.format(date)+"</td>";
- bodytext = bodytext + "<td>"+(freshBugList.size()+reopenedETABugList.size())+"</td>";
- bodytext = bodytext + "<td>"+freshBugList.size()+"</td>";
- bodytext = bodytext + "<td>"+revisedETABugList.size()+"</td>";
- bodytext = bodytext + "<td>"+reopenedETABugList.size()+"</td>";
- bodytext = bodytext + "</tr></tbody></table><br></body></html>";
- bodytext = bodytext + "<h3>"+"FI-I18N : "+"</h3>";
- bodytext = bodytext + "<html><head><meta content=\"text/html; charset=ISO-8859-1\"http-equiv=\"content-type\"><title></title></head><body>";
- bodytext = bodytext + "<table style=\"width: 100px; height: 60px; text-align: left; margin-left: auto; margin-right: auto;\"border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
- bodytext = bodytext + "<tbody><tr>";
- bodytext = bodytext + "<td>Date</td>";
- bodytext = bodytext + "<td>Incoming_bugs</td>";
- bodytext = bodytext + "<td>Fresh_bug_Traiged</td>";
- bodytext = bodytext + "<td style=\"text-align: center;\">Revised_ETA_Bugs</td>";
- bodytext = bodytext + "<td>Reopen_bug_Traiged</td>";
- bodytext = bodytext + "</tr>";
- bodytext = bodytext + "<tr>";
- bodytext = bodytext + "<td>"+sdf.format(date)+"</td>";
- bodytext = bodytext + "<td>"+(freshBugListFI.size()+reopenedETABugListFI.size())+"</td>";
- bodytext = bodytext + "<td>"+freshBugListFI.size()+"</td>";
- bodytext = bodytext + "<td>"+revisedETABugListFI.size()+"</td>";
- bodytext = bodytext + "<td>"+reopenedETABugListFI.size()+"</td>";
- bodytext = bodytext + "</tr></tbody></table><br></body></html>";
- bodytext = bodytext + "<h3>"+"FI DDT : "+"</h3>";
- bodytext = bodytext + "<html><head><meta content=\"text/html; charset=ISO-8859-1\"http-equiv=\"content-type\"><title></title></head><body>";
- bodytext = bodytext + "<table style=\"width: 100px; height: 60px; text-align: left; margin-left: auto; margin-right: auto;\"border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
- bodytext = bodytext + "<tbody><tr>";
- bodytext = bodytext + "<td>Date</td>";
- bodytext = bodytext + "<td>Incoming_bugs</td>";
- bodytext = bodytext + "<td>Fresh_bug_Traiged</td>";
- bodytext = bodytext + "<td style=\"text-align: center;\">Revised_ETA_Bugs</td>";
- bodytext = bodytext + "<td>Reopen_bug_Traiged</td>";
- bodytext = bodytext + "</tr>";
- bodytext = bodytext + "<tr>";
- bodytext = bodytext + "<td>"+sdf.format(date)+"</td>";
- bodytext = bodytext + "<td>"+(freshBugListNW.size()+reopenedETABugListNW.size())+"</td>";
- bodytext = bodytext + "<td>"+freshBugListNW.size()+"</td>";
- bodytext = bodytext + "<td>"+revisedETABugListNW.size()+"</td>";
- bodytext = bodytext + "<td>"+reopenedETABugListNW.size()+"</td>";
- bodytext = bodytext + "</tr></tbody></table><br></body></html>";
- */
- tableBodytext = tableBodytext + this.createTable("YI Domestic and YI-I18N :");
- tableBodytext = tableBodytext + this.createTable("FI-I18N :");
- tableBodytext = tableBodytext + this.createTable("FI DDT :");
- tableBodytext = tableBodytext + this.createTable("WEALTH :");
- tableBodytext = tableBodytext + this.createTable("NDD :");
- bodytext = bodytext + tableBodytext;
- bodytext = bodytext +"<br>"+"<br>";
- bodytext = bodytext +"Thanks & Regards"+"<br>"+"Chandan";
- messageBodyPart.setContent(bodytext , "text/html");
- // Part two is attachment
- DataSource source = new FileDataSource(fileNm);
- attachmentBodyPart.setDataHandler(new DataHandler(source));
- attachmentBodyPart.setFileName(attachedFileName);
- // Put parts in message
- Multipart multipart = new MimeMultipart();
- multipart.addBodyPart(messageBodyPart);
- multipart.addBodyPart(attachmentBodyPart);
- msg.setContent(multipart);
- /* ******************************************************************** */
- Transport.send(msg);
- System.out.println("2^^^^^^^fileAttachment "+fileNm);
- //System.out.println("2^^^^^^^bodytext "+bodytext);
- } catch (MessagingException mex) {
- System.out.println("2^^^^^^^^^^^^^^^^^^^send failed, exception: "+ mex);
- }
- }
- //}
- protected String createTable(String teamName){
- List<Bug> tempFreshBugList = new ArrayList<Bug>();
- List<Bug> tempRevisedETABugList = new ArrayList<Bug>();
- List<Bug> tempReopenedETABugList = new ArrayList<Bug>();
- if(teamName.equals("YI Domestic and YI-I18N :")){
- YDataLogger.out("2^^^^inside it");
- tempFreshBugList = freshBugList;
- tempRevisedETABugList = revisedETABugList;
- tempReopenedETABugList = reopenedETABugList;
- }else if(teamName.equals("FI-I18N :")){
- YDataLogger.out("2^^^^inside it else");
- tempFreshBugList = freshBugListFI;
- tempRevisedETABugList = revisedETABugListFI;
- tempReopenedETABugList = reopenedETABugListFI;
- }else if(teamName.equals("FI DDT :")){
- YDataLogger.out("2^^^^inside it else if2");
- tempFreshBugList = freshBugListNW;
- tempRevisedETABugList = revisedETABugListNW;
- tempReopenedETABugList = reopenedETABugListNW;
- }else if(teamName.equals("NDD :")){
- YDataLogger.out("2^^^^inside it else if2");
- tempFreshBugList = freshBugListNDD;
- tempRevisedETABugList = revisedETABugListNDD;
- tempReopenedETABugList = reopenedETABugListNDD;
- }else if(teamName.equals("WEALTH :")){
- YDataLogger.out("2^^^^inside it else if2");
- tempFreshBugList = freshBugListWL;
- tempRevisedETABugList = revisedETABugListWL;
- tempReopenedETABugList = reopenedETABugListWL;
- }
- String bodytext = "";
- bodytext = bodytext + "<h3>"+teamName+"</h3>";
- bodytext = bodytext + "<html><head><meta content=\"text/html; charset=ISO-8859-1\"http-equiv=\"content-type\"><title></title></head><body>";
- bodytext = bodytext + "<table style=\"width: 100px; height: 60px; text-align: left; margin-left: auto; margin-right: auto;\"border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
- bodytext = bodytext + "<tbody><tr>";
- bodytext = bodytext + "<td>Date</td>";
- bodytext = bodytext + "<td>Incoming_bugs</td>";
- bodytext = bodytext + "<td>Fresh_bug_Traiged</td>";
- bodytext = bodytext + "<td style=\"text-align: center;\">Revised_ETA_Bugs</td>";
- bodytext = bodytext + "<td>Reopen_bug_Traiged</td>";
- bodytext = bodytext + "</tr>";
- bodytext = bodytext + "<tr>";
- bodytext = bodytext + "<td>"+sdf.format(date)+"</td>";
- bodytext = bodytext + "<td>"+(tempFreshBugList.size()+tempReopenedETABugList.size())+"</td>";
- bodytext = bodytext + "<td>"+tempFreshBugList.size()+"</td>";
- bodytext = bodytext + "<td>"+tempRevisedETABugList.size()+"</td>";
- bodytext = bodytext + "<td>"+tempReopenedETABugList.size()+"</td>";
- bodytext = bodytext + "</tr></tbody></table><br></body></html>";
- return bodytext;
- }
- @Override
- public int logout(IYodRobot pRobot) {
- return 0;//LogoutUtil.logout(pRobot);
- }
- @Override
- public double getSupportedVersion() {
- return 5.0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement