View Javadoc
1   package org.andromda.metafacades.uml14;
2   
3   import org.andromda.metafacades.uml.Entity;
4   import org.andromda.metafacades.uml.UMLMetafacadeProperties;
5   import org.apache.commons.lang.StringUtils;
6   
7   /**
8    * MetafacadeLogic implementation for org.andromda.metafacades.uml.ManageableEntityAttribute.
9    *
10   * @see org.andromda.metafacades.uml.ManageableEntityAttribute
11   * @author Bob Fields
12   */
13  public class ManageableEntityAttributeLogicImpl
14      extends ManageableEntityAttributeLogic
15  {
16      private static final long serialVersionUID = 34L;
17      /**
18       * @param metaObject
19       * @param context
20       */
21      public ManageableEntityAttributeLogicImpl(
22          Object metaObject,
23          String context)
24      {
25          super(metaObject, context);
26      }
27  
28      /**
29       * @see org.andromda.metafacades.uml.ManageableEntityAttribute#isDisplay()
30       */
31      @Override
32      protected boolean handleIsDisplay()
33      {
34          boolean display = true;
35  
36          // only identifiers might be hidden
37          if (this.isIdentifier())
38          {
39              final String displayStrategy =
40                  StringUtils.trimToNull(
41                      (String)this.getConfiguredProperty(UMLMetafacadeProperties.MANAGEABLE_ID_DISPLAY_STRATEGY));
42  
43              // never display identifiers
44              if ("never".equalsIgnoreCase(displayStrategy))
45              {
46                  display = false;
47              }
48  
49              // always display identifiers
50              else if ("always".equalsIgnoreCase(displayStrategy))
51              {
52                  display = true;
53              }
54  
55              // only display identifiers when explicitly modeled
56              else // if ("auto".equalsIgnoreCase(displayStrategy))
57              {
58                  display = ((Entity)this.getOwner()).isUsingAssignedIdentifier();
59              }
60          }
61  
62          return display;
63      }
64  
65      /**
66       * @see org.andromda.metafacades.uml.ManageableEntityAttribute#isManageableGetterAvailable()
67       */
68      @Override
69      protected boolean handleIsManageableGetterAvailable()
70      {
71          return this.getType() != null && this.getType().isBlobType();
72      }
73  }