Package org.netbeans.modules.exceptions.entity

Examples of org.netbeans.modules.exceptions.entity.Report


                try {
                    Submit thisSubmit = em.find(submit.getClass(), id);
                    if (thisSubmit == null) {
                        throw new IllegalStateException("Submit id " + id + " was not found");
                    }
                    Report report = thisSubmit.getReportId();
                    if (report.isInIssuezilla()){
                        // stop insertion
                        return TransactionResult.ROLLBACK;
                    }
                    int bugId = delegate.reportSubmit(thisSubmit.getSubmit(em), password, extraComment, extraCC);
                    report.setIssueId(bugId, BugzillaReporter.class);
                    report = em.merge(report);
                    return TransactionResult.COMMIT;
                } catch (Exception e) {
                    String message = "Bug was not created for report #" + id;
                    BugReporter.LOG.log(Level.SEVERE, message, e);
View Full Code Here


            id = new Integer(idParam);
        } catch (NumberFormatException e) {
            request.setAttribute("error", "Issue id is not set correctly - you have probably used wrong link");
            return mapping.findForward(ERROR);
        }
        Report report = getEntityManager(request).find(Report.class, id);
        if (report == null){
            Logger.getLogger(ShowDuplicatesList.class.getName()).log(Level.WARNING, "report with id = " + id + " was not found");
            request.setAttribute("error", "Report was not found - you have probably used wrong link");
            return mapping.findForward(ERROR);
        }
        report.preloadSubmitCollection(getEntityManager(request));
        List<Submit> result = report.getSubmitCollection();
        request.setAttribute("exceptions", result);
        return mapping.findForward(RESULT );
    }
