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