Java Code Examples for org.quartz.Trigger#getDescription()

The following examples show how to use org.quartz.Trigger#getDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TriggerSupport.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public static CompositeData toCompositeData(Trigger trigger) {
    try {
        return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
                new Object[] {
                        trigger.getKey().getName(),
                        trigger.getKey().getGroup(),
                        trigger.getJobKey().getName(),
                        trigger.getJobKey().getGroup(),
                        trigger.getDescription(),
                        JobDataMapSupport.toTabularData(trigger
                                .getJobDataMap()),
                        trigger.getCalendarName(),
                        ((OperableTrigger)trigger).getFireInstanceId(),
                        trigger.getMisfireInstruction(),
                        trigger.getPriority(), trigger.getStartTime(),
                        trigger.getEndTime(), trigger.getNextFireTime(),
                        trigger.getPreviousFireTime(),
                        trigger.getFinalFireTime() });
    } catch (OpenDataException e) {
        throw new RuntimeException(e);
    }
}
 
Example 2
Source File: TriggerSupport.java    From AsuraFramework with Apache License 2.0 6 votes vote down vote up
public static CompositeData toCompositeData(Trigger trigger) {
	try {
		return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
				new Object[] {
						trigger.getName(),
						trigger.getGroup(),
						trigger.getJobName(),
						trigger.getJobGroup(),
						trigger.getDescription(),
						JobDataMapSupport.toTabularData(trigger
								.getJobDataMap()), trigger.isVolatile(),
						trigger.getCalendarName(),
						trigger.getFireInstanceId(),
						trigger.getMisfireInstruction(),
						trigger.getPriority(), trigger.getStartTime(),
						trigger.getEndTime(), trigger.getNextFireTime(),
						trigger.getPreviousFireTime(),
						trigger.getFinalFireTime() });
	} catch (OpenDataException e) {
		throw new RuntimeException(e);
	}
}
 
Example 3
Source File: SchedulerServiceSupplier.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Builds the triggers list xml string.
 * 
 * @param triggers the triggers
 * 
 * @return the string
 * 
 * @throws SourceBeanException the source bean exception
 */
public  String buildTriggersListXmlString(Trigger[] triggers) throws SourceBeanException {
	StringBuffer buffer = new StringBuffer("<ROWS>");
	if (triggers != null && triggers.length > 0) {
		for (int i = 0; i < triggers.length; i++) {
			Trigger trigger = triggers[i];
			if(trigger.getName().startsWith("schedule_uuid_")) {
				continue;
			}
			buffer.append("<ROW ");
			String triggerName = trigger.getName();
			String triggerGroup = trigger.getGroup();
			String triggerDescription = trigger.getDescription();
			String triggerCalendarName = trigger.getCalendarName();
			Date triggerStartTime = trigger.getStartTime();
			String triggerStartTimeStr = triggerStartTime != null ? triggerStartTime.toString(): "";
			Date triggerEndTime = trigger.getEndTime();
			String triggerEndTimeStr = triggerEndTime != null ? triggerEndTime.toString(): "";
			buffer.append(" triggerName=\"" + (triggerName != null ? triggerName : "") + "\"");
			buffer.append(" triggerGroup=\"" + (triggerGroup != null ? triggerGroup : "") + "\"");
			buffer.append(" triggerDescription=\"" + (triggerDescription != null ? triggerDescription : "") + "\"");
			buffer.append(" triggerCalendarName=\"" + (triggerCalendarName != null ? triggerCalendarName : "") + "\"");
			buffer.append(" triggerStartTime=\"" + triggerStartTimeStr + "\"");
			buffer.append(" triggerEndTime=\"" + triggerEndTimeStr + "\"");
			buffer.append(" />");
		}
	}
	buffer.append("</ROWS>");
	return buffer.toString();
}
 
