Package org.apache.syncope.core.persistence.beans

Examples of org.apache.syncope.core.persistence.beans.Report


    }

    @PreAuthorize("hasRole('REPORT_EXECUTE')")
    @RequestMapping(method = RequestMethod.POST, value = "/execute/{reportId}")
    public ReportExecTO execute(@PathVariable("reportId") final Long reportId) {
        Report report = reportDAO.find(reportId);
        if (report == null) {
            throw new NotFoundException("Report " + reportId);
        }

        ReportExecTO result;

        LOG.debug("Triggering new execution of report {}", report);

        try {
            jobInstanceLoader.registerJob(report);

            scheduler.getScheduler().triggerJob(
                    new JobKey(JobInstanceLoader.getJobName(report), Scheduler.DEFAULT_GROUP));

            auditManager.audit(Category.report, ReportSubCategory.execute, Result.success,
                    "Successfully started execution for report: " + report.getId());
        } catch (Exception e) {
            LOG.error("While executing report {}", report, e);

            auditManager.audit(Category.report, ReportSubCategory.execute, Result.failure,
                    "Could not start execution for report: " + report.getId(), e);

            SyncopeClientCompositeErrorException scce =
                    new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
            sce.addElement(e.getMessage());
View Full Code Here


    }

    @PreAuthorize("hasRole('REPORT_DELETE')")
    @RequestMapping(method = RequestMethod.GET, value = "/delete/{reportId}")
    public ReportTO delete(@PathVariable("reportId") final Long reportId) {
        Report report = reportDAO.find(reportId);
        if (report == null) {
            throw new NotFoundException("Report " + reportId);
        }

        ReportTO deletedReport = binder.getReportTO(report);

        jobInstanceLoader.unregisterJob(report);

        reportDAO.delete(report);

        auditManager.audit(Category.report, ReportSubCategory.delete, Result.success,
                "Successfully deleted report: " + report.getId());

        return deletedReport;
    }
View Full Code Here

    @PreAuthorize("hasRole('REPORT_CREATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/create")
    public ReportTO create(final HttpServletResponse response, @RequestBody final ReportTO reportTO) {
        LOG.debug("Creating report " + reportTO);

        Report report = new Report();
        binder.getReport(report, reportTO);
        report = reportDAO.save(report);

        try {
            jobInstanceLoader.registerJob(report);
        } catch (Exception e) {
            LOG.error("While registering quartz job for report " + report.getId(), e);

            SyncopeClientCompositeErrorException scce =
                    new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
            sce.addElement(e.getMessage());
            scce.addException(sce);
            throw scce;
        }

        auditManager.audit(Category.report, ReportSubCategory.create, Result.success,
                "Successfully created report: " + report.getId());

        response.setStatus(HttpServletResponse.SC_CREATED);
        return binder.getReportTO(report);
    }
View Full Code Here

    @RequestMapping(method = RequestMethod.POST, value = "/update")
    public ReportTO update(@RequestBody final ReportTO reportTO) throws NotFoundException {

        LOG.debug("Report update called with parameter {}", reportTO);

        Report report = reportDAO.find(reportTO.getId());
        if (report == null) {
            throw new NotFoundException("Report " + reportTO.getId());
        }

        binder.getReport(report, reportTO);
        report = reportDAO.save(report);

        try {
            jobInstanceLoader.registerJob(report);
        } catch (Exception e) {
            LOG.error("While registering quartz job for report " + report.getId(), e);

            SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
            sce.addElement(e.getMessage());
            scce.addException(sce);
            throw scce;
        }

        auditManager.audit(Category.report, ReportSubCategory.update, Result.success,
                "Successfully updated report: " + report.getId());

        return binder.getReportTO(report);
    }
View Full Code Here

    @PreAuthorize("hasRole('REPORT_READ')")
    @RequestMapping(method = RequestMethod.GET, value = "/read/{reportId}")
    public ReportTO read(@PathVariable("reportId") final Long reportId) throws NotFoundException {

        Report report = reportDAO.find(reportId);
        if (report == null) {
            throw new NotFoundException("Report " + reportId);
        }

        auditManager.audit(Category.report, ReportSubCategory.read, Result.success,
                "Successfully read report: " + report.getId());

        return binder.getReportTO(report);
    }
View Full Code Here

    @PreAuthorize("hasRole('REPORT_EXECUTE')")
    @RequestMapping(method = RequestMethod.POST, value = "/execute/{reportId}")
    public ReportExecTO execute(@PathVariable("reportId") final Long reportId) throws NotFoundException {

        Report report = reportDAO.find(reportId);
        if (report == null) {
            throw new NotFoundException("Report " + reportId);
        }

        ReportExecTO result;

        ReportExec latestExec = reportExecDAO.findLatestStarted(report);
        if (latestExec != null
                && (ReportExecStatus.STARTED.name().equals(latestExec.getStatus())
                || ReportExecStatus.RUNNING.name().equals(latestExec.getStatus()))) {

            LOG.debug("Found a non-terminated execution for report {}: not triggering a new execution", report);
           
            result = binder.getReportExecTO(latestExec);
        } else {
            LOG.debug("Triggering a new execution of report {}", report);

            try {
                jobInstanceLoader.registerJob(report);

                JobDataMap map = new JobDataMap();
                scheduler.getScheduler().triggerJob(JobInstanceLoader.getJobName(report), Scheduler.DEFAULT_GROUP, map);

                auditManager.audit(Category.report, ReportSubCategory.execute, Result.success,
                        "Successfully started execution for report: " + report.getId());
            } catch (Exception e) {
                LOG.error("While executing report {}", report, e);

                auditManager.audit(Category.report, ReportSubCategory.execute, Result.failure,
                        "Could not start execution for report: " + report.getId(), e);

                SyncopeClientCompositeErrorException scce =
                        new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
                SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
                sce.addElement(e.getMessage());
View Full Code Here

    @PreAuthorize("hasRole('REPORT_DELETE')")
    @RequestMapping(method = RequestMethod.GET, value = "/delete/{reportId}")
    public ReportTO delete(@PathVariable("reportId") final Long reportId)
            throws NotFoundException, SyncopeClientCompositeErrorException {

        Report report = reportDAO.find(reportId);
        if (report == null) {
            throw new NotFoundException("Report " + reportId);
        }

        ReportTO deletedReport = binder.getReportTO(report);

        jobInstanceLoader.unregisterJob(report);

        reportDAO.delete(report);

        auditManager.audit(Category.report, ReportSubCategory.delete, Result.success,
                "Successfully deleted report: " + report.getId());

        return deletedReport;
    }
View Full Code Here

        registerJob(getJobName(report), jobInstance, report.getCronExpression());
    }

    @Transactional(readOnly = true)
    public void registerReportJob(final Long reportId) throws SchedulerException, ParseException {
        Report report = reportDAO.find(reportId);
        if (report == null) {
            throw new NotFoundException("Report " + reportId);
        } else {
            registerJob(report);
        }
View Full Code Here

        return createdReportTO;
    }

    @PreAuthorize("hasRole('REPORT_CREATE')")
    public ReportTO createInternal(final ReportTO reportTO) {
        Report report = new Report();
        binder.getReport(report, reportTO);
        report = reportDAO.save(report);

        try {
            jobInstanceLoader.registerJob(report);
        } catch (Exception e) {
            LOG.error("While registering quartz job for report " + report.getId(), e);

            SyncopeClientCompositeErrorException scce =
                    new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
            sce.addElement(e.getMessage());
View Full Code Here

    }

    @PreAuthorize("hasRole('REPORT_UPDATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/update")
    public ReportTO update(@RequestBody final ReportTO reportTO) {
        Report report = reportDAO.find(reportTO.getId());
        if (report == null) {
            throw new NotFoundException("Report " + reportTO.getId());
        }

        binder.getReport(report, reportTO);
        report = reportDAO.save(report);

        try {
            jobInstanceLoader.registerJob(report);
        } catch (Exception e) {
            LOG.error("While registering quartz job for report " + report.getId(), e);

            SyncopeClientCompositeErrorException sccee =
                    new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
            sce.addElement(e.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.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.