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

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


        task.setActionsClassName(taskTO.getActionsClassName());
    }

    public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtil taskUtil) {
        SchedTask task = taskUtil.newTask();
        task.setCronExpression(taskTO.getCronExpression());
        task.setName(taskTO.getName());
        task.setDescription(taskTO.getDescription());

        if (taskUtil == TaskUtil.SCHED) {
            task.setJobClassName(taskTO.getJobClassName());
        }
        if (taskUtil == TaskUtil.SYNC) {
            if (!(taskTO instanceof SyncTaskTO)) {
                throw new ClassCastException("taskUtil is type SyncTask but taskTO is not SyncTaskTO: " + taskTO.
                        getClass().getName());
View Full Code Here


        // failover scenarios)
        if (!ctx.containsBean(bundle.getJobDetail().getKey().getName())) {
            Long taskId = JobInstanceLoader.getTaskIdFromJobName(bundle.getJobDetail().getKey().getName());
            if (taskId != null) {
                TaskDAO taskDAO = ctx.getBean(TaskDAO.class);
                SchedTask task = taskDAO.find(taskId);

                JobInstanceLoader jobInstanceLoader = ctx.getBean(JobInstanceLoader.class);
                jobInstanceLoader.registerJob(task, task.getJobClassName(), task.getCronExpression());
            }

            Long reportId = JobInstanceLoader.getReportIdFromJobName(bundle.getJobDetail().getKey().getName());
            if (reportId != null) {
                ReportDAO reportDAO = ctx.getBean(ReportDAO.class);
View Full Code Here

    protected String doExecute(final boolean dryRun) throws JobExecutionException {

        if (!(task instanceof SchedTask)) {
            throw new JobExecutionException("Task " + taskId + " isn't a SchedTask");
        }
        final SchedTask schedTask = (SchedTask) this.task;

        LOG.info("SampleJob {}running [SchedTask {}]", (dryRun
                ? "dry "
                : ""), schedTask.getId());

        return (dryRun
                ? "DRY "
                : "") + "RUNNING";
    }
View Full Code Here

    public TaskTO createSchedTaskInternal(final SchedTaskTO taskTO) {
        LOG.debug("Creating task " + taskTO);

        TaskUtil taskUtil = getTaskUtil(taskTO);

        SchedTask task = binder.createSchedTask(taskTO, taskUtil);
        task = taskDAO.save(task);

        try {
            jobInstanceLoader.registerJob(task, task.getJobClassName(), task.getCronExpression());
        } catch (Exception e) {
            LOG.error("While registering quartz job for task " + task.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.task, TaskSubCategory.create, Result.success,
                "Successfully created task: " + task.getId() + "/" + taskUtil);

        return binder.getTaskTO(task, taskUtil);
    }
View Full Code Here

    @PreAuthorize("hasRole('TASK_UPDATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/update/sched")
    public TaskTO updateSched(@RequestBody final SchedTaskTO taskTO) {
        LOG.debug("Task update called with parameter {}", taskTO);

        SchedTask task = taskDAO.find(taskTO.getId());
        if (task == null) {
            throw new NotFoundException("Task " + taskTO.getId());
        }

        TaskUtil taskUtil = getTaskUtil(task);

        SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);

        binder.updateSchedTask(task, taskTO, taskUtil);
        task = taskDAO.save(task);

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

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

        auditManager.audit(Category.task, TaskSubCategory.update, Result.success,
                "Successfully udpated task: " + task.getId() + "/" + taskUtil);

        return binder.getTaskTO(task, taskUtil);
    }
View Full Code Here

        task.setActionsClassName(taskTO.getActionsClassName());
    }

    public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtil taskUtil) {
        SchedTask task = taskUtil.newTask();
        task.setCronExpression(taskTO.getCronExpression());
        task.setName(taskTO.getName());
        task.setDescription(taskTO.getDescription());

        if (taskUtil == TaskUtil.SCHED) {
            task.setJobClassName(taskTO.getJobClassName());
        }
        if (taskUtil == TaskUtil.SYNC) {
            if (!(taskTO instanceof SyncTaskTO)) {
                throw new ClassCastException("taskUtil is type SyncTask but taskTO is not SyncTaskTO: " + taskTO.
                        getClass().getName());
View Full Code Here

    }

    public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtil taskUtil)
            throws NotFoundException {

        SchedTask task = taskUtil.newTask();
        task.setCronExpression(taskTO.getCronExpression());

        switch (taskUtil) {
            case SCHED:
                task.setJobClassName(taskTO.getJobClassName());
                break;

            case SYNC:
                if (!(taskTO instanceof SyncTaskTO)) {
                    throw new ClassCastException("taskUtil is type SyncTask but taskTO is not SyncTaskTO: " + taskTO.
View Full Code Here

        task.setActionsClassName(taskTO.getActionsClassName());
    }

    public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtil taskUtil) {
        SchedTask task = taskUtil.newTask();
        task.setCronExpression(taskTO.getCronExpression());
        task.setName(taskTO.getName());
        task.setDescription(taskTO.getDescription());

        if (taskUtil == TaskUtil.SCHED) {
            task.setJobClassName(taskTO.getJobClassName());
        }
        if (taskUtil == TaskUtil.SYNC) {
            if (!(taskTO instanceof SyncTaskTO)) {
                throw new ClassCastException("taskUtil is type SyncTask but taskTO is not SyncTaskTO: " + taskTO.
                        getClass().getName());
View Full Code Here

    @Transactional(readOnly = true)
    public void registerTaskJob(final Long taskId)
            throws ClassNotFoundException, SchedulerException, ParseException {

        SchedTask task = taskDAO.find(taskId);
        if (task == null) {
            throw new NotFoundException("Task " + taskId);
        } else {
            registerJob(task, task.getJobClassName(), task.getCronExpression());
        }
    }
View Full Code Here

    public TaskTO createSchedTaskInternal(final SchedTaskTO taskTO) {
        LOG.debug("Creating task " + taskTO);

        TaskUtil taskUtil = getTaskUtil(taskTO);

        SchedTask task = binder.createSchedTask(taskTO, taskUtil);
        task = taskDAO.save(task);

        try {
            jobInstanceLoader.registerJob(task, task.getJobClassName(), task.getCronExpression());
        } catch (Exception e) {
            LOG.error("While registering quartz job for task " + task.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.task, TaskSubCategory.create, Result.success,
                "Successfully created task: " + task.getId() + "/" + taskUtil);

        return binder.getTaskTO(task, taskUtil);
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.SchedTask

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.