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

Quick Search    Search Deep

Source code: com/flexstor/common/data/RecordData.java


1   /*
2    * RecordData.java
3    *
4    * Copyright $Date: 2003/08/11 02:22:35 $ 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.common.data;
12  
13  import java.util.Vector;
14  
15  import com.flexstor.common.constants.ActionPropertiesI;
16  import com.flexstor.common.util.FlexHashtable;
17  
18  /**
19  * Generic Record Data object that is passed from client to database and appserver.
20  * Note that this is an abstract class. The additional properites of this class will
21  * be stored as attributes in its subclasses.
22  */
23  public class RecordData
24     extends KeyedCollectionData
25     implements ActionPropertiesI
26  {
27     protected long          nRecordId            = -1;
28     protected int           nStructureId         = -1;
29     protected int           nBucketType          = -1;
30     protected Vector        traversalPathInfo    = null;
31     protected FlexHashtable   data                 = null;
32     protected Vector        childrenRecs         = null;
33  
34     public RecordData() {}
35  
36     public void setRecordId( long nRecordId )
37     {
38        this.nRecordId = nRecordId;
39     }
40  
41     public long getRecordId()
42     {
43        return nRecordId;
44     }
45  
46     public void setStructureId( int nStructureId )
47     {
48        this.nStructureId = nStructureId;
49     }
50  
51     public int getStructureId()
52     {
53        return nStructureId;
54     }
55  
56     public void setBucketType( int nBucketType )
57     {
58        this.nBucketType = nBucketType;
59     }
60  
61     public int getBucketType()
62     {
63        return nBucketType;
64     }
65  
66     public void setTraversalPathInfo( Vector traversalPathInfo )
67     {
68        this.traversalPathInfo = traversalPathInfo;
69     }
70  
71     public Vector getTraversalPathInfo()
72     {
73        return traversalPathInfo;
74     }
75  
76     public void setData( FlexHashtable data )
77     {
78        this.data = data;
79     }
80  
81     public FlexHashtable getData()
82     {
83        return data;
84     }
85  
86     public void setProperties( FlexHashtable properties )
87     {
88        super.setKeyedCollection( properties );
89     }
90  
91     public FlexHashtable getProperties()
92     {
93        return super.getKeyedCollection();
94     }
95  
96     public void setChildrenRecords( Vector childrenRecs )
97     {
98        this.childrenRecs = childrenRecs;
99     }
100 
101    public Vector getChildrenRecords()
102    {
103       if ( childrenRecs == null )
104          childrenRecs = new Vector();
105       return childrenRecs;
106    }
107 
108    public void addChildRecord( RecordData record )
109    {
110       if ( childrenRecs == null )
111          childrenRecs = new Vector();
112 
113       childrenRecs.addElement( record );
114    }
115 
116    protected void fillCloneInfo( RecordData clone )
117    {
118       // Copy everything in this class
119       clone.setRecordId( this.nRecordId );
120       clone.setStructureId( this.nStructureId );
121       clone.setBucketType( this.nBucketType );
122       if ( traversalPathInfo != null )
123          clone.setTraversalPathInfo( (Vector)this.traversalPathInfo.clone() );
124       if ( data != null )
125          clone.setData( (FlexHashtable)this.data.clone() );
126 
127       // Copy everything in super class KeyedCollectionData
128       FlexHashtable keyedCollection = this.getKeyedCollection();
129       if ( keyedCollection != null )
130          clone.setKeyedCollection( (FlexHashtable)keyedCollection.clone() );
131 
132       // Copy everything in super class Data
133       clone.setModTime( this.getModTime() );
134    }
135 }