View Full Code Here

            throws Exception {

        EntityManager em = getEntityManager(request);
        int id = getInteger(request, "id", -1);
        assert (id != -1) : "Id was not set";
        Report report = em.find(Report.class, id);
        if (report == null) {
            //workaround for old links from issuezilla
            if (id < 146000) {
                Exceptions exc = em.find(Exceptions.class, id);
                if (exc == null) {
                    LOG.log(Level.SEVERE, "Unable to find Exceptions.id = " + id);
                    request.setAttribute("error", "Exception #" + id + "doesn't exist");
                    return mapping.findForward(ERROR);
                }
                report = exc.getReportId();
            } else {
                Logger.getLogger(ReportDetailAction.class.getName()).warning("Cannot find report instance with id " + id);
                response.setHeader("Refresh", "30"); // refresh the page in 30s
                return mapping.findForward(PLEASE_WAIT);
            }
        }
        if (report == null) {
            request.setAttribute("error", "Report #" + id + " doesn't exist");
            return mapping.findForward(ERROR);
        }
        report.preloadSubmitCollection(em);
        request.setAttribute("report", report);

        request.setAttribute("jdks", report.getJDKS(em));
        request.setAttribute("oss", report.getOSes(em));
        request.setAttribute("versions", report.getVersions(em));
        request.setAttribute("components", PersistenceUtils.getInstance().getComponents().getComponentsSet());

        String comment = request.getParameter("comment");
        if ((comment != null) && (comment.length() > 0)) {
            if (checkPrivileges(request)) {
View Full Code Here

        handler.flush();

        int issuezillaId = 10;
        org.netbeans.modules.exceptions.entity.Exceptions exc =
                em.find(org.netbeans.modules.exceptions.entity.Exceptions.class, excData.getSubmitId());
        Report report = exc.getReportId();
        report.setIssueId(issuezillaId);
        em.merge(report);
        Issue issue = BugReporterFactory.getDefaultReporter().getIssue(issuezillaId);
        issue.setLastResolutionChange(new Date());

        String undirectUser = "tester";
View Full Code Here

        log.setProductVersionId(pv);
        TestLogFileTask task = new TestLogFileTask(em, log);
        Nbuser user = new Nbuser(1);
        user.setName("HALLO");
        org.netbeans.modules.exceptions.entity.Exceptions exc = new org.netbeans.modules.exceptions.entity.Exceptions(100);
        Report report = new Report(100);
        Stacktrace stacktrace = new Stacktrace(100);
        stacktrace.setLineCollection(Collections.<Line>emptyList());
        stacktrace.setClass1("NullPointerException");
        exc.setReportId(report);
        exc.setLogfileId(log);
        exc.setStacktrace(stacktrace);
        report.setComponent("user.dir");
        report.setSubcomponent("some.jar");
        exc.setNbuserId(user);
        em.persist(nbv);
        em.persist(pv);
        em.persist(report);
        em.persist(stacktrace);
View Full Code Here

        }
        if (method == null) {
            method = "";
        }
        EntityManager em = getEntityManager(request);
        Report r = em.getReference(Report.class, reportId);
        r.preloadSubmitCollection(em);
        List<Submit> all = r.getSubmitCollection();
        List<Submit> result;
        if (method.isEmpty()) {
            result = all;
        } else {
            result = new ArrayList<Submit>();
View Full Code Here

        } catch (RuntimeException re) {
            LOG.log(Level.WARNING, re.getMessage(), re);
            request.setAttribute("error", re.getMessage());
            return mapping.findForward(ERROR);
        }
        Report finalReport = redirected.iterator().next().getReportId();
        String finalReportId = finalReport.getId().toString();
        request.setAttribute("id", finalReportId);
        return mapping.findForward(SUCCESS);
    }
View Full Code Here

    List<Submit> splitDuplicates(final String[] issueNames) {
        final List<Submit> redirected = new ArrayList<Submit>();
        Utils.processPersistable(new Persistable.Transaction() {

            public TransactionResult runQuery(EntityManager em) {
                Report newReport = new Report(org.netbeans.server.uihandler.Utils.getNextId(Report.class));
                em.persist(newReport);
                redirected.addAll(markDuplicates(em, issueNames, newReport, true));
                return TransactionResult.COMMIT;
            }
        });
View Full Code Here

        final List<Submit> redirected = new ArrayList<Submit>();
        final Integer duplicateOfId = Integer.parseInt(duplicateOfStr);
        Utils.processPersistable(new Persistable.Transaction() {

            public TransactionResult runQuery(EntityManager em) {
                Report report = em.find(Report.class, duplicateOfId);
                if (report == null){
                    throw new RuntimeException("Report " + duplicateOfId + " doesn't exist.");
                }
                redirected.addAll(markDuplicates(em, issueNames, report, false));
                return TransactionResult.COMMIT;
View Full Code Here

            public TransactionResult runQuery(EntityManager em) throws Exception {
                BugzillaReporter reporter = BugReporterFactory.getDefaultReporter();
                List<Integer> issueIds = PersistenceUtils.executeQuery(em, QUERY, null);
                javax.persistence.Query reportQuery = em.createNamedQuery("Report.findByIssueId");
                for (Integer issueId : issueIds) {
                    Report rootReport = null;
                    reportQuery.setParameter("issueId", issueId);
                    Issue issue = reporter.getIssue(issueId);
                    List<Report> reports = reportQuery.getResultList();

                    //find report referenced from IZ
                    if (issue == null) {
                        SYNCHRONIZATION_LOGGER.log(Level.SEVERE, "Impossible to find issue #{0}", issueId.toString());
                        continue;
                    }
                    Integer reporterSubmitId = issue.getReporterSubmitId();
                    if (reporterSubmitId != null) {
                        for (Report report : reports) {
                            if (reporterSubmitId.equals(report.getId())) {
                                rootReport = report;
                                break;
                            }
                        }
                        if (rootReport == null) {
                            //workaround for old links from issuezilla
                            if (reporterSubmitId < 146000) {
                                Exceptions exc = em.getReference(Exceptions.class, reporterSubmitId);
                                if (exc != null) {
                                    rootReport = exc.getReportId();
                                } else {
                                    SYNCHRONIZATION_LOGGER.log(Level.SEVERE, "Impossible to find root report {0}", reporterSubmitId.toString());
                                    continue;
                                }
                            }
                        }
                    } else {
                        // the root report was not filled using exception reporter
                        rootReport = reports.iterator().next();
                    }
                    reports.remove(rootReport);

                    // move all exceptions to the referenced report
                    for (Report report : reports) {
                        SYNCHRONIZATION_LOGGER.log(Level.INFO, "merging report {0} to report {1}", new Object[]{report.getId().toString(), rootReport.getId().toString()});
                        report.preloadSubmitCollection(em);
                        for (Submit sub : report.getSubmitCollection()) {
                            sub.setReportId(rootReport);
                            em.merge(sub);
                        }
                        ReportComment rc = new ReportComment();
                        rc.generateId();
                        rc.setReportId(report);
                        String message = String.format(MARKED_AS_DUPLICATE, rootReport.getId());
                        rc.setComment(message);

                        rc.setNbuserId(getReporterUser(em));
                        em.persist(rc);
                    }
View Full Code Here

TOP

Related Classes of org.netbeans.modules.exceptions.entity.Report

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.