]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlowDescriptor.java
Upgrade all classpaths to Java 11
[gpl/argeo-slc.git] / org.argeo.slc.api / src / org / argeo / slc / execution / ExecutionFlowDescriptor.java
1 package org.argeo.slc.execution;
2
3 import java.io.Serializable;
4 import java.util.HashMap;
5 import java.util.Map;
6
7 /**
8 *
9 * Implements both archetype and implementation of a given process.
10 *
11 * At specification time, <code>executionSpec</code> represents the spec of the
12 * parameters accepted by the process, with, among others: type, default value
13 * and, optionally, possible values for each parameter. Thus ExecutionSpec might
14 * be a huge object. Note that when marshalling only a reference to a specific
15 * ExecutionSpec is stored in the XML to optimize performance and avoid
16 * redundancy between various ExecutionFlowDesciptor that might have the same
17 * ExecutionSpec.
18 *
19 * At runtime, we build a RealizedFlow which references an
20 * ExecutionFlowDescriptor. As it happens AFTER marshalling / unmarshalling
21 * process, the ExecutionSpec is null but we manage to retrieve the
22 * ExecutionSpec and store it in the RealizedFlow, whereas set values of the
23 * parameters are stored in the <code>values</code> map.
24 *
25 * Generally, values object are either a <code>PrimitiveAccessor</code> or a
26 * <code>RefValue</code> but can be other objects.
27 */
28 public class ExecutionFlowDescriptor implements Serializable, Cloneable {
29 private static final long serialVersionUID = 7101944857038041216L;
30 private String name;
31 private String description;
32 private String path;
33 private Map<String, Object> values;
34 private ExecutionSpec executionSpec;
35
36 public ExecutionFlowDescriptor() {
37 }
38
39 public ExecutionFlowDescriptor(String name, String description,
40 Map<String, Object> values, ExecutionSpec executionSpec) {
41 this.name = name;
42 this.values = values;
43 this.executionSpec = executionSpec;
44 }
45
46 /** The referenced {@link ExecutionSpec} is NOT cloned. */
47 @Override
48 protected Object clone() throws CloneNotSupportedException {
49 return new ExecutionFlowDescriptor(name, description,
50 new HashMap<String, Object>(values), executionSpec);
51 }
52
53 public String getName() {
54 return name;
55 }
56
57 /**
58 * @deprecated will be removed in SLC 2.x, the path should be the part of
59 * the name with '/'
60 */
61 public String getPath() {
62 return path;
63 }
64
65 /**
66 * @deprecated will be removed in SLC 2.0, the path should be the part of
67 * the name with '/'
68 */
69 public void setPath(String path) {
70 this.path = path;
71 }
72
73 public Map<String, Object> getValues() {
74 return values;
75 }
76
77 public ExecutionSpec getExecutionSpec() {
78 return executionSpec;
79 }
80
81 public void setName(String name) {
82 this.name = name;
83 }
84
85 public void setValues(Map<String, Object> values) {
86 this.values = values;
87 }
88
89 public void setExecutionSpec(ExecutionSpec executionSpec) {
90 this.executionSpec = executionSpec;
91 }
92
93 public String getDescription() {
94 return description;
95 }
96
97 public void setDescription(String description) {
98 this.description = description;
99 }
100
101 @Override
102 public boolean equals(Object obj) {
103 if (obj instanceof ExecutionFlowDescriptor)
104 return name.equals(((ExecutionFlowDescriptor) obj).getName());
105 return false;
106 }
107
108 @Override
109 public int hashCode() {
110 return name.hashCode();
111 }
112
113 @Override
114 public String toString() {
115 return (path != null && !path.trim().equals("") ? path + "/" : "")
116 + name;
117 }
118
119 }