1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.dto; |
18 | |
|
19 | |
import java.io.Serializable; |
20 | |
import java.util.ArrayList; |
21 | |
import java.util.Arrays; |
22 | |
import java.util.HashMap; |
23 | |
import java.util.List; |
24 | |
import java.util.Map; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
public class WorkflowAttributeDefinitionDTO implements Serializable { |
45 | |
|
46 | |
static final long serialVersionUID = 1000; |
47 | |
private String attributeName; |
48 | 0 | private List<String> constructorParameters = new ArrayList<String>(); |
49 | 0 | private Map<String, PropertyDefinitionDTO> properties = new HashMap<String, PropertyDefinitionDTO>(); |
50 | |
|
51 | 0 | public WorkflowAttributeDefinitionDTO() {} |
52 | |
|
53 | 0 | public WorkflowAttributeDefinitionDTO(String attributeName) { |
54 | 0 | setAttributeName(attributeName); |
55 | 0 | } |
56 | |
|
57 | |
public String getAttributeName() { |
58 | 0 | return attributeName; |
59 | |
} |
60 | |
|
61 | |
public void setAttributeName(String attributeName) { |
62 | 0 | if (attributeName == null) throw new IllegalArgumentException("Attribute name cannot be null"); |
63 | 0 | this.attributeName = attributeName; |
64 | 0 | } |
65 | |
|
66 | |
public void addConstructorParameter(String parameter) { |
67 | 0 | constructorParameters.add(parameter); |
68 | 0 | } |
69 | |
|
70 | |
public void removeConstructorParameter(String parameter) { |
71 | 0 | constructorParameters.remove(parameter); |
72 | 0 | } |
73 | |
|
74 | |
public void setConstructorParameters(String[] parameters) { |
75 | 0 | constructorParameters = Arrays.asList(parameters); |
76 | 0 | } |
77 | |
|
78 | |
public String[] getConstructorParameters() { |
79 | 0 | return (String[])constructorParameters.toArray(new String[0]); |
80 | |
} |
81 | |
|
82 | |
public void addProperty(PropertyDefinitionDTO property) { |
83 | 0 | if (property == null) return; |
84 | 0 | if (property.getName() == null) { |
85 | 0 | throw new IllegalArgumentException("PropertyDefinition cannot have a null name."); |
86 | |
} |
87 | 0 | properties.put(property.getName(), property); |
88 | 0 | } |
89 | |
|
90 | |
public PropertyDefinitionDTO getProperty(String name) { |
91 | 0 | return (PropertyDefinitionDTO)properties.get(name); |
92 | |
} |
93 | |
|
94 | |
public PropertyDefinitionDTO[] getProperties() { |
95 | 0 | return (PropertyDefinitionDTO[])properties.values().toArray(new PropertyDefinitionDTO[0]); |
96 | |
} |
97 | |
|
98 | |
public void setProperties(PropertyDefinitionDTO[] properties) { |
99 | 0 | this.properties.clear(); |
100 | 0 | if (properties == null) return; |
101 | 0 | for (int index = 0; index < properties.length; index++) { |
102 | 0 | addProperty(properties[index]); |
103 | |
} |
104 | 0 | } |
105 | |
|
106 | |
public void addProperty(String name, String value) { |
107 | 0 | addProperty(new PropertyDefinitionDTO(name, value)); |
108 | 0 | } |
109 | |
} |