Example 4
Source File: NavigableEventLogListener.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private void info (EVENTTYPE eventType, Trigger trig, JobExecutionContext context, JobExecutionException exception, CompletedExecutionInstruction instructionCode) {
    JobDetail
        detail = (context != null)?context.getJobDetail():null;
    final JobDataMap
        dataMap = (context != null)?context.getMergedJobDataMap():null;
    final String
        jobName = (detail != null)?detail.getKey().getName():null,
        jobDesc = (detail != null)?detail.getDescription():null;
    final Class
        jobClass = (detail != null)?detail.getJobClass():null;
    final Trigger
        trigger = (trig != null)?trig:((context != null)?context.getTrigger():null);
    final String
        trigName = (trigger != null)?trigger.getKey().getName():null,
        trigDesc = (trigger != null)?trigger.getDescription():null;
    final Date
        trigStart = (trigger != null)?trigger.getStartTime():null,
        trigEnd = (trigger != null)?trigger.getEndTime():null;

    StringBuilder
        sb = new StringBuilder();

    switch (eventType)
    {
        case JOB_EXECUTING:
        {
            sb.append("Job Executing: [");
            sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"")
                    .append(", class: ").append(jobClass.getName());
            sb.append("]");
            break;
        }
        case JOB_VETOED:
        {
            sb.append("Job Vetoed: [");
            sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"")
                    .append(", class: ").append(jobClass.getName());
            break;
        }
        case JOB_EXECUTED:
        {
            sb.append("Job Executed: [");
            sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"")
              .append(", class: ").append(jobClass.getName());

            if (exception != null)
            {
                sb.append (", exception: ").append(exception.getMessage());
                if (exception.getCause() != null)
                {
                  sb.append(", exception cause: ").append(exception.getCause().getClass().getName());
                }
            }
            sb.append("]");

            break;
        }
        case TRIGGER_FIRED:
        {
            sb.append("Trigger Fired: [");
            sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"")
              .append(", start: ").append((trigStart != null)?trigStart.toString():null)
              .append(", end: ").append((trigEnd != null)?trigEnd.toString():null);
            sb.append(", job: ").append(jobName).append(", job description: ").append((jobDesc != null)?jobDesc:"")
                    .append(", class: ").append(jobClass.getName());
            sb.append("]");
            break;
        }
        case TRIGGER_MISFIRED:
        {
            sb.append("Trigger Misfired: [");
            sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"")
              .append(", start: ").append((trigStart!=null)?trigStart.toString():null)
              .append(", end: ").append((trigEnd!=null)?trigEnd.toString():null);
            sb.append("]");
            break;
        }
        case TRIGGER_COMPLETED:
        {
            sb.append("Trigger Completed: [");
            sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"")
              .append(", start: ").append((trigStart!=null)?trigStart.toString():null)
              .append(", end: ").append((trigEnd!=null)?trigEnd.toString():null);
            sb.append(", job: ").append(jobName).append(", job description: ").append((jobDesc != null)?jobDesc:"")
              .append(", class: ").append(jobClass.getName())
              .append(", execution result: ").append(instructionCode);
            sb.append("]");
            break;
        }
    }
    if (log.isDebugEnabled())
    {
    	log.debug(sb.toString());
    }
}
 
Example 5
Source File: NavigableEventLogListener.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private void info (EVENTTYPE eventType, Trigger trig, JobExecutionContext context, JobExecutionException exception, CompletedExecutionInstruction instructionCode) {
    JobDetail
        detail = (context != null)?context.getJobDetail():null;
    final JobDataMap
        dataMap = (context != null)?context.getMergedJobDataMap():null;
    final String
        jobName = (detail != null)?detail.getKey().getName():null,
        jobDesc = (detail != null)?detail.getDescription():null;
    final Class
        jobClass = (detail != null)?detail.getJobClass():null;
    final Trigger
        trigger = (trig != null)?trig:((context != null)?context.getTrigger():null);
    final String
        trigName = (trigger != null)?trigger.getKey().getName():null,
        trigDesc = (trigger != null)?trigger.getDescription():null;
    final Date
        trigStart = (trigger != null)?trigger.getStartTime():null,
        trigEnd = (trigger != null)?trigger.getEndTime():null;

    StringBuilder
        sb = new StringBuilder();

    switch (eventType)
    {
        case JOB_EXECUTING:
        {
            sb.append("Job Executing: [");
            sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"")
                    .append(", class: ").append(jobClass.getName());
            sb.append("]");
            break;
        }
        case JOB_VETOED:
        {
            sb.append("Job Vetoed: [");
            sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"")
                    .append(", class: ").append(jobClass.getName());
            break;
        }
        case JOB_EXECUTED:
        {
            sb.append("Job Executed: [");
            sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"")
              .append(", class: ").append(jobClass.getName());

            if (exception != null)
            {
                sb.append (", exception: ").append(exception.getMessage());
                if (exception.getCause() != null)
                {
                  sb.append(", exception cause: ").append(exception.getCause().getClass().getName());
                }
            }
            sb.append("]");

            break;
        }
        case TRIGGER_FIRED:
        {
            sb.append("Trigger Fired: [");
            sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"")
              .append(", start: ").append((trigStart != null)?trigStart.toString():null)
              .append(", end: ").append((trigEnd != null)?trigEnd.toString():null);
            sb.append(", job: ").append(jobName).append(", job description: ").append((jobDesc != null)?jobDesc:"")
                    .append(", class: ").append(jobClass.getName());
            sb.append("]");
            break;
        }
        case TRIGGER_MISFIRED:
        {
            sb.append("Trigger Misfired: [");
            sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"")
              .append(", start: ").append((trigStart!=null)?trigStart.toString():null)
              .append(", end: ").append((trigEnd!=null)?trigEnd.toString():null);
            sb.append("]");
            break;
        }
        case TRIGGER_COMPLETED:
        {
            sb.append("Trigger Completed: [");
            sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"")
              .append(", start: ").append((trigStart!=null)?trigStart.toString():null)
              .append(", end: ").append((trigEnd!=null)?trigEnd.toString():null);
            sb.append(", job: ").append(jobName).append(", job description: ").append((jobDesc != null)?jobDesc:"")
              .append(", class: ").append(jobClass.getName())
              .append(", execution result: ").append(instructionCode);
            sb.append("]");
            break;
        }
    }
    if (log.isDebugEnabled())
    {
    	log.debug(sb.toString());
    }
}