View Javadoc
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   * 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
17      extends HibernateEmbeddedValueLogic
18  {
19      private static final long serialVersionUID = 34L;
20      // ---------------- constructor -------------------------------
21      /**
22       * @param metaObject
23       * @param context
24       */
25      public HibernateEmbeddedValueLogicImpl(
26          Object metaObject,
27          String context)
28      {
29          super(metaObject, context);
30      }
31  
32      /**
33       * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue#isImmutable()
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       * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue#getImplementationName()
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       * @return formatted Entity Name
62       * @see org.andromda.cartridges.hibernate.metafacades.HibernateEntity#getEntityName()
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       * analogy of HibernateEntityLogicImpl
74       * @return getFullyQualifiedName
75       *
76       * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue
77       */
78      protected String handleGetFullyQualifiedEntityName()
79      {
80          return HibernateMetafacadeUtils.getFullyQualifiedName(
81              this.getPackageName(),
82              this.getName(),
83              null);
84      }
85  
86      /**
87       * see HibernateEntityLogicImpl
88       * @return filterBusinessOperations(this.getOperations())
89       */
90      protected Collection handleGetBusinessOperations()
91      {
92          return HibernateMetafacadeUtils.filterBusinessOperations(this.getOperations());
93      }
94  }