1 package org.andromda.cartridges.bpm4struts.metafacades;
2
3 import org.andromda.cartridges.bpm4struts.Bpm4StrutsGlobals;
4 import org.andromda.cartridges.bpm4struts.Bpm4StrutsProfile;
5 import org.andromda.cartridges.bpm4struts.Bpm4StrutsUtils;
6 import org.andromda.metafacades.uml.ClassifierFacade;
7
8
9
10
11
12
13 public class StrutsAttributeLogicImpl
14 extends StrutsAttributeLogic
15 {
16 private static final long serialVersionUID = 34L;
17
18
19
20
21 public StrutsAttributeLogicImpl(Object metaObject,
22 String context)
23 {
24 super(metaObject, context);
25 }
26
27
28
29
30
31 protected String handleGetDateFormat()
32 {
33 String dateFormat = null;
34
35 if (this.getType() != null && this.getType().isDateType())
36 {
37 final Object taggedValueObject = this.findTaggedValue(Bpm4StrutsProfile.TAGGEDVALUE_INPUT_FORMAT);
38 if (taggedValueObject == null)
39 {
40 dateFormat = (String)this.getConfiguredProperty(Bpm4StrutsGlobals.PROPERTY_DEFAULT_DATEFORMAT);
41 }
42 else
43 {
44 dateFormat = taggedValueObject.toString();
45 }
46 }
47
48 return dateFormat;
49 }
50
51
52
53
54 protected String handleGetDummyValue(int seed)
55 {
56 String dummyValue = null;
57
58 final ClassifierFacade type = this.getType();
59
60 if (type == null)
61 {
62 dummyValue = "";
63 }
64 else if (type.isDateType())
65 {
66 dummyValue = "new java.util.Date()";
67 }
68 else if (type.isBooleanType())
69 {
70 dummyValue = String.valueOf(seed % 2 == 0);
71 }
72 else if (type.isPrimitive())
73 {
74 dummyValue = String.valueOf(seed);
75 }
76 else
77 {
78 dummyValue = '\"' + this.getName() + '-' + seed + '\"';
79 }
80
81 return dummyValue;
82 }
83
84
85
86
87 protected boolean handleIsSafeNamePresent()
88 {
89 return Bpm4StrutsUtils.isSafeName(this.getName());
90 }
91 }