]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlowDescriptor.java
f4329309996bc9fd6ee855be9731415953bcf446
[gpl/argeo-slc.git] / runtime / org.argeo.slc.specs / src / main / java / org / argeo / slc / execution / ExecutionFlowDescriptor.java
1 /*
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.argeo.slc.execution;
18
19 import java.io.Serializable;
20 import java.util.Map;
21
22 /**
23 *
24 * Implements both archetype and implementation of a given process.
25 *
26 * At specification time, <code>executionSpec</code> represents the spec of the
27 * parameters accepted by the process, with, among others: type, default value
28 * and, optionally, possible values for each parameter. Thus ExecutionSpec might
29 * be a huge object. Note that when marshalling only a reference to a specific
30 * ExecutionSpec is stored in the XML to optimize performance and avoid
31 * redundancy between various ExecutionFlowDesciptor that might have the same
32 * ExecutionSpec.
33 *
34 * At runtime, we build a RealizedFlow which references an
35 * ExecutionFlowDescriptor. As it happens AFTER marshalling / unmarshalling
36 * process, the ExecutionSpec is null but we manage to retrieve the
37 * ExecutionSpec and store it in the RealizedFlow, whereas set values of the
38 * parameters are stored in the <code>values</code> map.
39 *
40 * Generally, values object are either a <code>PrimitiveAccessor</code> or a
41 * <code>RefValue</code> but can be other objects.
42 *
43 * @author bsinou
44 *
45 *
46 */
47 public class ExecutionFlowDescriptor implements Serializable {
48 private static final long serialVersionUID = 7101944857038041216L;
49 private String name;
50 private String description;
51 private String path;
52 private Map<String, Object> values;
53 private ExecutionSpec executionSpec;
54
55 public ExecutionFlowDescriptor() {
56 }
57
58 public ExecutionFlowDescriptor(String name, Map<String, Object> values,
59 ExecutionSpec executionSpec) {
60 this.name = name;
61 this.values = values;
62 this.executionSpec = executionSpec;
63 }
64
65 public String getName() {
66 return name;
67 }
68
69 public String getPath() {
70 return path;
71 }
72
73 public void setPath(String path) {
74 this.path = path;
75 }
76
77 public Map<String, Object> getValues() {
78 return values;
79 }
80
81 public ExecutionSpec getExecutionSpec() {
82 return executionSpec;
83 }
84
85 public void setName(String name) {
86 this.name = name;
87 }
88
89 public void setValues(Map<String, Object> values) {
90 this.values = values;
91 }
92
93 public void setExecutionSpec(ExecutionSpec executionSpec) {
94 this.executionSpec = executionSpec;
95 }
96
97 public String getDescription() {
98 return description;
99 }
100
101 public void setDescription(String description) {
102 this.description = description;
103 }
104
105 @Override
106 public boolean equals(Object obj) {
107 if (obj instanceof ExecutionFlowDescriptor)
108 return name.equals(((ExecutionFlowDescriptor) obj).getName());
109 return false;
110 }
111
112 @Override
113 public int hashCode() {
114 return name.hashCode();
115 }
116
117 @Override
118 public String toString() {
119 return (path != null && !path.trim().equals("") ? path + "/" : "")
120 + name;
121 }
122
123 }