KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jaspersoft > jasperserver > api > metadata > common > service > impl > hibernate > persistent > RepoDataType


1 /*
2  * Copyright (C) 2006 JasperSoft http://www.jaspersoft.com
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed WITHOUT ANY WARRANTY; and without the
10  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
15  * or write to:
16  *
17  * Free Software Foundation, Inc.,
18  * 59 Temple Place - Suite 330,
19  * Boston, MA USA 02111-1307
20  */

21 package com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent;
22
23 import com.jaspersoft.jasperserver.api.metadata.common.domain.DataType;
24 import com.jaspersoft.jasperserver.api.metadata.common.domain.Resource;
25 import com.jaspersoft.jasperserver.api.metadata.common.service.ResourceFactory;
26 import com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.PersistentObjectResolver;
27 import com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.ReferenceResolver;
28
29
30 /**
31  * @author Teodor Danciu (teodord@users.sourceforge.net)
32  * @version $Id: RepoFont.java 2343 2006-03-10 14:54:32Z lucian $
33  *
34  * @hibernate.joined-subclass table="DataType"
35  * @hibernate.joined-subclass-key column="id"
36  */

37 public class RepoDataType extends RepoResource
38 {
39
40     /**
41      *
42      */

43     private byte type = DataType.TYPE_TEXT;
44     private Integer JavaDoc maxLength = null;
45     private Integer JavaDoc decimals = null;
46     private String JavaDoc regularExpr = null;
47     private Comparable JavaDoc minValue = null;
48     private Comparable JavaDoc maxValue = null;
49     private boolean isStrictMin = false;
50     private boolean isStrictMax = false;
51
52
53     /**
54      * @hibernate.property
55      */

56     public byte getType()
57     {
58         return type;
59     }
60
61     /**
62      *
63      */

64     public void setType(byte type)
65     {
66         this.type = type;
67     }
68
69     /**
70      * @hibernate.property
71      */

72     public Integer JavaDoc getMaxLength()
73     {
74         return maxLength;
75     }
76
77     /**
78      *
79      */

80     public void setMaxLength(Integer JavaDoc maxLength)
81     {
82         this.maxLength = maxLength;
83     }
84
85     /**
86      * @hibernate.property
87      */

88     public Integer JavaDoc getDecimals()
89     {
90         return decimals;
91     }
92
93     /**
94      *
95      */

96     public void setDecimals(Integer JavaDoc decimals)
97     {
98         this.decimals = decimals;
99     }
100
101     /**
102      * @hibernate.property
103      */

104     public String JavaDoc getRegularExpr()
105     {
106         return regularExpr;
107     }
108
109     /**
110      *
111      */

112     public void setRegularExpr(String JavaDoc regularExpr)
113     {
114         this.regularExpr = regularExpr;
115     }
116
117     /**
118      * @hibernate.property type="serializable"
119      */

120     public Comparable JavaDoc getMinValue()
121     {
122         return minValue;
123     }
124
125     /**
126      *
127      */

128     public void setMinValue(Comparable JavaDoc min)
129     {
130         this.minValue = min;
131     }
132
133     /**
134      * @hibernate.property type="serializable"
135      */

136     public Comparable JavaDoc getMaxValue()
137     {
138         return maxValue;
139     }
140
141     /**
142      *
143      */

144     public void setMaxValue(Comparable JavaDoc max)
145     {
146         this.maxValue = max;
147     }
148
149     /**
150      * @hibernate.property
151      */

152     public boolean isStrictMin()
153     {
154         return isStrictMin;
155     }
156
157     /**
158      *
159      */

160     public void setStrictMin(boolean isStrictMin)
161     {
162         this.isStrictMin = isStrictMin;
163     }
164
165     /**
166      * @hibernate.property
167      */

168     public boolean isStrictMax()
169     {
170         return isStrictMax;
171     }
172
173     /**
174      *
175      */

176     public void setStrictMax(boolean isStrictMax)
177     {
178         this.isStrictMax = isStrictMax;
179     }
180
181     /**
182      *
183      */

184     protected void copyFrom(Resource clientRes, ReferenceResolver referenceResolver)
185     {
186         super.copyFrom(clientRes, referenceResolver);
187         
188         DataType dataType = (DataType) clientRes;
189         
190         setType(dataType.getType());
191         setMaxLength(dataType.getMaxLength());
192         setDecimals(dataType.getDecimals());
193         setRegularExpr(dataType.getRegularExpr());
194         setMinValue(dataType.getMinValue());
195         setMaxValue(dataType.getMaxValue());
196         setStrictMin(dataType.isStrictMin());
197         setStrictMax(dataType.isStrictMax());
198     }
199
200     protected Class JavaDoc getClientItf() {
201         return DataType.class;
202     }
203
204     protected void copyTo(Resource clientRes, ResourceFactory resourceFactory)
205     {
206         super.copyTo(clientRes, resourceFactory);
207
208         DataType dataType = (DataType) clientRes;
209         dataType.setType(getType());
210         dataType.setMaxLength(getMaxLength());
211         dataType.setDecimals(getDecimals());
212         dataType.setRegularExpr(getRegularExpr());
213         dataType.setMinValue(getMinValue());
214         dataType.setMaxValue(getMaxValue());
215         dataType.setStrictMin(isStrictMin());
216         dataType.setStrictMax(isStrictMax());
217     }
218
219 }
220
Popular Tags