Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/flexstor/ejb/field/persist/ServerFieldExtendData.java


1   /*
2    * ServerFieldExtendData.java
3    *
4    * Copyright $Date: 2003/08/11 02:22:48 $ FLEXSTOR.net Inc.
5    *
6    * This work is licensed for use and distribution under license terms found at
7    * http://www.flexstor.org/license.html
8    *
9    */
10  
11  package com.flexstor.ejb.field.persist;
12  
13  import java.util.Vector;
14  
15  import com.flexstor.common.data.ejb.Data;
16  import com.flexstor.common.data.ejb.field.FieldData;
17  import com.flexstor.common.data.ejb.property.PropertyData;
18  
19  /**
20   * This is the client data object for state information
21   * pertaining to a ServerFieldExtend.
22   *
23   *
24   * @author Daniel J. Nickel 2/10/99
25   * @version $Id: ServerFieldExtendData.java,v 1.3 2003/08/11 02:22:48 aleric Exp $
26   * @since FlexDB 3.0
27   * @see com.flexstor.ejb.dataobject.Data
28   * @see com.flexstor.ejb.dataobject.LookupData
29   */
30  
31  public class ServerFieldExtendData 
32      extends Data
33  {
34      public static final String IDENTIFIER="$Id: ServerFieldExtendData.java,v 1.3 2003/08/11 02:22:48 aleric Exp $";
35      
36      /**
37       * Identifier of the field
38       *
39       * @since FlexDB 3.0
40       */
41      protected int id = -1;
42  
43      /**
44       * What did the client name this field
45       *
46       * @since FlexDB 3.0
47       * @see java.util.String
48       */
49      protected String label = null;
50  
51      /**
52       * Position of this field
53       *
54       * @since FlexDB 3.0
55       * @see java.util.String
56       */
57      protected int position;
58  
59  
60      /**
61       * length of field
62       *
63       * @since FlexDB 3.0
64       */
65      protected int length;
66    
67      /**
68       * The field name reference for this object
69       *
70       * @since FlexDB 3.0
71       */
72      protected String fieldName = null;
73  
74      /**
75       * The Data Type
76       *
77       * @since FlexDB 3.0
78       * @see java.util.Vector
79       */
80      protected int dataType;
81  
82      /**
83       *  Defines wether this field is a lookup field or not
84       */
85      protected boolean bIsLookup;
86     
87      /**
88      * System Required Field
89      *
90      */
91      protected boolean systemRequired = false;
92      
93      /**
94      * Case of field
95      */
96      protected int fieldCase;
97      
98      /**
99      * Source of field
100     */
101     protected String source = null;
102     
103     /**
104      * Properties set for this field 
105      */
106     protected Vector vProperties;
107     
108     /**
109      * Will get the Id of the field
110      *
111      * @return int
112      * @since FlexDB 3.0
113      */
114 
115     public int getId()
116     {
117         return id;
118     }
119 
120     /**
121      * Will set the Id of the field
122      *
123      * @param int
124      * @since FlexDB 3.0
125      */
126 
127     public void setId( int id )
128     {
129         this.id = id;
130     }
131 
132     /**
133      * Will get the Label of the field
134      *
135      * @return java.lang.String
136      * @since FlexDB 3.0
137      * @see java.lang.String
138      */
139 
140     public String getLabel()
141     {
142         return label;
143     }
144 
145     /**
146      * Will set the Label of the field
147      *
148      * @param java.lang.String - label
149      * @since FlexDB 3.0
150      */
151 
152     public void setLabel( String label )
153     {
154         this.label = label;
155     }
156 
157     /**
158      * Get the position of this field.
159      *
160      * @return java.lang.String
161      * @since FlexDB 3.0
162      * @see java.lang.String
163      */
164 
165     public int getPosition()
166     {
167         return position;
168     }
169 
170     /**
171      * Set the position of this field.
172      *
173      * @since FlexDB 3.0
174      */
175 
176     public void setPosition( int pos )
177     {
178         position = pos;
179     }
180 
181 
182     /**
183      * Will get the Name of the field
184      *
185      * @return java.lang.String
186      * @since FlexDB 3.0
187      * @see java.lang.String
188      */
189 
190     public String getFieldName()
191     {
192         return fieldName;
193     }
194 
195     /**
196      * Will set the Name of the field
197      *
198      * @since FlexDB 3.0
199      * @see java.lang.String
200      */
201 
202     public void setFieldName(String name)
203     {
204         fieldName = name;
205     }
206 
207     /**
208      * Get the source of this field.
209      *
210      * @return java.lang.String
211      * @since FlexDB 3.0
212      * @see java.lang.String
213      */
214 
215     public String getSource()
216     {
217         return source;
218     }
219 
220     /**
221      * Will set the Source
222      *
223      * @return boolean
224      * @since FlexDB 3.0
225      * @see java.lang.String
226      */
227 
228     public void setSource(String sS)
229     {
230         source = sS;
231     }
232 
233     /**
234      * Get Length of the field. 
235      *
236      * @return int - length
237      * @since FlexDB 3.0
238      */
239 
240     public int getLength()
241     {
242         return length;
243     }
244 
245     /**
246      * Set Length of the field
247      * Should use one of the field statics in
248      * the Data Class
249      *
250      * @since FlexDB 3.0
251      * @see com.flexstor.ejb.dataobject.FieldData
252      */
253 
254     public void setLength(int len)
255     {
256         length = len;
257     }
258 
259 
260     /**
261      * Returns Field Type. See the static 
262      * field types in this document for explanation.
263      *
264      * @return int
265      * @since FlexDB 3.0
266      */
267 
268     public int getDataType()
269     {
270         return dataType;
271     }
272 
273     /**
274      * Set Field Type - Use the Field Constants
275      * in Data Class
276      *
277      * @since FlexDB 3.0
278      * @see com.flexstor.ejb.dataobject.FieldData
279      */
280 
281     public void setDataType(int type)
282     {
283         dataType = type;
284     }
285 
286     /**
287      * Set Field Type - Valid Strings:<br>
288      * DATETIME, NUMBER, STRING or UNKNOWN
289      *
290      * @since FlexDB 3.0
291      * @see com.flexstor.ejb.dataobject.FieldData
292      */
293 
294     public void setDataType(String type)
295     {
296         int iType = FieldData.FIELD_TYPE_UNDEFINED;
297 
298         if ( type.equalsIgnoreCase( "DATETIME" ) )
299             iType = FieldData.FIELD_TYPE_DATE;
300          else
301             if ( type.equalsIgnoreCase( "NUMBER" ) )
302                 iType = FieldData.FIELD_TYPE_NUMBER;
303               else
304                 if ( type.equalsIgnoreCase( "STRING" ) )
305                     iType = FieldData.FIELD_TYPE_NUMBER;
306 
307         dataType = iType;
308     }
309 
310     /**
311      * This will return the case of the field. 
312      * See the static definitions in this document
313      * for explanation.
314      *
315      * @return int - the case of the field
316      * @since FlexDB 3.0
317      */
318 
319     public int getFieldCase()
320     {
321         return fieldCase;
322     }
323 
324     /**
325      * Set case of the field. Use the constants from Data Class.
326      *
327      * @since FlexDB 3.0
328      * @see com.flexstor.ejb.dataobject.FieldData
329      */
330 
331     public void setFieldCase(int iCase)
332     {
333         fieldCase = iCase;
334     }
335 
336     /**
337      * Is this a System Required field.
338      *
339      * @return True - System Required<br>False - Not System Required Field
340      * @since FlexDB 3.0
341      */
342 
343     public boolean isSystemRequired()
344     {
345         return systemRequired;
346     }
347 
348     /**
349      * Set System Required Field to true
350      *
351      * @since FlexDB 3.0
352      */
353 
354     public void setSystemRequired(String s)
355     {
356         if ((s.toLowerCase().getBytes())[0] == 'y')
357             systemRequired = true;
358         else
359             systemRequired = false;
360 
361     }
362 
363    /**
364     * Defines if this field is a lookup field or not.
365     * This value is extracted from the LookupData object 
366     * stored in the FieldData.
367     */
368    public void setIsLookup( boolean bValue )
369    {
370       this.bIsLookup = bValue;
371    }
372    
373    /**
374     * Returns true if this is a lookup field
375     */
376    public boolean isLookup() 
377    {
378       return bIsLookup;
379    }
380 
381    /**
382     * Add properties to this object.
383     */
384    public void setProperties( Vector vProps )
385    {
386       if ( vProps != null )
387          vProperties = (Vector) vProps.clone();
388    }
389    
390    /**
391     * Return the value for the property specified; if not found, return null
392     */
393    public String getProperty( String sKey )
394    {
395       if ( vProperties != null )
396       {
397          PropertyData prop;
398          for ( int i = 0; i < vProperties.size(); i++ )
399          {
400             prop = (PropertyData) vProperties.elementAt(i);
401             if ( prop.getPropertyKey().equals(sKey) )
402                return prop.getPropertyValue();
403          } 
404       }
405             
406       return null;
407    }
408 }