Package org.netbeans.server.uihandler.statistics.ExceptionReports

Examples of org.netbeans.server.uihandler.statistics.ExceptionReports.Data


            Utils.processPersistable(this);
        }
    }

    public TransactionResult runQuery(EntityManager em) {
        Data dat = new Data();
        Map<String, Integer> components = new TreeMap<String, Integer>();
        List<ReportItem> monthStatistics = new ArrayList<ReportItem>();
        List<ReportItem> reportDateStatistics = new ArrayList<ReportItem>();
        try {
            dat.reportsCount = PersistenceUtils.executeCount(em, "Exceptions.countAll", null);
            dat.slownessCount = PersistenceUtils.executeCount(em, "Slowness.countAll", null);
            components = reportsComponentsDivision(em, dat.reportsCount);
            Map<String, Object> map = new HashMap<String, Object>(3);
            Map<String, Object> dateMap = new HashMap<String, Object>(3);
            Calendar cald = Calendar.getInstance();
            if (BASE_DATE != null){
                cald.setTime(BASE_DATE);
            }
            long realYear = cald.get(Calendar.YEAR);
            long year = cald.get(Calendar.YEAR) % 100 - HISTORY_LENGHT;
            long month = cald.get(Calendar.MONTH);
            Long border = year * 100 + month % 12 + 1;
            Date dateBorder = new Date((int) (realYear - 1901 + month / 12), (int) (month % 12 + 1), 1);
            map.put(START, border * 100);
            dateMap.put( START,dateBorder);
            List<Nbversion> versions = PersistenceUtils.executeNamedQuery(em, "Nbversion.all", null, Nbversion.class);
            LOG.fine("versions count = " + versions.size());
            for (Nbversion nbversion : versions) {
                for (long i = month + 1; i <= month + 1 + HISTORY_LENGHT * 12; i++) {
                    int begin_border = border.intValue();
                    border = (year + i / 12) * 100 + i % 12 + 1;
                    dateBorder = new Date((int) (realYear - 1901 + i / 12), (int) (i % 12 + 1), 1);
                    dateMap.put("end", dateBorder);
                    dateMap.put("version", nbversion);
                    map.put("end", border * 100);
                    map.put("version", nbversion);
                    int count = PersistenceUtils.executeCount(em, "Exceptions.buildDateQuery", map);
                    if (count > MIN_COUNT) {
                        monthStatistics.add(new ReportItem(begin_border % 100, begin_border / 100, count, nbversion));
                    }
                    count = PersistenceUtils.executeCount(em, "Exceptions.reportDateQuery", dateMap);
                    if (count > MIN_COUNT) {
                        reportDateStatistics.add(new ReportItem(border.intValue() % 100, border.intValue() / 100 + 1, count, nbversion));
                    }
                    map.put(START, border * 100);
                    dateMap.put( START,dateBorder);
                }
            }

        } catch (Exception ex) {
            // requires database and that is not present
            System.out.println(ex);
            ex.printStackTrace();
            LOG.log(Level.WARNING, ex.getMessage(), ex);
        }
        dat.setComponents(components);
        dat.setMonthStatistics(monthStatistics);
        dat.setReportDateStatistics(reportDateStatistics);
        globalData = dat;
        return TransactionResult.NONE;
    }
View Full Code Here

TOP

Related Classes of org.netbeans.server.uihandler.statistics.ExceptionReports.Data

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.