1 package org.andromda.metafacades.uml14;
2
3 import java.util.Collection;
4 import org.apache.commons.lang.StringUtils;
5 import org.omg.uml.foundation.core.Dependency;
6
7
8
9
10
11 public class DependencyFacadeLogicImpl
12 extends DependencyFacadeLogic
13 {
14 private static final long serialVersionUID = 34L;
15
16
17
18
19 public DependencyFacadeLogicImpl(Dependency metaObject, String context)
20 {
21 super(metaObject, context);
22 }
23
24
25
26
27
28
29
30
31 @Override
32 public String handleGetName()
33 {
34 String name = super.handleGetName();
35 if (StringUtils.isBlank(name) && this.getTargetElement() != null)
36 {
37 name = StringUtils.uncapitalize(this.getTargetElement().getName());
38 }
39 return name;
40 }
41
42
43
44
45 @Override
46 public String handleGetGetterName()
47 {
48 return "get" + StringUtils.capitalize(this.getName());
49 }
50
51
52
53
54 @Override
55 public String handleGetSetterName()
56 {
57 return "set" + StringUtils.capitalize(this.getName());
58 }
59
60
61
62
63 @Override
64 public Object handleGetTargetElement()
65 {
66 Object targetElement = null;
67 Collection suppliers = UML14MetafacadeUtils.getCorePackage().getASupplierSupplierDependency().getSupplier(
68 this.metaObject);
69 if (!suppliers.isEmpty())
70 {
71 targetElement = suppliers.iterator().next();
72 }
73 return targetElement;
74 }
75
76
77
78
79 @Override
80 protected Object handleGetSourceElement()
81 {
82 Object sourceElement = null;
83 Collection clients = UML14MetafacadeUtils.getCorePackage().getAClientClientDependency().getClient(
84 this.metaObject);
85 if (!clients.isEmpty())
86 {
87 sourceElement = clients.iterator().next();
88 }
89 return sourceElement;
90 }
91
92 }