]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
2537811a2fc1a32beba3b614dd07813a09eaff66
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.nuxeo.client.java;
2
3 import java.security.Principal;
4
5 import org.nuxeo.ecm.core.api.ClientException;
6 import org.nuxeo.ecm.core.api.DocumentModel;
7 import org.nuxeo.ecm.core.api.DocumentModelList;
8 import org.nuxeo.ecm.core.api.DocumentRef;
9 import org.nuxeo.ecm.core.api.Filter;
10 import org.nuxeo.ecm.core.api.IterableQueryResult;
11 import org.nuxeo.ecm.core.api.event.DocumentEventTypes;
12 import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
13
14 public interface RepositoryInstanceInterface {
15
16         public RepositoryInstance getRepositoryInstance();
17         
18     /**
19      * Gets the root document of this repository.
20      *
21      * @return the root document. cannot be null
22      * @throws ClientException
23      * @throws SecurityException
24      */
25     public DocumentModel getRootDocument() throws ClientException;
26     
27     /**
28      * Gets the current session id.
29      * <p>
30      * If the client is not connected returns null.
31      *
32      * @return the session id or null if not connected
33      */
34     public String getSessionId();
35
36     /**
37      * 
38      * @throws Exception
39      */
40     public void close() throws Exception;
41     
42     /**
43      * Returns the repository name against which this core session is bound.
44      *
45      * @return the repository name used currently used as an identifier
46      */
47     public String getRepositoryName();
48     
49     /**
50      * Gets the principal that created the client session.
51      *
52      * @return the principal
53      */
54     public Principal getPrincipal();
55
56     public IterableQueryResult queryAndFetch(String query, String queryType,
57             Object... params) throws ClientException;
58
59     public DocumentModelList query(String query, Filter filter, long limit,
60             long offset, boolean countTotal) throws ClientException;
61
62     public DocumentModelList query(String query) throws ClientException;
63
64     /**
65      * Executes the given NXQL query an returns the result.
66      *
67      * @param query the query to execute
68      * @param max number of document to retrieve
69      * @return the query result
70      * @throws ClientException
71      */
72     public DocumentModelList query(String query, int max) throws ClientException;
73
74     /**
75      * Gets a document model given its reference.
76      * <p>
77      * The default schemas are used to populate the returned document model.
78      * Default schemas are configured via the document type manager.
79      * <p>
80      * Any other data model not part of the default schemas will be lazily
81      * loaded as needed.
82      *
83      * @param docRef the document reference
84      * @return the document
85      * @throws ClientException
86      * @throws SecurityException
87      */
88     public DocumentModel getDocument(DocumentRef docRef) throws ClientException;
89
90     public DocumentModel saveDocument(DocumentModel docModel) throws ClientException;
91
92     public void save() throws ClientException;
93
94     /**
95      * Bulk document saving.
96      *
97      * @param docModels the document models that needs to be saved
98      * @throws ClientException
99      */
100     public void saveDocuments(DocumentModel[] docModels) throws ClientException;
101
102     /**
103      * Removes this document and all its children, if any.
104      *
105      * @param docRef the reference to the document to remove
106      * @throws ClientException
107      */
108     public void removeDocument(DocumentRef docRef) throws ClientException;
109
110     /**
111      * Creates a document model using required information.
112      * <p>
113      * Used to fetch initial datamodels from the type definition.
114      * <p>
115      * DocumentModel creation notifies a
116      * {@link DocumentEventTypes.EMPTY_DOCUMENTMODEL_CREATED} so that core event
117      * listener can initialize its content with computed properties.
118      *
119      * @param parentPath
120      * @param id
121      * @param typeName
122      * @return the initial document model
123      * @throws ClientException
124      */
125     public DocumentModel createDocumentModel(String parentPath, String id,
126             String typeName) throws ClientException;
127     
128     /**
129      * Creates a document using given document model for initialization.
130      * <p>
131      * The model contains path of the new document, its type and optionally the
132      * initial data models of the document.
133      * <p>
134      *
135      * @param model the document model to use for initialization
136      * @return the created document
137      * @throws ClientException
138      */
139     public DocumentModel createDocument(DocumentModel model) throws ClientException;
140     
141     /**
142      * Gets the children of the given parent.
143      *
144      * @param parent the parent reference
145      * @return the children if any, an empty list if no children or null if the
146      *         specified parent document is not a folder
147      * @throws ClientException
148      */
149     public DocumentModelList getChildren(DocumentRef parent) throws ClientException;
150
151     
152 }