001: /*
002: * Copyright 2004 Outerthought bvba and Schaubroeck nv
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.outerj.daisy.repository.serverimpl.acl;
017:
018: import org.outerj.daisy.repository.*;
019: import org.outerx.daisy.x10.DocumentDocument;
020: import org.outerx.daisy.x10.CollectionDocument;
021: import org.outerx.daisy.x10.CollectionsDocument;
022:
023: import java.util.Date;
024: import java.util.Map;
025:
026: public class DummyDocForAppliesToTest implements Document {
027: private final static String FAIL_MSG = "Tried to access document information which is not available while testing 'applies to'. This is a bug in Daisy, please report it.";
028: private final long documentTypeId;
029: private final DocumentCollections documentCollections;
030:
031: public DummyDocForAppliesToTest(long documentTypeId,
032: long collectionId) {
033: this .documentTypeId = documentTypeId;
034: DocumentCollection[] collections = new DocumentCollection[1];
035: collections[0] = new DummyDocumentCollection(collectionId);
036: documentCollections = new DummyDocumentCollections(collections);
037: }
038:
039: static final class DummyDocumentCollection implements
040: DocumentCollection {
041: private final long id;
042:
043: public DummyDocumentCollection(long id) {
044: this .id = id;
045: }
046:
047: public long getId() {
048: return id;
049: }
050:
051: public String getName() {
052: throw new RuntimeException(FAIL_MSG);
053: }
054:
055: public void setName(String name) {
056: throw new RuntimeException(FAIL_MSG);
057: }
058:
059: public void save() {
060: throw new RuntimeException(FAIL_MSG);
061: }
062:
063: public CollectionDocument getXml() {
064: throw new RuntimeException(FAIL_MSG);
065: }
066:
067: public Date getLastModified() {
068: throw new RuntimeException(FAIL_MSG);
069: }
070:
071: public long getLastModifier() {
072: throw new RuntimeException(FAIL_MSG);
073: }
074:
075: public long getUpdateCount() {
076: throw new RuntimeException(FAIL_MSG);
077: }
078: }
079:
080: static final class DummyDocumentCollections implements
081: DocumentCollections {
082: private final DocumentCollection[] collections;
083:
084: public DummyDocumentCollections(DocumentCollection[] collections) {
085: this .collections = collections;
086: }
087:
088: public DocumentCollection[] getArray() {
089: return collections;
090: }
091:
092: public CollectionsDocument getXml() {
093: throw new RuntimeException(FAIL_MSG);
094: }
095: }
096:
097: public String getId() {
098: throw new RuntimeException(FAIL_MSG);
099: }
100:
101: public boolean isNew() {
102: throw new RuntimeException(FAIL_MSG);
103: }
104:
105: public long getSeqId() {
106: throw new RuntimeException(FAIL_MSG);
107: }
108:
109: public String getNamespace() {
110: throw new RuntimeException(FAIL_MSG);
111: }
112:
113: public long getBranchId() {
114: throw new RuntimeException(FAIL_MSG);
115: }
116:
117: public long getLanguageId() {
118: throw new RuntimeException(FAIL_MSG);
119: }
120:
121: public void setRequestedId(String documentId) {
122: throw new RuntimeException(FAIL_MSG);
123: }
124:
125: public String getRequestedId() {
126: throw new RuntimeException(FAIL_MSG);
127: }
128:
129: public VariantKey getVariantKey() {
130: throw new RuntimeException(FAIL_MSG);
131: }
132:
133: public boolean isVariantNew() {
134: throw new RuntimeException(FAIL_MSG);
135: }
136:
137: public AvailableVariants getAvailableVariants()
138: throws RepositoryException {
139: throw new RuntimeException(FAIL_MSG);
140: }
141:
142: public long getDocumentTypeId() {
143: return documentTypeId;
144: }
145:
146: public void changeDocumentType(long documentTypeId)
147: throws RepositoryException {
148: throw new RuntimeException(FAIL_MSG);
149: }
150:
151: public void changeDocumentType(String documentTypeName)
152: throws RepositoryException {
153: throw new RuntimeException(FAIL_MSG);
154: }
155:
156: public String getName() {
157: throw new RuntimeException(FAIL_MSG);
158: }
159:
160: public String getDocumentName() {
161: throw new RuntimeException(FAIL_MSG);
162: }
163:
164: public void setName(String name) {
165: throw new RuntimeException(FAIL_MSG);
166: }
167:
168: public long getOwner() {
169: throw new RuntimeException(FAIL_MSG);
170: }
171:
172: public void setOwner(long userId) {
173: throw new RuntimeException(FAIL_MSG);
174: }
175:
176: public boolean isPrivate() {
177: throw new RuntimeException(FAIL_MSG);
178: }
179:
180: public void setPrivate(boolean _private) {
181: throw new RuntimeException(FAIL_MSG);
182: }
183:
184: public Date getCreated() {
185: throw new RuntimeException(FAIL_MSG);
186: }
187:
188: public boolean isRetired() {
189: throw new RuntimeException(FAIL_MSG);
190: }
191:
192: public void setRetired(boolean retired) {
193: throw new RuntimeException(FAIL_MSG);
194: }
195:
196: public Date getLastModified() {
197: throw new RuntimeException(FAIL_MSG);
198: }
199:
200: public long getLastModifier() {
201: throw new RuntimeException(FAIL_MSG);
202: }
203:
204: public Date getVariantLastModified() {
205: throw new RuntimeException(FAIL_MSG);
206: }
207:
208: public long getVariantLastModifier() {
209: throw new RuntimeException(FAIL_MSG);
210: }
211:
212: public Versions getVersions() throws RepositoryException {
213: throw new RuntimeException(FAIL_MSG);
214: }
215:
216: public Version getVersion(long id) throws RepositoryException {
217: throw new RuntimeException(FAIL_MSG);
218: }
219:
220: public long getLastVersionId() {
221: throw new RuntimeException(FAIL_MSG);
222: }
223:
224: public Version getLastVersion() throws RepositoryException {
225: throw new RuntimeException(FAIL_MSG);
226: }
227:
228: public Version getLiveVersion() throws RepositoryException {
229: throw new RuntimeException(FAIL_MSG);
230: }
231:
232: public long getLiveVersionId() {
233: throw new RuntimeException(FAIL_MSG);
234: }
235:
236: public boolean canReadLiveOnly() {
237: throw new RuntimeException(FAIL_MSG);
238: }
239:
240: public void setField(String name, Object value)
241: throws DocumentTypeInconsistencyException {
242: throw new RuntimeException(FAIL_MSG);
243: }
244:
245: public void setField(long fieldTypeId, Object value)
246: throws DocumentTypeInconsistencyException {
247: throw new RuntimeException(FAIL_MSG);
248: }
249:
250: public void deleteField(String name) {
251: throw new RuntimeException(FAIL_MSG);
252: }
253:
254: public void deleteField(long fieldTypeId) {
255: throw new RuntimeException(FAIL_MSG);
256: }
257:
258: public Field getField(String fieldTypeName)
259: throws FieldNotFoundException {
260: throw new RuntimeException(FAIL_MSG);
261: }
262:
263: public Field getField(long fieldTypeId)
264: throws FieldNotFoundException {
265: throw new RuntimeException(FAIL_MSG);
266: }
267:
268: public boolean hasField(long fieldTypeId) {
269: throw new RuntimeException(FAIL_MSG);
270: }
271:
272: public boolean hasField(String fieldTypeName) {
273: throw new RuntimeException(FAIL_MSG);
274: }
275:
276: public Fields getFields() {
277: throw new RuntimeException(FAIL_MSG);
278: }
279:
280: public Fields getFieldsInOrder() {
281: throw new RuntimeException(FAIL_MSG);
282: }
283:
284: public void save() throws RepositoryException {
285: throw new RuntimeException(FAIL_MSG);
286: }
287:
288: public void save(boolean validate) throws RepositoryException {
289: throw new RuntimeException(FAIL_MSG);
290: }
291:
292: public void validate() throws DocumentTypeInconsistencyException {
293: throw new RuntimeException(FAIL_MSG);
294: }
295:
296: public void setNewVersionState(VersionState versionState) {
297: throw new RuntimeException(FAIL_MSG);
298: }
299:
300: public VersionState getNewVersionState() {
301: throw new RuntimeException(FAIL_MSG);
302: }
303:
304: public boolean lock(long duration, LockType lockType)
305: throws RepositoryException {
306: throw new RuntimeException(FAIL_MSG);
307: }
308:
309: public boolean releaseLock() throws RepositoryException {
310: throw new RuntimeException(FAIL_MSG);
311: }
312:
313: public LockInfo getLockInfo(boolean fresh)
314: throws RepositoryException {
315: throw new RuntimeException(FAIL_MSG);
316: }
317:
318: public void setCustomField(String name, String value) {
319: throw new RuntimeException(FAIL_MSG);
320: }
321:
322: public void deleteCustomField(String name) {
323: throw new RuntimeException(FAIL_MSG);
324: }
325:
326: public String getCustomField(String name) {
327: throw new RuntimeException(FAIL_MSG);
328: }
329:
330: public boolean hasCustomField(String name) {
331: throw new RuntimeException(FAIL_MSG);
332: }
333:
334: public void clearCustomFields() {
335: throw new RuntimeException(FAIL_MSG);
336: }
337:
338: public Map<String, String> getCustomFields() {
339: throw new RuntimeException(FAIL_MSG);
340: }
341:
342: public void setPart(String partTypeName, String mimeType,
343: byte[] data) throws DocumentTypeInconsistencyException {
344: throw new RuntimeException(FAIL_MSG);
345: }
346:
347: public void setPart(long partTypeId, String mimeType, byte[] data)
348: throws DocumentTypeInconsistencyException {
349: throw new RuntimeException(FAIL_MSG);
350: }
351:
352: public void setPart(String partTypeName, String mimeType,
353: PartDataSource partDataSource)
354: throws DocumentTypeInconsistencyException {
355: throw new RuntimeException(FAIL_MSG);
356: }
357:
358: public void setPart(long partTypeId, String mimeType,
359: PartDataSource partDataSource)
360: throws DocumentTypeInconsistencyException {
361: throw new RuntimeException(FAIL_MSG);
362: }
363:
364: public void setPartFileName(String partTypeName, String fileName) {
365: throw new RuntimeException(FAIL_MSG);
366: }
367:
368: public void setPartFileName(long partTypeId, String fileName) {
369: throw new RuntimeException(FAIL_MSG);
370: }
371:
372: public void setPartMimeType(String partTypeName, String mimeType) {
373: throw new RuntimeException(FAIL_MSG);
374: }
375:
376: public void setPartMimeType(long partTypeId, String mimeType) {
377: throw new RuntimeException(FAIL_MSG);
378: }
379:
380: public void deletePart(long partTypeId) {
381: throw new RuntimeException(FAIL_MSG);
382: }
383:
384: public void deletePart(String name) {
385: throw new RuntimeException(FAIL_MSG);
386: }
387:
388: public Part getPart(long partTypeId) throws PartNotFoundException {
389: throw new RuntimeException(FAIL_MSG);
390: }
391:
392: public Part getPart(String name) throws PartNotFoundException {
393: throw new RuntimeException(FAIL_MSG);
394: }
395:
396: public boolean hasPart(long partTypeId) {
397: throw new RuntimeException(FAIL_MSG);
398: }
399:
400: public boolean hasPart(String name) {
401: throw new RuntimeException(FAIL_MSG);
402: }
403:
404: public Parts getParts() {
405: throw new RuntimeException(FAIL_MSG);
406: }
407:
408: public Parts getPartsInOrder() {
409: throw new RuntimeException(FAIL_MSG);
410: }
411:
412: public void addLink(String title, String target) {
413: throw new RuntimeException(FAIL_MSG);
414: }
415:
416: public void deleteLink(int index) {
417: throw new RuntimeException(FAIL_MSG);
418: }
419:
420: public void clearLinks() {
421: throw new RuntimeException(FAIL_MSG);
422: }
423:
424: public Links getLinks() {
425: throw new RuntimeException(FAIL_MSG);
426: }
427:
428: public void addToCollection(DocumentCollection collection) {
429: throw new RuntimeException(FAIL_MSG);
430: }
431:
432: public void removeFromCollection(DocumentCollection collection) {
433: throw new RuntimeException(FAIL_MSG);
434: }
435:
436: public DocumentCollections getCollections() {
437: return documentCollections;
438: }
439:
440: public boolean inCollection(DocumentCollection collection) {
441: throw new RuntimeException(FAIL_MSG);
442: }
443:
444: public boolean inCollection(long collectionId) {
445: throw new RuntimeException(FAIL_MSG);
446: }
447:
448: public DocumentDocument getXml() throws RepositoryException {
449: throw new RuntimeException(FAIL_MSG);
450: }
451:
452: public DocumentDocument getXmlWithoutVariant()
453: throws RepositoryException {
454: throw new RuntimeException(FAIL_MSG);
455: }
456:
457: public DocumentDocument getXmlWithoutVersionedData()
458: throws RepositoryException {
459: throw new RuntimeException(FAIL_MSG);
460: }
461:
462: public DocumentDocument getXml(long versionId)
463: throws RepositoryException {
464: throw new RuntimeException(FAIL_MSG);
465: }
466:
467: public void clearCollections() {
468: throw new RuntimeException(FAIL_MSG);
469: }
470:
471: public String getSummary() {
472: throw new RuntimeException(FAIL_MSG);
473: }
474:
475: public long getVariantCreatedFromBranchId() {
476: throw new RuntimeException(FAIL_MSG);
477: }
478:
479: public long getVariantCreatedFromLanguageId() {
480: throw new RuntimeException(FAIL_MSG);
481: }
482:
483: public long getVariantCreatedFromVersionId() {
484: throw new RuntimeException(FAIL_MSG);
485: }
486:
487: public void setDocumentTypeChecksEnabled(
488: boolean documentTypeChecksEnabled) {
489: throw new RuntimeException(FAIL_MSG);
490: }
491:
492: public long getUpdateCount() {
493: throw new RuntimeException(FAIL_MSG);
494: }
495:
496: public long getVariantUpdateCount() {
497: throw new RuntimeException(FAIL_MSG);
498: }
499:
500: public long getReferenceLanguageId() {
501: throw new RuntimeException(FAIL_MSG);
502: }
503:
504: public String getSyncedWithVersion() {
505: throw new RuntimeException(FAIL_MSG);
506: }
507:
508: public void setSyncedWithVersion(long langugeId, long versionId) {
509: throw new RuntimeException(FAIL_MSG);
510: }
511:
512: public void setReferenceLanguageId(long referenceLanguageId) {
513: throw new RuntimeException(FAIL_MSG);
514: }
515:
516: public void setReferenceLanguage(String referenceLanguageName) {
517: throw new RuntimeException(FAIL_MSG);
518: }
519:
520: public String getNewChangeComment() {
521: throw new RuntimeException(FAIL_MSG);
522: }
523:
524: public ChangeType getNewChangeType() {
525: throw new RuntimeException(FAIL_MSG);
526: }
527:
528: public VersionKey getNewSyncedWith() {
529: throw new RuntimeException(FAIL_MSG);
530: }
531:
532: public void setNewChangeComment(String changeComment) {
533: throw new RuntimeException(FAIL_MSG);
534: }
535:
536: public void setNewChangeType(ChangeType changeType) {
537: throw new RuntimeException(FAIL_MSG);
538: }
539:
540: public void setNewSyncedWith(long languageId, long versionId)
541: throws RepositoryException {
542: throw new RuntimeException(FAIL_MSG);
543: }
544:
545: public void setNewSyncedWith(String languageName, long versionId)
546: throws RepositoryException {
547: throw new RuntimeException(FAIL_MSG);
548: }
549:
550: public void setNewSyncedWith(VersionKey syncedWith)
551: throws RepositoryException {
552: throw new RuntimeException(FAIL_MSG);
553: }
554:
555: public long getLastMajorChangeVersionId() {
556: throw new RuntimeException(FAIL_MSG);
557: }
558:
559: public long getLiveMajorChangeVersionId() {
560: throw new RuntimeException(FAIL_MSG);
561: }
562: }
|