2 * Copyright (C) 2007-2012 Argeo GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.slc
.execution
;
18 import java
.io
.Serializable
;
19 import java
.util
.HashMap
;
24 * Implements both archetype and implementation of a given process.
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
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.
40 * Generally, values object are either a <code>PrimitiveAccessor</code> or a
41 * <code>RefValue</code> but can be other objects.
43 public class ExecutionFlowDescriptor
implements Serializable
, Cloneable
{
44 private static final long serialVersionUID
= 7101944857038041216L;
46 private String description
;
48 private Map
<String
, Object
> values
;
49 private ExecutionSpec executionSpec
;
51 public ExecutionFlowDescriptor() {
54 public ExecutionFlowDescriptor(String name
, String description
,
55 Map
<String
, Object
> values
, ExecutionSpec executionSpec
) {
58 this.executionSpec
= executionSpec
;
61 /** The referenced {@link ExecutionSpec} is NOT cloned. */
63 protected Object
clone() throws CloneNotSupportedException
{
64 return new ExecutionFlowDescriptor(name
, description
,
65 new HashMap
<String
, Object
>(values
), executionSpec
);
68 public String
getName() {
73 * @deprecated will be removed in SLC 2.x, the path should be the part of
76 public String
getPath() {
81 * @deprecated will be removed in SLC 2.0, the path should be the part of
84 public void setPath(String path
) {
88 public Map
<String
, Object
> getValues() {
92 public ExecutionSpec
getExecutionSpec() {
96 public void setName(String name
) {
100 public void setValues(Map
<String
, Object
> values
) {
101 this.values
= values
;
104 public void setExecutionSpec(ExecutionSpec executionSpec
) {
105 this.executionSpec
= executionSpec
;
108 public String
getDescription() {
112 public void setDescription(String description
) {
113 this.description
= description
;
117 public boolean equals(Object obj
) {
118 if (obj
instanceof ExecutionFlowDescriptor
)
119 return name
.equals(((ExecutionFlowDescriptor
) obj
).getName());
124 public int hashCode() {
125 return name
.hashCode();
129 public String
toString() {
130 return (path
!= null && !path
.trim().equals("") ? path
+ "/" : "")