~ubuntu-branches/ubuntu/wily/libhibernate3-java/wily-proposed

« back to all changes in this revision

Viewing changes to src/org/hibernate/type/ForeignKeyDirection.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-10-14 14:43:34 UTC
  • Revision ID: james.westby@ubuntu.com-20071014144334-eamc8i0q10gs1aro
Tags: upstream-3.2.5
ImportĀ upstreamĀ versionĀ 3.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//$Id: ForeignKeyDirection.java 7019 2005-06-05 05:09:58Z oneovthafew $
 
2
package org.hibernate.type;
 
3
 
 
4
import java.io.Serializable;
 
5
 
 
6
import org.hibernate.engine.Cascade;
 
7
 
 
8
/**
 
9
 * Represents directionality of the foreign key constraint
 
10
 * @author Gavin King
 
11
 */
 
12
public abstract class ForeignKeyDirection implements Serializable {
 
13
        protected ForeignKeyDirection() {}
 
14
        /**
 
15
         * Should we cascade at this cascade point?
 
16
         * @see org.hibernate.engine.Cascade
 
17
         */
 
18
        public abstract boolean cascadeNow(int cascadePoint);
 
19
 
 
20
        /**
 
21
         * A foreign key from child to parent
 
22
         */
 
23
        public static final ForeignKeyDirection FOREIGN_KEY_TO_PARENT = new ForeignKeyDirection() {
 
24
                public boolean cascadeNow(int cascadePoint) {
 
25
                        return cascadePoint!=Cascade.BEFORE_INSERT_AFTER_DELETE;
 
26
                }
 
27
 
 
28
                public String toString() {
 
29
                        return "toParent";
 
30
                }
 
31
                
 
32
                Object readResolve() {
 
33
                        return FOREIGN_KEY_TO_PARENT;
 
34
                }
 
35
        };
 
36
        /**
 
37
         * A foreign key from parent to child
 
38
         */
 
39
        public static final ForeignKeyDirection FOREIGN_KEY_FROM_PARENT = new ForeignKeyDirection() {
 
40
                public boolean cascadeNow(int cascadePoint) {
 
41
                        return cascadePoint!=Cascade.AFTER_INSERT_BEFORE_DELETE;
 
42
                }
 
43
 
 
44
                public String toString() {
 
45
                        return "fromParent";
 
46
                }
 
47
                
 
48
                Object readResolve() {
 
49
                        return FOREIGN_KEY_FROM_PARENT;
 
50
                }
 
51
        };
 
52
}
 
 
b'\\ No newline at end of file'