|
15 | 15 | */ |
16 | 16 | package com.marklogic.client.pojo; |
17 | 17 |
|
| 18 | +import com.marklogic.client.FailedRequestException; |
| 19 | +import com.marklogic.client.ForbiddenUserException; |
| 20 | +import com.marklogic.client.ResourceNotFoundException; |
18 | 21 | import com.marklogic.client.Transaction; |
19 | 22 | import com.marklogic.client.io.marker.SearchReadHandle; |
20 | 23 |
|
@@ -78,84 +81,113 @@ public interface PojoRepository<T, ID extends Serializable> { |
78 | 81 | * {@link com.fasterxml.jackson.databind.ObjectMapper ObjectMapper} to generate the |
79 | 82 | * serialized JSON format. |
80 | 83 | */ |
81 | | - public void write(T entity); |
| 84 | + public void write(T entity) |
| 85 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
82 | 86 | /** Does everything in {@link #write(Object) write(T)} but also adds your collections to the |
83 | 87 | * persisted instance. |
84 | 88 | */ |
85 | | - public void write(T entity, String... collections); |
| 89 | + public void write(T entity, String... collections) |
| 90 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
86 | 91 | /** Does everything in {@link #write(Object) write(T)} but in your |
87 | 92 | * <a href="http://docs.marklogic.com/guide/app-dev/transactions"> |
88 | 93 | * multi-statement transaction</a> context. |
89 | 94 | */ |
90 | | - public void write(T entity, Transaction transaction); |
| 95 | + public void write(T entity, Transaction transaction) |
| 96 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
91 | 97 | /** Does everything in {@link #write(Object) write(T)} but also adds your collections to the |
92 | 98 | * persisted instance and performs the write in your |
93 | 99 | * <a href="http://docs.marklogic.com/guide/app-dev/transactions"> |
94 | 100 | * multi-statement transaction</a> context. |
95 | 101 | * . |
96 | 102 | */ |
97 | | - public void write(T entity, Transaction transaction, String... collections); |
| 103 | + public void write(T entity, Transaction transaction, String... collections) |
| 104 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
98 | 105 |
|
99 | 106 | /** @return true if a document exists in the database with the id */ |
100 | | - public boolean exists(ID id); |
| 107 | + public boolean exists(ID id) |
| 108 | + throws ForbiddenUserException, FailedRequestException; |
101 | 109 |
|
102 | 110 | /** @return in the context of transaction, true if a document exists in the database with |
103 | 111 | * the id */ |
104 | | - public boolean exists(ID id, Transaction transaction); |
| 112 | + public boolean exists(ID id, Transaction transaction) |
| 113 | + throws ForbiddenUserException, FailedRequestException; |
105 | 114 |
|
106 | 115 | /** @return the number of documents of type T persisted in the database */ |
107 | | - public long count(); |
| 116 | + public long count() |
| 117 | + throws ForbiddenUserException, FailedRequestException; |
108 | 118 |
|
109 | 119 | /** @return in the context of transaction, the number of documents of type T persisted in |
110 | 120 | * the database */ |
111 | | - public long count(Transaction transaction); |
| 121 | + public long count(Transaction transaction) |
| 122 | + throws ForbiddenUserException, FailedRequestException; |
112 | 123 |
|
113 | 124 | /** @return the number of documents of type T persisted in the database with at least |
114 | 125 | * one of the criteria collections*/ |
115 | | - public long count(String... collection); |
| 126 | + public long count(String... collection) |
| 127 | + throws ForbiddenUserException, FailedRequestException; |
116 | 128 |
|
117 | 129 | /** @return in the context of transaction, the number of documents of type T persisted in |
118 | 130 | * the database with at least one of the criteria collections*/ |
119 | | - public long count(String[] collections, Transaction transaction); |
| 131 | + public long count(String[] collections, Transaction transaction) |
| 132 | + throws ForbiddenUserException, FailedRequestException; |
120 | 133 |
|
121 | 134 | /** @return the number of documents of type T persisted in the database which match |
122 | 135 | * the query */ |
123 | | - public long count(PojoQueryDefinition query); |
| 136 | + public long count(PojoQueryDefinition query) |
| 137 | + throws ForbiddenUserException, FailedRequestException; |
124 | 138 |
|
125 | 139 | /** @return in the context of transaction, the number of documents of type T persisted in the |
126 | 140 | * database which match the query */ |
127 | | - public long count(PojoQueryDefinition query, Transaction transaction); |
| 141 | + public long count(PojoQueryDefinition query, Transaction transaction) |
| 142 | + throws ForbiddenUserException, FailedRequestException; |
128 | 143 |
|
129 | 144 | /** Deletes from the database the documents with the corresponding ids */ |
130 | | - public void delete(ID... ids); |
| 145 | + public void delete(ID... ids) |
| 146 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
131 | 147 |
|
132 | 148 | /** As part of transaction, deletes from the database the documents with the corresponding ids */ |
133 | | - public void delete(ID[] ids, Transaction transaction); |
| 149 | + public void delete(ID[] ids, Transaction transaction) |
| 150 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
134 | 151 |
|
135 | 152 | /** Deletes from the database all documents of type T persisted by the pojo facade */ |
136 | | - public void deleteAll(); |
| 153 | + public void deleteAll() |
| 154 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
137 | 155 |
|
138 | 156 | /** As part of transaction, deletes from the database all documents of type T persisted by |
139 | 157 | * the pojo facade */ |
140 | | - public void deleteAll(Transaction transaction); |
| 158 | + public void deleteAll(Transaction transaction) |
| 159 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
141 | 160 |
|
142 | 161 | /* REST API does not currently support DELETE /search with multiple collection arguments |
143 | | - public void deleteAll(String... collections); |
| 162 | + public void deleteAll(String... collections) |
| 163 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
144 | 164 | */ |
145 | 165 |
|
146 | | - public T read(ID id); |
147 | | - public T read(ID id, Transaction transaction); |
148 | | - public PojoPage<T> read(ID[] ids); |
149 | | - public PojoPage<T> read(ID[] ids, Transaction transaction); |
150 | | - public PojoPage<T> readAll(long start); |
151 | | - public PojoPage<T> readAll(long start, Transaction transaction); |
| 166 | + public T read(ID id) |
| 167 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
| 168 | + public T read(ID id, Transaction transaction) |
| 169 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
| 170 | + public PojoPage<T> read(ID[] ids) |
| 171 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
| 172 | + public PojoPage<T> read(ID[] ids, Transaction transaction) |
| 173 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
| 174 | + public PojoPage<T> readAll(long start) |
| 175 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
| 176 | + public PojoPage<T> readAll(long start, Transaction transaction) |
| 177 | + throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; |
152 | 178 |
|
153 | | - public PojoPage<T> search(long start, String... collections); |
154 | | - public PojoPage<T> search(long start, Transaction transaction, String... collections); |
155 | | - public PojoPage<T> search(PojoQueryDefinition query, long start); |
156 | | - public PojoPage<T> search(PojoQueryDefinition query, long start, Transaction transaction); |
157 | | - public PojoPage<T> search(PojoQueryDefinition query, long start, SearchReadHandle searchHandle); |
158 | | - public PojoPage<T> search(PojoQueryDefinition query, long start, SearchReadHandle searchHandle, Transaction transaction); |
| 179 | + public PojoPage<T> search(long start, String... collections) |
| 180 | + throws ForbiddenUserException, FailedRequestException; |
| 181 | + public PojoPage<T> search(long start, Transaction transaction, String... collections) |
| 182 | + throws ForbiddenUserException, FailedRequestException; |
| 183 | + public PojoPage<T> search(PojoQueryDefinition query, long start) |
| 184 | + throws ForbiddenUserException, FailedRequestException; |
| 185 | + public PojoPage<T> search(PojoQueryDefinition query, long start, Transaction transaction) |
| 186 | + throws ForbiddenUserException, FailedRequestException; |
| 187 | + public PojoPage<T> search(PojoQueryDefinition query, long start, SearchReadHandle searchHandle) |
| 188 | + throws ForbiddenUserException, FailedRequestException; |
| 189 | + public PojoPage<T> search(PojoQueryDefinition query, long start, SearchReadHandle searchHandle, Transaction transaction) |
| 190 | + throws ForbiddenUserException, FailedRequestException; |
159 | 191 |
|
160 | 192 | public PojoQueryBuilder<T> getQueryBuilder(); |
161 | 193 |
|
|
0 commit comments