1 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 name) throws RepositoryException { 35 return repository.getRepositorySchema().getFieldTypeByName(name, false); 36 } 37 38 public PartType getPartTypeByName(String name) throws RepositoryException { 39 return repository.getRepositorySchema().getPartTypeByName(name, false); 40 } 41 42 public DocumentType getDocumentTypeByName(String name) throws RepositoryException { 43 return repository.getRepositorySchema().getDocumentTypeByName(name, false); 44 } 45 46 public DocumentCollection getCollection(String 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 getUserDisplayName(long userId) throws RepositoryException { 55 return repository.getUserManager().getUserDisplayName(userId); 56 } 57 58 public long getUserId(String login) throws RepositoryException { 59 return repository.getUserManager().getUserId(login); 60 } 61 62 public String getUserLogin(long userId) throws RepositoryException { 63 return repository.getUserManager().getUserLogin(userId); 64 } 65 66 public Branch getBranchByName(String name) throws RepositoryException { 67 return repository.getVariantManager().getBranch(name, false); 68 } 69 70 public Language getLanguageByName(String 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 |