1 package org.devaki.nextobjects.workspace.models.objects;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import java.io.Serializable;
22 import org.devaki.nextobjects.workspace.models.ConceptualModel;
23 import org.devaki.nextobjects.workspace.models.graphics.AssociationLinkView;
24 import org.devaki.nextobjects.workspace.models.graphics.ObjectView;
25 /***
26 * This class describe an association link
27 * @author <a href="mailto:eflorent@devaki.org">Emmanuel Florent</a>
28 */
29 public class AssociationLink extends BaseLine implements Serializable
30 {
31 /***
32 * the AssociationLinkView
33 */
34 private AssociationLinkView associationLinkView;
35 /***
36 * the cardinalities
37 */
38 private int card = ConceptualModel.ASSO_0N;
39 /***
40 * Create a new 'AssociationLink' object while dragging
41 * @param pAssociation the new association
42 * @param pEntity the linked entity
43 * @param pCard the cardinality of the relation
44 */
45 public AssociationLink(
46 final Association pAssociation,
47 final Entity pEntity,
48 final int pCard)
49 {
50 super(pAssociation.getMyModel());
51 this.setChildClass(pEntity);
52 this.setParentClass(pAssociation);
53 this.card = pCard;
54
55 this.setName(
56 new StringBuffer()
57 .append("Association Link ")
58 .append(
59 ((ConceptualModel) pEntity.getMyModel())
60 .countAssociationLinks())
61 .toString());
62
63 this.associationLinkView = new AssociationLinkView(this);
64 }
65 /***
66 * Clone an 'AssociationLink' object
67 * @param pObject the association link to clone
68 */
69 public AssociationLink(final AssociationLink pObject)
70 {
71 super(pObject);
72 this.card = pObject.getCard();
73 this.associationLinkView = new AssociationLinkView(this);
74 }
75 /***
76 * Get the cardinality
77 * @return the cardianlity of the half association.
78 */
79 public final int getCard()
80 {
81 return this.card;
82 }
83 /***
84 * Set the cardinality
85 * @param pCard the cardinality
86 */
87 public final void setCard(final int pCard)
88 {
89 this.card = pCard;
90 }
91 /***
92 * get the associationLinkView
93 * @return associationLinkView
94 */
95 public final ObjectView getObjectView()
96 {
97 return associationLinkView;
98 }
99 }