Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/PCMaintenanceLog.java'
- [ERROR] com.gwtproject.pcmaintenancelog.client.gui.HomePage cannot be resolved to a type
- [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/gui/HomePage.java'
- [ERROR] com.gwtproject.pcmaintenancelog.client.service.CustomServiceCientImplementation cannot be resolved to a type
- [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/service/CustomServiceCientImplementation.java'
- [ERROR] com.gwtproject.pcmaintenancelog.client.gui.MaintenanceLogUI cannot be resolved to a type
- [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/gui/MaintenanceLogUI.java'
- [ERROR] Line 76: Cannot refer to the non-final local variable serviceImp defined in an enclosing scope
- [ERROR] Errors in 'file:/D:/Projects/Workspace/PC%20Maintenance/PCMaintenanceLog/src/com/gwtproject/pcmaintenancelog/client/gui/GreetingPageUI.java'
- [ERROR] com.gwtproject.pcmaintenancelog.client.service.CustomServiceCientImplementation cannot be resolved to a type
- public class ExportMaintenanceLogReport {
- ExportMaintenanceLogReport(){
- final DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss");
- Date date = new Date();
- ResultSet rs=null;
- try {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- Connection con=DriverManager.getConnection(
- "jdbc:oracle:thin:@localhost:1521:xe","system","root");
- Statement stmt=con.createStatement();
- rs=stmt.executeQuery(" Select * from PC_MAINTENANCE_LOG ");
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- XSSFWorkbook workbook = new XSSFWorkbook();
- XSSFSheet sheet = workbook.createSheet("Log Data");
- Map<String, Object[]> data = new TreeMap<String, Object[]>();
- data.put("1", new Object[] {"S.No.","ASSIGNED_TO", "LOGID", "DEPARTMENT_NAME","PHONE","ITEM","PROBLEM"
- ,"ACTION","RECEIVED_DATE","DISPATCHED_DATE"});
- try {
- int i=2,j=1;
- while(rs.next()){
- String key= Integer.toString(i++);
- data.put(key,new Object[] {j++,rs.getString("ASSIGNED_TO")
- , rs.getString("LOGID"), rs.getString("DEPARTMENT_NAME"),rs.getString("PHONE")
- ,rs.getString("ITEM"),rs.getString("PROBLEM"),rs.getString("ACTION"),
- rs.getString("RECEIVED_DATE"),rs.getString("DISPATCHED_DATE")});
- }
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- Set<String> keyset = data.keySet();
- int rownum = 0;
- for (String key : keyset)
- {
- Row row = sheet.createRow(rownum++);
- Object [] objArr = data.get(key);
- int cellnum = 0;
- for (Object obj : objArr)
- {
- Cell cell = row.createCell(cellnum++);
- if(obj instanceof String)
- cell.setCellValue((String)obj);
- else if(obj instanceof Integer)
- cell.setCellValue((Integer)obj);
- }
- }
- try
- {
- String filename= "LogData_"+sdf.format(date)+".xlsx";
- //Write the workbook in file system
- FileOutputStream out = new FileOutputStream(new File(filename));
- workbook.write(out);
- out.close();
- }catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement