View Javadoc

1   /*
2    * This file is part of Domingo
3    * an Open Source Java-API to Lotus Notes/Domino
4    * hosted at http://domingo.sourceforge.net
5    *
6    * Copyright (c) 2003-2007 Beck et al. projects GmbH Munich, Germany (http://www.bea.de)
7    *
8    * This library is free software; you can redistribute it and/or
9    * modify it under the terms of the GNU Lesser General Public
10   * License as published by the Free Software Foundation; either
11   * version 2.1 of the License, or (at your option) any later version.
12   *
13   * This library is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   * Lesser General Public License for more details.
17   *
18   * You should have received a copy of the GNU Lesser General Public
19   * License along with this library; if not, write to the Free Software
20   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21   */
22  
23  package de.bea.domingo.mock;
24  
25  import java.util.ArrayList;
26  import java.util.List;
27  
28  import de.bea.domingo.DDocument;
29  import de.bea.domingo.DViewEntry;
30  
31  /***
32   * Transient mock implementation of interface DViewEntry.
33   *
34   * @author <a href=mailto:kriede@users.sourceforge.net>Kurt Riede</a>
35   */
36  public final class MockViewEntry implements DViewEntry {
37  
38      /*** serial version ID for serialization. */
39      private static final long serialVersionUID = 3257850982569357616L;
40  
41      /*** list of column values. */
42      private List mColumnValues = new ArrayList();
43  
44      /*** universal ID. */
45      private String mUniversalID = "";
46  
47      /*** number of children. */
48      private int mChildCount = 0;
49  
50      /*** if it is a category entry. */
51      private boolean mIsCategory = false;
52  
53      /*** if it is a document entry. */
54      private boolean mIsDocument = false;
55  
56      /*** if it is a total entry. */
57      private boolean mIsTotal = false;
58  
59      /*** if it is a conflict entry. */
60      private boolean mIsConflict = false;
61  
62      /*** Number of descendants. */
63      private int descendants;
64  
65      /*** Number of sibblings. */
66      private int sibblings;
67  
68      /*** the NotesID. */
69      private String noteId;
70  
71      private boolean valid;
72  
73      private int indentLevel;
74  
75      private String position;
76  
77      /***
78       * Constructor.
79       *
80       * @param columnValues list of column values
81       * @param universalID universal ID
82       * @param childCount number of children
83       * @param isCategory if it is a category entry
84       * @param isDocument if it is a document entry
85       * @param isTotal if it is a total entry
86       * @param isConflict if it is a conflict entry
87       */
88      public MockViewEntry(final List columnValues, final String universalID, final int childCount, final boolean isCategory,
89              final boolean isDocument, final boolean isTotal, final boolean isConflict) {
90          mUniversalID = universalID;
91          mChildCount = childCount;
92          mColumnValues = columnValues;
93          mIsCategory = isCategory;
94          mIsDocument = isDocument;
95          mIsTotal = isTotal;
96          mIsConflict = isConflict;
97      }
98  
99      /***
100      * Constructor.
101      *
102      * @param entry any object implementing the interface DViewEntry
103      */
104     public MockViewEntry(final DViewEntry entry) {
105         mColumnValues = entry.getColumnValues();
106         mIsCategory = entry.isCategory();
107         mIsDocument = entry.isDocument();
108         mIsTotal = entry.isTotal();
109         mIsConflict = entry.isConflict();
110         mUniversalID = entry.getUniversalID();
111         mChildCount = entry.getChildCount();
112     }
113 
114     /***
115      * {@inheritDoc}
116      *
117      * @see de.bea.domingo.DViewEntry#getColumnValues()
118      */
119     public List getColumnValues() {
120         return mColumnValues;
121     }
122 
123     /***
124      * {@inheritDoc}
125      *
126      * @see de.bea.domingo.DViewEntry#getDocument()
127      */
128     public DDocument getDocument() {
129         throw new UnsupportedOperationException("getDocument() not supported in class MockViewEntry");
130     }
131 
132     /***
133      * {@inheritDoc}
134      *
135      * @see de.bea.domingo.DViewEntry#isCategory()
136      */
137     public boolean isCategory() {
138         return mIsCategory;
139     }
140 
141     /***
142      * {@inheritDoc}
143      *
144      * @see de.bea.domingo.DViewEntry#isDocument()
145      */
146     public boolean isDocument() {
147         return mIsDocument;
148     }
149 
150     /***
151      * {@inheritDoc}
152      *
153      * @see de.bea.domingo.DViewEntry#isTotal()
154      */
155     public boolean isTotal() {
156         return mIsTotal;
157     }
158 
159     /***
160      * {@inheritDoc}
161      *
162      * @see de.bea.domingo.DViewEntry#getUniversalID()
163      */
164     public String getUniversalID() {
165         return mUniversalID;
166     }
167 
168     /***
169      * {@inheritDoc}
170      *
171      * @see de.bea.domingo.DViewEntry#getChildCount()
172      */
173     public int getChildCount() {
174         return mChildCount;
175     }
176 
177     /***
178      * {@inheritDoc}
179      *
180      * @see de.bea.domingo.DViewEntry#isConflict()
181      */
182     public boolean isConflict() {
183         return mIsConflict;
184     }
185 
186     /***
187      * {@inheritDoc}
188      *
189      * @see java.lang.Object#toString()
190      */
191     public String toString() {
192         return mColumnValues.toString();
193     }
194 
195     /***
196      * {@inheritDoc}
197      *
198      * @see de.bea.domingo.DViewEntry#getDescendantCount()
199      */
200     public int getDescendantCount() {
201         return descendants;
202     }
203 
204     /***
205      * {@inheritDoc}
206      *
207      * @see de.bea.domingo.DViewEntry#getSiblingCount()
208      */
209     public int getSiblingCount() {
210         return sibblings;
211     }
212 
213     /***
214      * {@inheritDoc}
215      *
216      * @see de.bea.domingo.DViewEntry#getSibblingCount()
217      * @deprecated use method {@link #getSiblingCount()} instead
218      */
219     public int getSibblingCount() {
220         return sibblings;
221     }
222 
223     /***
224      * {@inheritDoc}
225      *
226      * @see de.bea.domingo.DViewEntry#getIndentLevel()
227      */
228     public int getIndentLevel() {
229         return indentLevel;
230     }
231 
232     /***
233      * {@inheritDoc}
234      *
235      * @see de.bea.domingo.DViewEntry#isValid()
236      */
237     public boolean isValid() {
238         return valid;
239     }
240 
241     /***
242      * {@inheritDoc}
243      *
244      * @see de.bea.domingo.DViewEntry#getNoteID()
245      */
246     public String getNoteID() {
247         return noteId;
248     }
249 
250     /***
251      * {@inheritDoc}
252      *
253      * @see de.bea.domingo.DViewEntry#getPosition(char)
254      */
255     public String getPosition(final char seperator) {
256         return position;
257     }
258 }