1 package org.andromda.cartridges.hibernate.metafacades;
2
3 import java.text.MessageFormat;
4 import java.util.Collection;
5 import org.andromda.cartridges.hibernate.HibernateProfile;
6 import org.apache.commons.lang.ObjectUtils;
7 import org.apache.commons.lang.StringUtils;
8
9
10
11
12
13
14
15
16 public class HibernateEmbeddedValueLogicImpl
17 extends HibernateEmbeddedValueLogic
18 {
19 private static final long serialVersionUID = 34L;
20
21
22
23
24
25 public HibernateEmbeddedValueLogicImpl(
26 Object metaObject,
27 String context)
28 {
29 super(metaObject, context);
30 }
31
32
33
34
35 @Override
36 protected boolean handleIsImmutable()
37 {
38 boolean immutable = false;
39 Object value = this.findTaggedValue(HibernateProfile.TAGGEDVALUE_PERSISTENCE_IMMUTABLE);
40 if (value != null)
41 {
42 immutable = Boolean.valueOf(ObjectUtils.toString(value)).booleanValue();
43 }
44 return immutable;
45 }
46
47
48
49
50 @Override
51 protected String handleGetImplementationName()
52 {
53 final String implNamePattern =
54 String.valueOf(this.getConfiguredProperty(HibernateGlobals.EMBEDDED_VALUE_IMPLEMENTATION_NAME_PATTERN));
55 return MessageFormat.format(
56 implNamePattern,
57 StringUtils.trimToEmpty(this.getName()));
58 }
59
60
61
62
63
64 protected String handleGetEntityName()
65 {
66 final String entityNamePattern = (String)this.getConfiguredProperty(HibernateGlobals.ENTITY_NAME_PATTERN);
67 return MessageFormat.format(
68 entityNamePattern,
69 StringUtils.trimToEmpty(this.getName()));
70 }
71
72
73
74
75
76
77
78 protected String handleGetFullyQualifiedEntityName()
79 {
80 return HibernateMetafacadeUtils.getFullyQualifiedName(
81 this.getPackageName(),
82 this.getName(),
83 null);
84 }
85
86
87
88
89
90 protected Collection handleGetBusinessOperations()
91 {
92 return HibernateMetafacadeUtils.filterBusinessOperations(this.getOperations());
93 }
94 }