View Javadoc
1   package com.github.sbugat.rundeckmonitor;
2   
3   import java.util.Date;
4   
5   /**
6    * A runDeck execution information class.
7    * 
8    * @author Sylvain Bugat
9    * 
10   */
11  public final class JobExecutionInfo {
12  
13  	/** RunDeck execution id. */
14  	private final Long executionId;
15  
16  	/** RunDeck start job date. */
17  	private final Date startedAt;
18  
19  	/** Rundeck job description. */
20  	private final String description;
21  
22  	/** Flag for a long execution. */
23  	private final boolean longExecution;
24  
25  	/** Flag to mark the execution as already known. */
26  	private final boolean newJob;
27  
28  	/**
29  	 * Constructor to copy all arguments into new JobExecutionInfo object.
30  	 * 
31  	 * @param executionIdArg RunDeck identifier of the execution
32  	 * @param startedAtArg starting date of the execution
33  	 * @param descriptionArg description of the execution
34  	 * @param longExecutionArg flag to indicate if it's a long execution
35  	 * @param newJobArg flag to indicate if this execution is already known
36  	 */
37  	public JobExecutionInfo(final Long executionIdArg, final Date startedAtArg, final String descriptionArg, final boolean longExecutionArg, final boolean newJobArg) {
38  		executionId = executionIdArg;
39  		startedAt = new Date(startedAtArg.getTime());
40  		description = descriptionArg;
41  		longExecution = longExecutionArg;
42  		newJob = newJobArg;
43  	}
44  
45  	/**
46  	 * Return the RunDeck execution identifier.
47  	 * 
48  	 * @return RunDeck execution identifier
49  	 */
50  	public Long getExecutionId() {
51  		return executionId;
52  	}
53  
54  	/**
55  	 * Return the RunDeck execution starting date.
56  	 * 
57  	 * @return RunDeck execution starting date
58  	 */
59  	public Date getStartedAt() {
60  		return new Date(startedAt.getTime());
61  	}
62  
63  	/**
64  	 * Return the RunDeck job description.
65  	 * 
66  	 * @return RunDeck job description
67  	 */
68  	public String getDescription() {
69  		return description;
70  	}
71  
72  	/**
73  	 * Return the long execution flag.
74  	 * 
75  	 * @return long execution flag
76  	 */
77  	public boolean isLongExecution() {
78  		return longExecution;
79  	}
80  
81  	/**
82  	 * Return the new execution flag.
83  	 * 
84  	 * @return new execution flag
85  	 */
86  	public boolean isNewJob() {
87  		return newJob;
88  	}
89  }