1 package org.andromda.metafacades.uml14;
2
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import org.apache.commons.lang.StringUtils;
6 import org.omg.uml.foundation.core.TagDefinition;
7 import org.omg.uml.foundation.core.TaggedValue;
8
9
10
11
12
13 public class TaggedValueFacadeLogicImpl
14 extends TaggedValueFacadeLogic
15 {
16 private static final long serialVersionUID = -2281273076847314771L;
17
18
19
20
21
22 public TaggedValueFacadeLogicImpl(TaggedValue metaObject, String context)
23 {
24 super(metaObject, context);
25 }
26
27
28
29
30 public String handleGetName()
31 {
32 String name = super.handleGetName();
33 if (StringUtils.isEmpty(name))
34 {
35 final TagDefinition type = this.metaObject.getType();
36 if (type != null)
37 {
38 name = type.getName();
39
40 if (StringUtils.isEmpty(name))
41 {
42 name = type.getTagType();
43 }
44 }
45 }
46 return name;
47 }
48
49
50
51
52 @Override
53 public Collection handleGetValues()
54 {
55 final Collection values = new ArrayList();
56 values.addAll(metaObject.getDataValue());
57 values.addAll(this.shieldedElements(metaObject.getReferenceValue()));
58 return values;
59 }
60
61
62
63
64 @Override
65 public Object handleGetValue()
66 {
67 final Collection values = this.getValues();
68 return (values.isEmpty()) ? null : values.iterator().next();
69 }
70
71 }