1 package org.andromda.cartridges.hibernate.metafacades;
2
3 import org.apache.commons.lang.ObjectUtils;
4 import org.apache.commons.lang.StringUtils;
5
6
7
8
9
10
11
12 public class HibernateServiceLogicImpl
13 extends HibernateServiceLogic
14 {
15 private static final long serialVersionUID = 34L;
16
17
18
19
20 public HibernateServiceLogicImpl(
21 Object metaObject,
22 String context)
23 {
24 super(metaObject, context);
25 }
26
27
28
29
30 @Override
31 protected String handleGetEjbJndiName()
32 {
33 StringBuilder jndiName = new StringBuilder();
34 String jndiNamePrefix = StringUtils.trimToEmpty(this.getEjbJndiNamePrefix());
35 if (StringUtils.isNotBlank(jndiNamePrefix))
36 {
37 jndiName.append(jndiNamePrefix);
38 jndiName.append('/');
39 }
40 jndiName.append("ejb/");
41 jndiName.append(this.getFullyQualifiedName());
42 return jndiName.toString();
43 }
44
45
46
47
48 @Override
49 protected String handleGetEjbViewType()
50 {
51 String defaultViewType = String.valueOf(this.getConfiguredProperty("ejbViewType"));
52 return HibernateMetafacadeUtils.getViewType(this, defaultViewType);
53 }
54
55
56
57
58
59
60 protected String getEjbJndiNamePrefix()
61 {
62 final String property = "ejbJndiNamePrefix";
63 return this.isConfiguredProperty(property) ? ObjectUtils.toString(this.getConfiguredProperty(property)) : null;
64 }
65
66
67
68
69 @Override
70 protected boolean handleIsEjbStateful()
71 {
72 return !this.getAttributes().isEmpty();
73 }
74
75
76
77
78 private static final String VIEW_TYPE_REMOTE = "remote";
79
80
81
82
83 @Override
84 protected boolean handleIsEjbRemoteView()
85 {
86 return this.getEjbViewType().equalsIgnoreCase(VIEW_TYPE_REMOTE);
87 }
88 }