1 package org.andromda.cartridges.ejb.metafacades;
2
3 import java.util.Collection;
4 import org.andromda.cartridges.ejb.EJBProfile;
5 import org.andromda.metafacades.uml.AttributeFacade;
6
7
8
9
10 public class EJBPrimaryKeyFacadeLogicImpl
11 extends EJBPrimaryKeyFacadeLogic
12 {
13 private static final long serialVersionUID = 34L;
14
15
16
17
18
19
20 public EJBPrimaryKeyFacadeLogicImpl(Object metaObject, String context)
21 {
22 super(metaObject, context);
23 }
24
25
26
27
28 protected boolean handleIsComplex()
29 {
30 return getSimplePkField() == null;
31 }
32
33
34
35
36
37
38
39
40 private AttributeFacade getSimplePkField()
41 {
42 AttributeFacade primaryKey = null;
43 Collection primaryKeys = ((EJBEntityFacade)this.getOwner()).getIdentifiers();
44 if (primaryKeys.size() == 1)
45 {
46 AttributeFacade pkField = (AttributeFacade)primaryKeys.iterator().next();
47 if (pkField.hasStereotype(EJBProfile.STEREOTYPE_IDENTIFIER))
48 {
49 primaryKey = pkField;
50 }
51 }
52 return primaryKey;
53 }
54
55
56
57 }