01: package org.andromda.cartridges.bpm4struts.metafacades;
02:
03: import org.andromda.cartridges.bpm4struts.Bpm4StrutsGlobals;
04: import org.andromda.cartridges.bpm4struts.Bpm4StrutsProfile;
05: import org.andromda.cartridges.bpm4struts.Bpm4StrutsUtils;
06: import org.andromda.metafacades.uml.ClassifierFacade;
07:
08: /**
09: * MetafacadeLogic implementation for org.andromda.cartridges.bpm4struts.metafacades.StrutsAttribute.
10: *
11: * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsAttribute
12: */
13: public class StrutsAttributeLogicImpl extends StrutsAttributeLogic {
14:
15: public StrutsAttributeLogicImpl(Object metaObject, String context) {
16: super (metaObject, context);
17: }
18:
19: /**
20: * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsAttribute#getDateFormat()
21: */
22: protected java.lang.String handleGetDateFormat() {
23: String dateFormat = null;
24:
25: if (this .getType() != null && this .getType().isDateType()) {
26: final Object taggedValueObject = this
27: .findTaggedValue(Bpm4StrutsProfile.TAGGEDVALUE_INPUT_FORMAT);
28: if (taggedValueObject == null) {
29: dateFormat = (String) this
30: .getConfiguredProperty(Bpm4StrutsGlobals.PROPERTY_DEFAULT_DATEFORMAT);
31: } else {
32: dateFormat = taggedValueObject.toString();
33: }
34: }
35:
36: return dateFormat;
37: }
38:
39: protected String handleGetDummyValue(int seed) {
40: String dummyValue;
41:
42: final ClassifierFacade type = this .getType();
43:
44: if (type == null) {
45: dummyValue = "";
46: } else if (type.isDateType()) {
47: dummyValue = "new java.util.Date()";
48: } else if (type.isBooleanType()) {
49: dummyValue = String.valueOf(seed % 2 == 0);
50: } else if (type.isPrimitive()) {
51: dummyValue = String.valueOf(seed);
52: } else {
53: dummyValue = "\"" + this .getName() + '-' + seed + "\"";
54: }
55:
56: return dummyValue;
57: }
58:
59: protected boolean handleIsSafeNamePresent() {
60: return Bpm4StrutsUtils.isSafeName(this.getName());
61: }
62: }
|