Package org.rhq.enterprise.gui.common.scheduling

Examples of org.rhq.enterprise.gui.common.scheduling.OperationDetailsScheduleComponent


        return "success";
    }

    public OperationDetailsScheduleComponent getOperationDetails() {
        if (this.operationDetails == null)
            this.operationDetails = new OperationDetailsScheduleComponent();
        return this.operationDetails;
    }
View Full Code Here


    public abstract String getManagedBeanName();

    public abstract List<? extends OperationSchedule> getOperationScheduleList();

    public SimpleTrigger getTrigger() {
        OperationDetailsScheduleComponent component = this.getOperationDetails();
        SimpleTrigger trigger = new SimpleTrigger();
        //Validate if a start date is specified
        Date now = Calendar.getInstance().getTime();
        if ((component.getStart().equals("immediate"))) {
            trigger.setStartTime(now);
        } else {
            component.setDeferred(true);
            if (component.getStartDate() == null) {
                throw new IllegalArgumentException("Please select a start date");
            }
            if (now.after(component.getStartDate())) {
                throw new IllegalArgumentException("Scheduling cannot occur in the past");
                //                FacesMessages.instance().addToControl("start", "Scheduling cannot occur in the past");
            } else {
                trigger.setStartTime(component.getStartDate());
                if (component.getRecur().equals("never")) {
                } else {
                    //set the repetition interval of the trigger
                    trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY);
                    component.setRepeat(true);
                    long repeatInterval = component.getUnit().getMillis() * component.getRepeatInterval();
                    trigger.setRepeatInterval(repeatInterval);
                    if (component.getEnd().equals("endDate")) {
                        if (component.getEndDate() == null) {
                            throw new IllegalArgumentException("Please select an end date");
                        }
                        component.setTerminate(true);
                        if (component.getEndDate().before(component.getStartDate())) {
                            throw new IllegalArgumentException("Scheduling cannot occur before the start date");
                        } else {
                            //set the end date of the trigger
                            trigger.setEndTime(component.getEndDate());
                        }
                    }
                }
            }
        }
View Full Code Here

            } catch (SchedulerException se) {
                // capture all known info and throw a RuntimeException
                throw new IllegalStateException(se.getMessage(), se);
            }

            operationDetails = new OperationDetailsScheduleComponent(quartzTrigger);
        }
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.gui.common.scheduling.OperationDetailsScheduleComponent

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.