KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > query > ExtQueryContext


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.query;
17
18 import org.outerj.daisy.repository.Repository;
19 import org.outerj.daisy.repository.RepositoryException;
20 import org.outerj.daisy.repository.DocumentCollection;
21 import org.outerj.daisy.repository.variant.Branch;
22 import org.outerj.daisy.repository.variant.Language;
23 import org.outerj.daisy.repository.schema.FieldType;
24 import org.outerj.daisy.repository.schema.DocumentType;
25 import org.outerj.daisy.repository.schema.PartType;
26
27 public class ExtQueryContext implements QueryContext {
28     private final Repository repository;
29
30     public ExtQueryContext(Repository repository) {
31         this.repository = repository;
32     }
33
34     public FieldType getFieldTypeByName(String JavaDoc name) throws RepositoryException {
35         return repository.getRepositorySchema().getFieldTypeByName(name, false);
36     }
37
38     public PartType getPartTypeByName(String JavaDoc name) throws RepositoryException {
39         return repository.getRepositorySchema().getPartTypeByName(name, false);
40     }
41
42     public DocumentType getDocumentTypeByName(String JavaDoc name) throws RepositoryException {
43         return repository.getRepositorySchema().getDocumentTypeByName(name, false);
44     }
45
46     public DocumentCollection getCollection(String JavaDoc name) throws RepositoryException {
47         return repository.getCollectionManager().getCollection(name, false);
48     }
49
50     public DocumentType getDocumentTypeById(long id) throws RepositoryException {
51         return repository.getRepositorySchema().getDocumentTypeById(id, false);
52     }
53
54     public String JavaDoc getUserDisplayName(long userId) throws RepositoryException {
55         return repository.getUserManager().getUserDisplayName(userId);
56     }
57
58     public long getUserId(String JavaDoc login) throws RepositoryException {
59         return repository.getUserManager().getUserId(login);
60     }
61
62     public String JavaDoc getUserLogin(long userId) throws RepositoryException {
63         return repository.getUserManager().getUserLogin(userId);
64     }
65
66     public Branch getBranchByName(String JavaDoc name) throws RepositoryException {
67         return repository.getVariantManager().getBranch(name, false);
68     }
69
70     public Language getLanguageByName(String JavaDoc name) throws RepositoryException {
71         return repository.getVariantManager().getLanguage(name, false);
72     }
73
74     public Branch getBranch(long branchId) throws RepositoryException {
75         return repository.getVariantManager().getBranch(branchId, false);
76     }
77
78     public Language getLanguage(long languageId) throws RepositoryException {
79         return repository.getVariantManager().getLanguage(languageId, false);
80     }
81 }
82
Popular Tags