KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > ipanema > config > ConfigModuleSimpleFieldMetaData


1 /*
2  * Created on Apr 22, 2005
3  * by alex
4  *
5  */

6 package com.nightlabs.ipanema.config;
7
8 import java.io.Serializable JavaDoc;
9
10 import com.nightlabs.inheritance.FieldMetaData;
11 import com.nightlabs.inheritance.NotWritableException;
12
13 /**
14  * @author Alexander Bieber <alex[AT]nightlabs[DOT]de>
15  *
16  * @jdo.persistence-capable
17  * identity-type = "application"
18  * objectid-class = "com.nightlabs.ipanema.config.id.ConfigModuleSimpleFieldMetaDataID"
19  * detachable = "true"
20  */

21 public class ConfigModuleSimpleFieldMetaData
22 implements FieldMetaData, Serializable JavaDoc
23 {
24
25     /**
26      *
27      */

28     protected ConfigModuleSimpleFieldMetaData() {
29         super();
30     }
31     
32     public ConfigModuleSimpleFieldMetaData(ConfigModule configModule, String JavaDoc fieldName) {
33         this.configModule = configModule;
34         this.organisationID = configModule.getOrganisationID();
35         this.userConfigID = configModule.getConfigID();
36         this.cfModKey = configModule.getCfModKey();
37         this.fieldName = fieldName;
38     }
39     
40     /**
41      * @jdo.field primary-key="true"
42      * @jdo.column length="100"
43      */

44     private String JavaDoc organisationID;
45
46     /**
47      * @jdo.field primary-key="true"
48      * @jdo.column length="100"
49      */

50     private String JavaDoc userConfigID;
51     
52     /**
53      * @jdo.field primary-key="true"
54      * @jdo.column length="150"
55      */

56     private String JavaDoc cfModKey;
57     
58     /**
59      * @jdo.field primary-key="true"
60      * @jdo.column length="100"
61      */

62     private String JavaDoc fieldName;
63     
64     /**
65      * @jdo.field persistence-modifier="persistent"
66      */

67     private ConfigModule configModule;
68
69     /**
70      * @see com.nightlabs.inheritance.FieldMetaData#getFieldName()
71      */

72     public String JavaDoc getFieldName() {
73         return fieldName;
74     }
75
76     /**
77      * @see com.nightlabs.inheritance.FieldMetaData#getWritableByChildren()
78      */

79     public byte getWritableByChildren() {
80         if (configModule.isAllowUserOverride())
81             return WRITABLEBYCHILDREN_YES;
82         else
83             return WRITABLEBYCHILDREN_NO;
84     }
85
86     /**
87      * @jdo.field persistence-modifier="persistent"
88      */

89     private byte writableByChildren = WRITABLEBYCHILDREN_YES;
90     
91     /**
92      * @see com.nightlabs.inheritance.FieldMetaData#setWritableByChildren(byte)
93      */

94     public void setWritableByChildren(byte writableByChildren) {
95         this.writableByChildren = writableByChildren;
96     }
97
98     /**
99      * @see com.nightlabs.inheritance.FieldMetaData#isWritable()
100      */

101     public boolean isWritable() {
102         return writable;
103     }
104     
105     /**
106      * @jdo.field persistence-modifier="persistent"
107      */

108     private boolean writable = true;
109
110     /**
111      * @see com.nightlabs.inheritance.FieldMetaData#assertWritable()
112      */

113     public void assertWritable() throws NotWritableException {
114         if (!isWritable())
115             throw new NotWritableException("Field "+fieldName+" of "+configModule.getClass().getName()+" is not writable.");
116     }
117
118     /**
119      * @see com.nightlabs.inheritance.FieldMetaData#setWritable(boolean)
120      */

121     public void setWritable(boolean writable) {
122         this.writable = writable;
123     }
124
125     /**
126      * @jdo.field persistence-modifier="persistent"
127      */

128     private boolean valueInherited = true;
129     
130     /**
131      * @see com.nightlabs.inheritance.FieldMetaData#isValueInherited()
132      */

133     public boolean isValueInherited() {
134         return valueInherited;
135     }
136
137     /**
138      * @see com.nightlabs.inheritance.FieldMetaData#setValueInherited(boolean)
139      */

140     public void setValueInherited(boolean valueInherited) {
141         this.valueInherited = valueInherited;
142     }
143
144 }
145
Popular Tags