public class MetaDataClientRest extends DefaultClient implements MetaDataClient
| Modifier and Type | Field and Description |
|---|---|
String |
COMPUTE_GRAPH_URI |
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
|
GraphComputeResponse |
computeGraph(GraphComputeResponse.GraphComputeAction action,
Set<String> ids)
Compute graph of all document match ids.
|
GraphComputeResponse |
computeGraph(com.fasterxml.jackson.databind.JsonNode queryDsl)
Compute graph of all Units/Got that match the given query dsl
The returned number of treated object group is an estimation, as object group can be computed several times
|
void |
consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
Helper when an error occurs on client usage side to consume response however
|
com.fasterxml.jackson.databind.JsonNode |
createAccessionRegisterSymbolic()
Creates the AccessionRegisterSymbolics from ElasticSearch aggregations and nested aggregation request.
|
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.
|
void |
deleteObjectGroupBulk(Collection<String> listIds)
Delete Object Group Bulk
|
void |
deleteUnitsBulk(Collection<String> listIds)
delete UnitsBulk
|
void |
exportReclassificationChildNodes(Set<String> ids,
String unitsToUpdateChainedFileName,
String objectGroupsToUpdateChainedFileName)
Export all units and object groups that are a descendants of the provided units to workspace for graph update.
|
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 |
insertObjectGroups(List<com.fasterxml.jackson.databind.JsonNode> insertQueries) |
com.fasterxml.jackson.databind.JsonNode |
insertUnit(com.fasterxml.jackson.databind.JsonNode insertQuery) |
com.fasterxml.jackson.databind.JsonNode |
insertUnitBulk(List<com.fasterxml.jackson.databind.node.ObjectNode> 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
|
boolean |
refreshObjectGroups() |
boolean |
refreshUnits() |
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)
|
com.fasterxml.jackson.databind.JsonNode |
selectUnitsWithInheritedRules(com.fasterxml.jackson.databind.JsonNode selectQuery)
Select units with inherited rules 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
|
RequestResponse<com.fasterxml.jackson.databind.JsonNode> |
updateUnitBulk(com.fasterxml.jackson.databind.JsonNode updateQuery)
Update units Bulk.
|
com.fasterxml.jackson.databind.JsonNode |
updateUnitbyId(com.fasterxml.jackson.databind.JsonNode updateQuery,
String unitId)
Update units by query (DSL) and path unit id
|
RequestResponse<com.fasterxml.jackson.databind.JsonNode> |
updateUnitsRulesBulk(com.fasterxml.jackson.databind.JsonNode query,
com.fasterxml.jackson.databind.JsonNode actions,
Map<String,DurationData> rulesToDurationData)
Update units rules Bulk.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcheckStatus, checkStatus, close, consumeAnyEntityAndClose, getResourcePath, getServiceUrlpublic final String COMPUTE_GRAPH_URI
public static final String DESCRIPTION
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 insertUnitBulk(List<com.fasterxml.jackson.databind.node.ObjectNode> insertQuery) throws InvalidParseOperationException, MetaDataExecutionException, MetaDataNotFoundException, MetaDataAlreadyExistException, MetaDataDocumentSizeException, MetaDataClientServerException
public com.fasterxml.jackson.databind.JsonNode selectUnits(com.fasterxml.jackson.databind.JsonNode selectQuery)
throws MetaDataExecutionException,
MetaDataDocumentSizeException,
InvalidParseOperationException,
MetaDataClientServerException
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 LargeInvalidParseOperationExceptionMetaDataClientServerExceptionpublic 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 com.fasterxml.jackson.databind.JsonNode insertObjectGroups(List<com.fasterxml.jackson.databind.JsonNode> insertQueries) throws InvalidParseOperationException, MetaDataExecutionException, MetaDataNotFoundException, MetaDataAlreadyExistException, MetaDataDocumentSizeException, MetaDataClientServerException
public 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 refreshUnits()
throws MetaDataClientServerException
refreshUnits in interface MetaDataClientMetaDataClientServerExceptionpublic boolean refreshObjectGroups()
throws MetaDataClientServerException
refreshObjectGroups 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 VitamClientExceptionpublic GraphComputeResponse computeGraph(com.fasterxml.jackson.databind.JsonNode queryDsl) throws VitamClientException
MetaDataClientcomputeGraph in interface MetaDataClientVitamClientExceptionpublic GraphComputeResponse computeGraph(GraphComputeResponse.GraphComputeAction action, Set<String> ids) throws VitamClientException
MetaDataClientcomputeGraph in interface MetaDataClientVitamClientExceptionpublic void exportReclassificationChildNodes(Set<String> ids, String unitsToUpdateChainedFileName, String objectGroupsToUpdateChainedFileName) throws VitamClientException, MetaDataExecutionException
MetaDataClientexportReclassificationChildNodes in interface MetaDataClientids - the unit ids for which all descendant nodes (units and object groups) are to be updated.VitamClientExceptionMetaDataExecutionExceptionpublic void deleteUnitsBulk(Collection<String> listIds) throws MetaDataExecutionException, MetaDataClientServerException
MetaDataClientdeleteUnitsBulk in interface MetaDataClientlistIds - list of id to deleteMetaDataExecutionException - MetaDataExecutionExceptionMetaDataClientServerException - MetaDataClientServerExceptionpublic void deleteObjectGroupBulk(Collection<String> listIds) throws MetaDataExecutionException, MetaDataClientServerException
MetaDataClientdeleteObjectGroupBulk in interface MetaDataClientlistIds - list of id to deleteMetaDataExecutionException - MetaDataExecutionExceptionMetaDataClientServerException - MetaDataClientServerExceptionpublic RequestResponse<com.fasterxml.jackson.databind.JsonNode> updateUnitBulk(com.fasterxml.jackson.databind.JsonNode updateQuery) throws InvalidParseOperationException, MetaDataExecutionException, MetaDataNotFoundException, MetaDataDocumentSizeException, MetaDataClientServerException
updateUnitBulk in interface MetaDataClientupdateQuery - InvalidParseOperationExceptionMetaDataExecutionExceptionMetaDataNotFoundExceptionMetaDataDocumentSizeExceptionMetaDataClientServerExceptionpublic RequestResponse<com.fasterxml.jackson.databind.JsonNode> updateUnitsRulesBulk(com.fasterxml.jackson.databind.JsonNode query, com.fasterxml.jackson.databind.JsonNode actions, Map<String,DurationData> rulesToDurationData) throws InvalidParseOperationException, MetaDataExecutionException, MetaDataNotFoundException, MetaDataDocumentSizeException, MetaDataClientServerException
MetaDataClientupdateUnitsRulesBulk in interface MetaDataClientInvalidParseOperationExceptionMetaDataExecutionExceptionMetaDataNotFoundExceptionMetaDataDocumentSizeExceptionMetaDataClientServerExceptionpublic com.fasterxml.jackson.databind.JsonNode selectUnitsWithInheritedRules(com.fasterxml.jackson.databind.JsonNode selectQuery)
throws MetaDataDocumentSizeException,
InvalidParseOperationException,
MetaDataClientServerException,
MetaDataExecutionException
MetaDataClientselectUnitsWithInheritedRules in interface MetaDataClientselectQuery - : select queryMetaDataDocumentSizeException - thrown when Query document Size is Too LargeInvalidParseOperationExceptionMetaDataClientServerExceptionMetaDataExecutionExceptionpublic com.fasterxml.jackson.databind.JsonNode createAccessionRegisterSymbolic()
throws MetaDataClientServerException,
MetaDataExecutionException
MetaDataClientcreateAccessionRegisterSymbolic in interface MetaDataClientMetaDataClientServerExceptionMetaDataExecutionExceptionprotected 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.