1 package org.andromda.cartridges.spring.metafacades;
2
3 import java.util.ArrayList;
4 import java.util.Collection;
5
6 import org.andromda.metafacades.uml.ParameterFacade;
7 import org.apache.commons.lang.StringUtils;
8
9 import org.andromda.cartridges.spring.SpringProfile;
10
11
12
13
14
15
16 public class SpringEntityOperationLogicImpl
17 extends SpringEntityOperationLogic
18 {
19 private static final long serialVersionUID = 34L;
20
21
22
23
24
25
26 public SpringEntityOperationLogicImpl(Object metaObject, String context)
27 {
28 super(metaObject, context);
29 }
30
31
32
33
34
35 protected String handleGetImplementationName()
36 {
37 return this.getImplementationOperationName(StringUtils.capitalize(this.getName()));
38 }
39
40
41
42
43
44 protected String handleGetImplementationCall()
45 {
46 return this.getImplementationOperationName(StringUtils.capitalize(this.getCall()));
47 }
48
49
50
51
52
53 protected String handleGetImplementationSignature()
54 {
55 return this.getImplementationOperationName(StringUtils.capitalize(this.getSignature()));
56 }
57
58
59
60
61
62
63
64
65 private String getImplementationOperationName(String replacement)
66 {
67 return StringUtils.trimToEmpty(String.valueOf(this.getConfiguredProperty(
68 SpringGlobals.IMPLEMENTATION_OPERATION_NAME_PATTERN))).replaceAll("\\{0\\}", replacement);
69 }
70
71
72
73
74
75 protected Collection<SpringCriteriaAttributeLogic> handleGetArguments()
76 {
77 Collection<SpringCriteriaAttributeLogic> arguments = new ArrayList<SpringCriteriaAttributeLogic>();
78 for (ParameterFacade parameter : this.getArguments())
79 {
80 arguments.add((SpringCriteriaAttributeLogic)parameter.getType());
81 }
82 return arguments;
83 }
84
85
86
87
88 @Override
89 protected boolean handleIsPrePersist()
90 {
91 return this.hasStereotype(SpringProfile.STEREOTYPE_PRE_PERSIST);
92 }
93
94
95
96
97 @Override
98 protected boolean handleIsPostPersist()
99 {
100 return this.hasStereotype(SpringProfile.STEREOTYPE_POST_PERSIST);
101 }
102
103
104
105
106 @Override
107 protected boolean handleIsPreRemove()
108 {
109 return this.hasStereotype(SpringProfile.STEREOTYPE_PRE_REMOVE);
110 }
111
112
113
114
115 @Override
116 protected boolean handleIsPostRemove()
117 {
118 return this.hasStereotype(SpringProfile.STEREOTYPE_POST_REMOVE);
119 }
120
121
122
123
124 @Override
125 protected boolean handleIsPreUpdate()
126 {
127 return this.hasStereotype(SpringProfile.STEREOTYPE_PRE_UPDATE);
128 }
129
130
131
132
133 @Override
134 protected boolean handleIsPostUpdate()
135 {
136 return this.hasStereotype(SpringProfile.STEREOTYPE_POST_UPDATE);
137 }
138 }