View Javadoc

1   package org.andromda.cartridges.bpm4struts.metafacades;
2   
3   import org.andromda.utils.StringUtilsHelper;
4   import org.andromda.metafacades.uml.ClassifierFacade;
5   import org.andromda.metafacades.uml.Entity;
6   import org.andromda.metafacades.uml.ManageableEntity;
7   import org.andromda.cartridges.bpm4struts.Bpm4StrutsUtils;
8   
9   
10  /**
11   * MetafacadeLogic implementation for org.andromda.cartridges.bpm4struts.metafacades.StrutsManageableEntityAssociationEnd.
12   *
13   * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsManageableEntityAssociationEnd
14   */
15  public class StrutsManageableEntityAssociationEndLogicImpl
16      extends StrutsManageableEntityAssociationEndLogic
17  {
18      public StrutsManageableEntityAssociationEndLogicImpl(
19          Object metaObject,
20          String context)
21      {
22          super(metaObject, context);
23      }
24  
25      /**
26       * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsManageableEntityAssociationEnd#getMessageKey()
27       */
28      protected java.lang.String handleGetMessageKey()
29      {
30          final StringBuffer messageKeyBuffer = new StringBuffer();
31  
32          final ClassifierFacade ownerType = this.getOtherEnd().getType();
33          if (ownerType instanceof ManageableEntity)
34          {
35              messageKeyBuffer.append(ownerType.getName());
36          }
37          else
38          {
39              messageKeyBuffer.append(ownerType.getName());
40          }
41  
42          messageKeyBuffer.append('.');
43          messageKeyBuffer.append(this.getName());
44  
45          return StringUtilsHelper.toResourceMessageKey(messageKeyBuffer.toString());
46      }
47  
48      /**
49       * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsManageableEntityAssociationEnd#getMessageValue()
50       */
51      protected java.lang.String handleGetMessageValue()
52      {
53          String messageValue = null;
54  
55          final ClassifierFacade type = this.getType();
56          if (type instanceof Entity)
57          {
58              messageValue = this.getName();
59          }
60  
61          return StringUtilsHelper.toPhrase(messageValue);
62      }
63  
64      protected boolean handleIsSafeNamePresent()
65      {
66          return Bpm4StrutsUtils.isSafeName(this.getName());
67      }
68  
69      protected String handleGetOnlineHelpKey()
70      {
71          return this.getMessageKey() + ".online.help";
72      }
73  
74      protected String handleGetOnlineHelpValue()
75      {
76          final String value = StringUtilsHelper.toResourceMessage(this.getDocumentation("", 64, false));
77          return (value == null) ? "No field documentation has been specified" : value;
78      }
79  }