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