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