01: package org.andromda.cartridges.hibernate.metafacades;
02:
03: import java.text.MessageFormat;
04:
05: import org.andromda.cartridges.hibernate.HibernateProfile;
06: import org.apache.commons.lang.ObjectUtils;
07: import org.apache.commons.lang.StringUtils;
08:
09: /**
10: * MetafacadeLogic implementation for
11: * org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue.
12: *
13: * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue
14: * @author Klaus Schultz
15: */
16: public class HibernateEmbeddedValueLogicImpl extends
17: HibernateEmbeddedValueLogic {
18: // ---------------- constructor -------------------------------
19: public HibernateEmbeddedValueLogicImpl(Object metaObject,
20: String context) {
21: super (metaObject, context);
22: }
23:
24: /**
25: * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue#isImmutable()
26: */
27: protected boolean handleIsImmutable() {
28: boolean immutable = false;
29: Object value = this
30: .findTaggedValue(HibernateProfile.TAGGEDVALUE_PERSISTENCE_IMMUTABLE);
31: if (value != null) {
32: immutable = Boolean.valueOf(ObjectUtils.toString(value))
33: .booleanValue();
34: }
35: return immutable;
36: }
37:
38: /**
39: * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue#getImplementationName()
40: */
41: protected java.lang.String handleGetImplementationName() {
42: final String implNamePattern = String
43: .valueOf(this
44: .getConfiguredProperty(HibernateGlobals.EMBEDDED_VALUE_IMPLEMENTATION_NAME_PATTERN));
45: return MessageFormat
46: .format(implNamePattern, new Object[] { StringUtils
47: .trimToEmpty(this .getName()) });
48: }
49:
50: /**
51: * @see org.andromda.cartridges.hibernate.metafacades.HibernateEntity#getEntityName()
52: */
53: protected String handleGetEntityName() {
54: final String entityNamePattern = (String) this
55: .getConfiguredProperty(HibernateGlobals.ENTITY_NAME_PATTERN);
56: return MessageFormat
57: .format(entityNamePattern, new Object[] { StringUtils
58: .trimToEmpty(this .getName()) });
59: }
60:
61: /**
62: * analogy of HibernateEntityLogicImpl
63: *
64: * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue#getFullyQualifiedEntityName()
65: */
66: protected java.lang.String handleGetFullyQualifiedEntityName() {
67: return HibernateMetafacadeUtils.getFullyQualifiedName(this
68: .getPackageName(), this .getName(), null);
69: }
70:
71: /**
72: * see HibernateEntityLogicImpl
73: */
74: protected java.util.Collection handleGetBusinessOperations() {
75: return HibernateMetafacadeUtils.filterBusinessOperations(this
76: .getOperations());
77: }
78: }
|