public class MetaDataClientRest extends DefaultClient implements MetaDataClient
| Modifier and Type | Field and Description |
|---|---|
static String |
CONSISTENCY_ERROR_AN_INTERNAL_DATA_CONSISTENCY_ERROR_HAS_BEEN_DETECTED |
static String |
DESCRIPTION |
protected static String |
INTERNAL_SERVER_ERROR |
STATUS_URL| Constructor and Description |
|---|
MetaDataClientRest(VitamClientFactoryInterface factory)
Constructor using given scheme (http)
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkStatus()
Check the status from the service
|
void |
checkStatus(javax.ws.rs.core.MultivaluedHashMap<String,Object> headers)
Check the status from the service
used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificate
|
void |
close()
Close the underneath http client
|
void |
consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
Helper when an error occurs on client usage side to consume response however
|
protected VitamClientException |
createExceptionFromResponse(javax.ws.rs.core.Response response)
Handle all errors and throw a VitamClientException in case the response does not contains a vitamError type
result.
|
boolean |
flushObjectGroups() |
boolean |
flushUnits() |
protected javax.ws.rs.client.Client |
getClient(boolean chunked) |
RequestResponse<com.fasterxml.jackson.databind.JsonNode> |
getObjectGroupByIdRaw(String objectGroupId)
Search object group by path unit id
|
String |
getResourcePath()
Get the resource path of the server.
|
String |
getServiceUrl()
Get the service URL
|
RequestResponse<com.fasterxml.jackson.databind.JsonNode> |
getUnitByIdRaw(String unitId)
Search units by path unit id
|
VitamClientFactory<?> |
getVitamClientFactory() |
com.fasterxml.jackson.databind.JsonNode |
insertObjectGroup(com.fasterxml.jackson.databind.JsonNode insertQuery) |
com.fasterxml.jackson.databind.JsonNode |
insertUnit(com.fasterxml.jackson.databind.JsonNode insertQuery) |
protected Future<javax.ws.rs.core.Response> |
performAsyncRequest(String httpMethod,
String path,
javax.ws.rs.core.MultivaluedHashMap<String,Object> headers,
Object body,
javax.ws.rs.core.MediaType contentType,
javax.ws.rs.core.MediaType accept)
Perform an Async HTTP request to the server with full control of action on caller
|
protected <T> Future<T> |
performAsyncRequest(String httpMethod,
String path,
javax.ws.rs.core.MultivaluedHashMap<String,Object> headers,
Object body,
javax.ws.rs.core.MediaType contentType,
javax.ws.rs.core.MediaType accept,
javax.ws.rs.client.InvocationCallback<T> callback)
Perform an Async HTTP request to the server with callback
|
protected javax.ws.rs.core.Response |
performRequest(String httpMethod,
String path,
javax.ws.rs.core.MultivaluedHashMap<String,Object> headers,
javax.ws.rs.core.MediaType accept)
Perform a HTTP request to the server for synchronous call
|
protected javax.ws.rs.core.Response |
performRequest(String httpMethod,
String path,
javax.ws.rs.core.MultivaluedHashMap<String,Object> headers,
Object body,
javax.ws.rs.core.MediaType contentType,
javax.ws.rs.core.MediaType accept)
Perform a HTTP request to the server for synchronous call
|
protected javax.ws.rs.core.Response |
performRequest(String httpMethod,
String path,
javax.ws.rs.core.MultivaluedHashMap<String,Object> headers,
Object body,
javax.ws.rs.core.MediaType contentType,
javax.ws.rs.core.MediaType accept,
boolean chunkedMode)
Perform a HTTP request to the server for synchronous call
|
com.fasterxml.jackson.databind.JsonNode |
reindex(IndexParameters indexParam)
Reindex a collection with parameters
|
List<ObjectGroupPerOriginatingAgency> |
selectAccessionRegisterOnObjectByOperationId(String operationId) |
List<UnitPerOriginatingAgency> |
selectAccessionRegisterOnUnitByOperationId(String operationId) |
com.fasterxml.jackson.databind.JsonNode |
selectObjectGroups(com.fasterxml.jackson.databind.JsonNode selectQuery)
Search objectgroups by select query (DSL)
|
com.fasterxml.jackson.databind.JsonNode |
selectObjectGrouptbyId(com.fasterxml.jackson.databind.JsonNode selectQuery,
String objectGroupId)
Search Object Group by query (DSL) and path objectGroup id
|
com.fasterxml.jackson.databind.JsonNode |
selectUnitbyId(com.fasterxml.jackson.databind.JsonNode selectQuery,
String unitId)
Search units by query (DSL) and path unit id
|
com.fasterxml.jackson.databind.JsonNode |
selectUnits(com.fasterxml.jackson.databind.JsonNode selectQuery)
Search units by select query (DSL)
|
static void |
staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)
This method consume everything (in particular InpuStream) and close the response.
|
com.fasterxml.jackson.databind.JsonNode |
switchIndexes(SwitchIndexParameters switchIndexParam)
Switch indexes
|
String |
toString() |
void |
updateObjectGroupById(com.fasterxml.jackson.databind.JsonNode queryUpdate,
String objectGroupId)
Update ObjectGroup
|
com.fasterxml.jackson.databind.JsonNode |
updateUnitbyId(com.fasterxml.jackson.databind.JsonNode updateQuery,
String unitId)
Update units by query (DSL) and path unit id
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcheckStatus, checkStatus, close, consumeAnyEntityAndClose, getResourcePath, getServiceUrlpublic static final String DESCRIPTION
public static final String CONSISTENCY_ERROR_AN_INTERNAL_DATA_CONSISTENCY_ERROR_HAS_BEEN_DETECTED
protected static final String INTERNAL_SERVER_ERROR
public MetaDataClientRest(VitamClientFactoryInterface factory)
factory - The client factorypublic com.fasterxml.jackson.databind.JsonNode insertUnit(com.fasterxml.jackson.databind.JsonNode insertQuery)
throws InvalidParseOperationException,
MetaDataExecutionException,
MetaDataNotFoundException,
MetaDataAlreadyExistException,
MetaDataDocumentSizeException,
MetaDataClientServerException
insertUnit in interface MetaDataClientinsertQuery - as JsonNode InvalidParseOperationExceptionMetaDataExecutionExceptionMetaDataNotFoundExceptionMetaDataAlreadyExistExceptionMetaDataDocumentSizeExceptionMetaDataClientServerExceptionpublic com.fasterxml.jackson.databind.JsonNode selectUnits(com.fasterxml.jackson.databind.JsonNode selectQuery)
throws MetaDataExecutionException,
MetaDataDocumentSizeException,
InvalidParseOperationException,
MetaDataClientServerException,
VitamDBException
MetaDataClientselectUnits in interface MetaDataClientselectQuery - : select query SelectMultiQuery
as String MetaDataExecutionException - thrown when internal Server Error (fatal technical exception thrown)MetaDataDocumentSizeException - thrown when Query document Size is Too LargeInvalidParseOperationExceptionMetaDataClientServerExceptionVitamDBExceptionpublic com.fasterxml.jackson.databind.JsonNode selectObjectGroups(com.fasterxml.jackson.databind.JsonNode selectQuery)
throws MetaDataExecutionException,
MetaDataDocumentSizeException,
InvalidParseOperationException,
MetaDataClientServerException
MetaDataClientselectObjectGroups in interface MetaDataClientselectQuery - : select query SelectMultiQuery
as String MetaDataExecutionException - thrown when internal Server Error (fatal technical exception thrown)MetaDataDocumentSizeException - thrown when Query document Size is Too LargeInvalidParseOperationExceptionMetaDataClientServerExceptionpublic com.fasterxml.jackson.databind.JsonNode selectUnitbyId(com.fasterxml.jackson.databind.JsonNode selectQuery,
String unitId)
throws MetaDataExecutionException,
MetaDataDocumentSizeException,
InvalidParseOperationException,
MetaDataClientServerException
MetaDataClientselectUnitbyId in interface MetaDataClientselectQuery - : select query Select as JsonNode
unitId - : unit id MetaDataExecutionException - thrown when internal Server Error (fatal technical exception thrown)MetaDataDocumentSizeException - thrown when Query document Size is Too LargeInvalidParseOperationExceptionMetaDataClientServerExceptionpublic com.fasterxml.jackson.databind.JsonNode selectObjectGrouptbyId(com.fasterxml.jackson.databind.JsonNode selectQuery,
String objectGroupId)
throws MetaDataExecutionException,
MetaDataDocumentSizeException,
InvalidParseOperationException,
MetadataInvalidSelectException,
MetaDataClientServerException
MetaDataClientselectObjectGrouptbyId in interface MetaDataClientselectQuery - : select query Select as JsonNode
objectGroupId - : objectGroup id MetaDataExecutionException - thrown when internal Server Error (fatal technical exception thrown)MetaDataDocumentSizeException - thrown when Query document Size is Too LargeInvalidParseOperationException - thrown when the Query is badly formatted or objectGroupId is emptyMetadataInvalidSelectException - thrown when objectGroupId or selectQuery id is null or blankMetaDataClientServerExceptionpublic com.fasterxml.jackson.databind.JsonNode updateUnitbyId(com.fasterxml.jackson.databind.JsonNode updateQuery,
String unitId)
throws MetaDataExecutionException,
MetaDataDocumentSizeException,
InvalidParseOperationException,
MetaDataClientServerException,
MetaDataNotFoundException
MetaDataClientupdateUnitbyId in interface MetaDataClientupdateQuery - update query Select as JsonNode
unitId - unit id MetaDataExecutionException - thrown when internal Server Error (fatal technical exception thrown)MetaDataDocumentSizeException - thrown when Query document Size is Too LargeInvalidParseOperationExceptionMetaDataClientServerExceptionMetaDataNotFoundExceptionpublic com.fasterxml.jackson.databind.JsonNode insertObjectGroup(com.fasterxml.jackson.databind.JsonNode insertQuery)
throws InvalidParseOperationException,
MetaDataExecutionException,
MetaDataNotFoundException,
MetaDataAlreadyExistException,
MetaDataDocumentSizeException,
MetaDataClientServerException
insertObjectGroup in interface MetaDataClientinsertQuery - as StringInvalidParseOperationExceptionMetaDataExecutionExceptionMetaDataNotFoundExceptionMetaDataAlreadyExistExceptionMetaDataDocumentSizeExceptionMetaDataClientServerExceptionpublic void updateObjectGroupById(com.fasterxml.jackson.databind.JsonNode queryUpdate,
String objectGroupId)
throws InvalidParseOperationException,
MetaDataClientServerException,
MetaDataExecutionException
MetaDataClientupdateObjectGroupById in interface MetaDataClientInvalidParseOperationExceptionMetaDataClientServerExceptionMetaDataExecutionExceptionpublic List<UnitPerOriginatingAgency> selectAccessionRegisterOnUnitByOperationId(String operationId) throws MetaDataClientServerException
selectAccessionRegisterOnUnitByOperationId in interface MetaDataClientMetaDataClientServerExceptionpublic List<ObjectGroupPerOriginatingAgency> selectAccessionRegisterOnObjectByOperationId(String operationId) throws MetaDataClientServerException
selectAccessionRegisterOnObjectByOperationId in interface MetaDataClientMetaDataClientServerExceptionpublic boolean flushUnits()
throws MetaDataClientServerException
flushUnits in interface MetaDataClientMetaDataClientServerExceptionpublic boolean flushObjectGroups()
throws MetaDataClientServerException
flushObjectGroups in interface MetaDataClientMetaDataClientServerExceptionpublic com.fasterxml.jackson.databind.JsonNode reindex(IndexParameters indexParam) throws InvalidParseOperationException, MetaDataClientServerException, MetaDataNotFoundException
MetaDataClientreindex in interface MetaDataClientindexParam - reindexation parametersInvalidParseOperationExceptionMetaDataClientServerExceptionMetaDataNotFoundException - in case the index does not existpublic com.fasterxml.jackson.databind.JsonNode switchIndexes(SwitchIndexParameters switchIndexParam) throws InvalidParseOperationException, MetaDataClientServerException, MetaDataNotFoundException
MetaDataClientswitchIndexes in interface MetaDataClientswitchIndexParam - switch index parametersInvalidParseOperationExceptionMetaDataClientServerExceptionMetaDataNotFoundException - in case the index does not existpublic RequestResponse<com.fasterxml.jackson.databind.JsonNode> getUnitByIdRaw(String unitId) throws VitamClientException
MetaDataClientgetUnitByIdRaw in interface MetaDataClientunitId - : unit id VitamClientExceptionpublic RequestResponse<com.fasterxml.jackson.databind.JsonNode> getObjectGroupByIdRaw(String objectGroupId) throws VitamClientException
MetaDataClientgetObjectGroupByIdRaw in interface MetaDataClientobjectGroupId - : objectGroup id VitamClientExceptionprotected javax.ws.rs.client.Client getClient(boolean chunked)
throws IllegalStateException
IllegalStateExceptionpublic final void consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
MockOrRestClientconsumeAnyEntityAndClose in interface MockOrRestClientpublic static final void staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)
response - public void checkStatus()
throws VitamApplicationServerException
MockOrRestClientcheckStatus in interface MockOrRestClientVitamApplicationServerException - if the Server is unavailablepublic void checkStatus(javax.ws.rs.core.MultivaluedHashMap<String,Object> headers) throws VitamApplicationServerException
MockOrRestClientcheckStatus in interface MockOrRestClientVitamApplicationServerException - if the Server is unavailableprotected javax.ws.rs.core.Response performRequest(String httpMethod, String path, javax.ws.rs.core.MultivaluedHashMap<String,Object> headers, javax.ws.rs.core.MediaType accept) throws VitamClientInternalException
httpMethod - HTTP method to use for requestpath - URL to requestheaders - headers HTTP to add to request, may be nullaccept - asked type of responseVitamClientInternalExceptionprotected javax.ws.rs.core.Response performRequest(String httpMethod, String path, javax.ws.rs.core.MultivaluedHashMap<String,Object> headers, Object body, javax.ws.rs.core.MediaType contentType, javax.ws.rs.core.MediaType accept) throws VitamClientInternalException
httpMethod - HTTP method to use for requestpath - URL to requestheaders - headers HTTP to add to request, may be nullbody - body content of type contentType, may be nullcontentType - the media type of the body to send, null if body is nullaccept - asked type of responseVitamClientInternalExceptionprotected javax.ws.rs.core.Response performRequest(String httpMethod, String path, javax.ws.rs.core.MultivaluedHashMap<String,Object> headers, Object body, javax.ws.rs.core.MediaType contentType, javax.ws.rs.core.MediaType accept, boolean chunkedMode) throws VitamClientInternalException
httpMethod - HTTP method to use for requestpath - URL to requestheaders - headers HTTP to add to request, may be nullbody - body content of type contentType, may be nullcontentType - the media type of the body to send, null if body is nullaccept - asked type of responsechunkedMode - True use default client, else False use non Chunked mode clientVitamClientInternalExceptionprotected <T> Future<T> performAsyncRequest(String httpMethod, String path, javax.ws.rs.core.MultivaluedHashMap<String,Object> headers, Object body, javax.ws.rs.core.MediaType contentType, javax.ws.rs.core.MediaType accept, javax.ws.rs.client.InvocationCallback<T> callback) throws VitamClientInternalException
T - the type of the Future result (generally Response)httpMethod - HTTP method to use for requestpath - URL to requestheaders - headers HTTP to add to request, may be nullbody - body content of type contentType, may be nullcontentType - the media type of the body to send, null if body is nullaccept - asked type of responsecallback - VitamClientInternalExceptionprotected Future<javax.ws.rs.core.Response> performAsyncRequest(String httpMethod, String path, javax.ws.rs.core.MultivaluedHashMap<String,Object> headers, Object body, javax.ws.rs.core.MediaType contentType, javax.ws.rs.core.MediaType accept) throws VitamClientInternalException
httpMethod - HTTP method to use for requestpath - URL to requestheaders - headers HTTP to add to request, may be nullbody - body content of type contentType, may be nullcontentType - the media type of the body to send, null if body is nullaccept - asked type of responseVitamClientInternalExceptionprotected VitamClientException createExceptionFromResponse(javax.ws.rs.core.Response response)
response - responsepublic String getResourcePath()
MockOrRestClientgetResourcePath in interface MockOrRestClientpublic String getServiceUrl()
MockOrRestClientgetServiceUrl in interface MockOrRestClientpublic void close()
MockOrRestClientclose in interface MockOrRestClientclose in interface VitamAutoCloseableclose in interface AutoCloseablepublic VitamClientFactory<?> getVitamClientFactory()
Copyright © 2018 Vitam. All rights reserved.