1 package com.bonevich.erj.model;
2
3 import java.util.Iterator;
4
5 /*** A class that represents ...
6 *
7 * @see Relation
8 * @author Jeffrey D. Bonevich <bonevich@telocity.com>
9 */
10 public final class PrimaryKey extends UniqueKey
11 {
12 //////////////////////////////////////////////////////////
13 // Constants
14 public static final String NEW_PRIMARYKEY_STR = "pk_";
15
16 //////////////////////////////////////////////////////////
17 // Constructors
18 public PrimaryKey(Relation relation, Attribute[] attributes)
19 {
20 super(relation, attributes);
21 setAttributesNotNull();
22 setIdentifier(NEW_PRIMARYKEY_STR + relation.getKeyCount());
23 }
24
25 //////////////////////////////////////////////////////////
26 // Operations
27 private void setAttributesNotNull()
28 {
29 for (Iterator itr = getAttributeIterator(); itr.hasNext(); )
30 {
31 ( (Attribute)itr.next() ).setConstraint(AttributeConstraint.NOTNULL);
32 }
33 }
34
35 public void accept(KeyVisitor visitor)
36 {
37 visitor.visitPrimaryKey(this);
38 }
39
40 } /* end class PrimaryKey */
This page was automatically generated by Maven