KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > metadata > SpeedoJoin


1 /**
2  * Copyright (C) 2001-2005 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.objectweb.speedo.metadata;
19
20 import java.util.ArrayList JavaDoc;
21 import java.util.List JavaDoc;
22
23
24 /**
25  *
26  *
27  * @author S.Chassande-Barrioz
28  */

29 public class SpeedoJoin extends SpeedoElement {
30     /**
31      * Is the name of table
32      */

33     public String JavaDoc table;
34     
35     /**
36      * The list of SpeedoColumn composing the join
37      */

38     public List JavaDoc columns = new ArrayList JavaDoc();
39     
40     private final static byte ALL = (byte) 0xFF;
41     private final static byte INDEXED = 1;
42     private final static byte OUTER_JOIN = 2;
43     private final static byte UNIQUE = 4;
44     private byte conditions = 0;
45     
46     public final static byte ACTION_NONE = 1;
47     public final static byte ACTION_NULL = 2;
48     public final static byte ACTION_CASCADE = 3;
49     public final static byte ACTION_RESTRICT = 4;
50     public final static byte ACTION_DEFAULT = 5;
51     
52     public byte deleteAction = ACTION_NONE;
53
54     public void setOuter(boolean v) {
55         setCondition(v, OUTER_JOIN);
56     }
57     public boolean getOuter() {
58         return getCondition(OUTER_JOIN);
59     }
60     
61     public void setIndexed(boolean v) {
62         setCondition(v, INDEXED);
63     }
64     public boolean getIndexed() {
65         return getCondition(INDEXED);
66     }
67     
68     public void setUnique(boolean v) {
69         setCondition(v, UNIQUE);
70     }
71     public boolean getUnique() {
72         return getCondition(UNIQUE);
73     }
74     
75     private void setCondition(boolean v, byte condition) {
76         if (v) {
77             conditions = (byte) (conditions | condition);
78         } else {
79             conditions = (byte) (conditions & (ALL - condition));
80         }
81     }
82     private boolean getCondition(byte condition) {
83         return (conditions & condition) == 1;
84     }
85 }
86
Popular Tags