Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/PCMaintenanceLog.java'
  2. [ERROR] com.gwtproject.pcmaintenancelog.client.gui.HomePage cannot be resolved to a type
  3. [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/gui/HomePage.java'
  4. [ERROR] com.gwtproject.pcmaintenancelog.client.service.CustomServiceCientImplementation cannot be resolved to a type
  5. [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/service/CustomServiceCientImplementation.java'
  6. [ERROR] com.gwtproject.pcmaintenancelog.client.gui.MaintenanceLogUI cannot be resolved to a type
  7. [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/gui/MaintenanceLogUI.java'
  8. [ERROR] Line 76: Cannot refer to the non-final local variable serviceImp defined in an enclosing scope
  9. [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/gui/GreetingPageUI.java'
  10. [ERROR] com.gwtproject.pcmaintenancelog.client.service.CustomServiceCientImplementation cannot be resolved to a type
  11.  
  12. public class ExportMaintenanceLogReport {
  13. ExportMaintenanceLogReport(){
  14.  
  15. final DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss");
  16. Date date = new Date();
  17. ResultSet rs=null;
  18. try {
  19. Class.forName("oracle.jdbc.driver.OracleDriver");
  20. Connection con=DriverManager.getConnection(
  21. "jdbc:oracle:thin:@localhost:1521:xe","system","root");
  22. Statement stmt=con.createStatement();
  23. rs=stmt.executeQuery(" Select * from PC_MAINTENANCE_LOG ");
  24. } catch (ClassNotFoundException e) {
  25. // TODO Auto-generated catch block
  26. e.printStackTrace();
  27. } catch (SQLException e) {
  28. // TODO Auto-generated catch block
  29. e.printStackTrace();
  30. }
  31.  
  32. XSSFWorkbook workbook = new XSSFWorkbook();
  33. XSSFSheet sheet = workbook.createSheet("Log Data");
  34. Map<String, Object[]> data = new TreeMap<String, Object[]>();
  35. data.put("1", new Object[] {"S.No.","ASSIGNED_TO", "LOGID", "DEPARTMENT_NAME","PHONE","ITEM","PROBLEM"
  36. ,"ACTION","RECEIVED_DATE","DISPATCHED_DATE"});
  37. try {
  38. int i=2,j=1;
  39. while(rs.next()){
  40. String key= Integer.toString(i++);
  41. data.put(key,new Object[] {j++,rs.getString("ASSIGNED_TO")
  42. , rs.getString("LOGID"), rs.getString("DEPARTMENT_NAME"),rs.getString("PHONE")
  43. ,rs.getString("ITEM"),rs.getString("PROBLEM"),rs.getString("ACTION"),
  44. rs.getString("RECEIVED_DATE"),rs.getString("DISPATCHED_DATE")});
  45. }
  46. } catch (SQLException e) {
  47. // TODO Auto-generated catch block
  48. e.printStackTrace();
  49. }
  50.  
  51. Set<String> keyset = data.keySet();
  52. int rownum = 0;
  53. for (String key : keyset)
  54. {
  55. Row row = sheet.createRow(rownum++);
  56. Object [] objArr = data.get(key);
  57. int cellnum = 0;
  58. for (Object obj : objArr)
  59. {
  60. Cell cell = row.createCell(cellnum++);
  61. if(obj instanceof String)
  62. cell.setCellValue((String)obj);
  63. else if(obj instanceof Integer)
  64. cell.setCellValue((Integer)obj);
  65. }
  66. }
  67. try
  68. {
  69. String filename= "LogData_"+sdf.format(date)+".xlsx";
  70. //Write the workbook in file system
  71. FileOutputStream out = new FileOutputStream(new File(filename));
  72. workbook.write(out);
  73. out.close();
  74.  
  75. }catch (Exception ex) {
  76. ex.printStackTrace();
  77.  
  78. }
  79.  
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement