1 /*
2 * Licensed to The Apereo Foundation under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work for additional
4 * information regarding copyright ownership.
5 *
6 *
7 * The Apereo Foundation licenses this file to you under the Educational
8 * Community License, Version 2.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of the License
10 * at:
11 *
12 * http://opensource.org/licenses/ecl2.txt
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 * License for the specific language governing permissions and limitations under
18 * the License.
19 *
20 */
21
22 package org.opencastproject.workflow.api;
23
24 import org.opencastproject.mediapackage.MediaPackage;
25
26 import java.util.Map;
27
28 /**
29 * The result of a workflow operation.
30 */
31 public interface WorkflowOperationResult {
32 enum Action {
33 CONTINUE, PAUSE, SKIP
34 }
35
36 /**
37 * @return The media package that results from the execution of a workflow operation.
38 */
39 MediaPackage getMediaPackage();
40
41 /**
42 * Operations may optionally set properties on a workflow operation.
43 *
44 * @return The properties to set
45 */
46 Map<String, String> getProperties();
47
48 /**
49 * Sets the action to take.
50 *
51 * @param action
52 * the action
53 */
54 void setAction(Action action);
55
56 /**
57 * Operations may optionally request that the workflow be placed in a certain state.
58 *
59 * @return The action that the workflow service should take on this workflow instance.
60 */
61 Action getAction();
62
63 /**
64 * Specifies whether the operation should be continuable by the user.
65 *
66 * @param isContinuable
67 */
68 void setAllowsContinue(boolean isContinuable);
69
70 /**
71 * Returns <code>true</code> if this operation can be continued by the user from an optional hold state. This value is
72 * only considered if the action returned by this result equals {@link Action#PAUSE}.
73 *
74 * @return <code>true</code> if a paused operation should be continuable
75 */
76 boolean allowsContinue();
77
78 /**
79 * Specifies whether the operation should be abortable by the user.
80 *
81 * @param isAbortable
82 */
83 void setAllowsAbort(boolean isAbortable);
84
85 /**
86 * Returns <code>true</code> if this operation can be canceled by the user from an optional hold state. This value is
87 * only considered if the action returned by this result equals {@link Action#PAUSE}.
88 *
89 * @return <code>true</code> if a paused operation should be abortable
90 */
91 boolean allowsAbort();
92
93 /**
94 * The number of milliseconds this operation sat in a queue before finishing.
95 *
96 * @return The time spent in a queue
97 */
98 long getTimeInQueue();
99
100 }