Class CollectInternalClientRest
java.lang.Object
fr.gouv.vitam.common.client.DefaultClient
fr.gouv.vitam.collect.internal.client.CollectInternalClientRest
- All Implemented Interfaces:
CollectInternalClient
,BasicClient
,MockOrRestClient
,VitamAutoCloseable
,AutoCloseable
Collect Client implementation for production environment
-
Field Summary
Fields inherited from interface fr.gouv.vitam.common.client.BasicClient
STATUS_URL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.Response
abortTransaction
(String transactionId) Abort Transaction Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
addBinary
(String unitId, Integer version, InputStream inputStreamUploaded, String usage) ADD Binary Consume and produce MediaType.OCTET_STREAMRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>
addObjectGroup
(String unitId, Integer version, com.fasterxml.jackson.databind.JsonNode objectJsonNode, String usage) ADD Object Group Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.Response
attachVitamOperationId
(String transactionId, String operationId) Attach Vitam Operation Id To Transaction Consume and produce MediaType.APPLICATION_JSONbulkAtomicUpdateUnits
(String transactionId, com.fasterxml.jackson.databind.JsonNode updateQueriesJson) javax.ws.rs.core.Response
changeTransactionStatus
(String transactionId, TransactionStatus transactionStatus) Change Transaction Status Consume and produce MediaType.APPLICATION_JSONvoid
Check the status from the servicevoid
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 certificatevoid
close()
Close the underneath http clientjavax.ws.rs.core.Response
closeTransaction
(String transactionId) Close Transaction Consume and produce MediaType.APPLICATION_JSONfinal void
consumeAnyEntityAndClose
(javax.ws.rs.core.Response response) Helper when an error occurs on client usage side to consume response howeverRequestResponse<com.fasterxml.jackson.databind.JsonNode>
deleteProjectById
(String projectId) delete a collect project produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
deleteTransactionById
(String transactionId) delete a collect transaction produce MediaType.APPLICATION_JSONgenerateSip
(String transactionId) Generate SIP + Send to Vitam produce and InputStreamjavax.ws.rs.client.Client
javax.ws.rs.client.Client
RequestResponseOK<com.fasterxml.jackson.databind.JsonNode>
getObjectById
(String gotId) get an object group by Id Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.Response
getObjectStreamByUnitId
(String unitId, String usage, int version) Get all AU attached to transactions related to project Id paramRequestResponse<com.fasterxml.jackson.databind.JsonNode>
getProjectById
(String projectId) get a collect project Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
get all collect project by tenant Consume and produce MediaType.APPLICATION_JSONGet the resource path of the server.Get the service URLRequestResponse<com.fasterxml.jackson.databind.JsonNode>
getTransactionById
(String transactionId) get a collect transaction by ID Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
getTransactionByProjectId
(String projectId) get a collect transaction Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
RequestResponseOK<com.fasterxml.jackson.databind.JsonNode>
getUnitById
(String unitId) get an archive unit by Id Consume and produce MediaType.APPLICATION_JSONRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>
getUnitsByProjectId
(String projectId, com.fasterxml.jackson.databind.JsonNode dslQuery) Get all AU attached to transactions related to project Id paramRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>
getUnitsByTransaction
(String transactionId, com.fasterxml.jackson.databind.JsonNode query) get an archive unit by transaction Id Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
initProject
(ProjectDto projectDto) Initialize a collect project Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
initTransaction
(TransactionDto transactionDto, String projectId) Initialize a collect transaction Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.Response
make
(VitamRequestBuilder request) javax.ws.rs.core.Response
makeSpecifyingUrl
(VitamRequestBuilder request) javax.ws.rs.core.Response
reopenTransaction
(String transactionId) Reopen Transaction Consume and produce MediaType.APPLICATION_JSONRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>
searchProject
(CriteriaProjectDto criteria) get all projects by criteria Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
selectUnitsWithInheritedRules
(String transactionId, com.fasterxml.jackson.databind.JsonNode selectQuery) select Units With Inherited Rulesstatic void
staticConsumeAnyEntityAndClose
(javax.ws.rs.core.Response response) This method consume everything (in particular InputStream) and close the response.toString()
RequestResponse<com.fasterxml.jackson.databind.JsonNode>
updateProject
(ProjectDto projectDto) Update a collect project Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
updateTransaction
(TransactionDto transactionDto) Update a collect transaction Consume and produce MediaType.APPLICATION_JSONRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>
updateUnitsWithCsvMetadata
(String transactionId, InputStream metadataCsvInputStream) RequestResponseOK<com.fasterxml.jackson.databind.JsonNode>
updateUnitsWithJsonlMetadata
(String transactionId, InputStream metadataJsonlInputStream) RequestResponseOK<com.fasterxml.jackson.databind.JsonNode>
uploadArchiveUnit
(com.fasterxml.jackson.databind.JsonNode unitJsonNode, String transactionId) ADD Archive Unit Consume and produce MediaType.APPLICATION_JSONuploadZipToProject
(String projectId, InputStream inputStreamUploaded, String encoding) Upload zip to a project with automatic transaction management Consume and produce CommonMediaType.ZIPvoid
uploadZipToTransaction
(String transactionId, InputStream inputStreamUploaded, String encoding) Upload zip and consume Consume and produce CommonMediaType.ZIPMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface fr.gouv.vitam.common.client.MockOrRestClient
checkStatus, checkStatus, close, consumeAnyEntityAndClose, getResourcePath, getServiceUrl
-
Field Details
-
UNITS_BULK
- See Also:
-
-
Constructor Details
-
CollectInternalClientRest
-
-
Method Details
-
initProject
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> initProject(ProjectDto projectDto) throws VitamClientException Description copied from interface:CollectInternalClient
Initialize a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
initProject
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
updateProject
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> updateProject(ProjectDto projectDto) throws VitamClientException Description copied from interface:CollectInternalClient
Update a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
updateProject
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getProjectById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getProjectById(String projectId) throws VitamClientException Description copied from interface:CollectInternalClient
get a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
getProjectById
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getTransactionById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getTransactionById(String transactionId) throws VitamClientException Description copied from interface:CollectInternalClient
get a collect transaction by ID Consume and produce MediaType.APPLICATION_JSON- Specified by:
getTransactionById
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getTransactionByProjectId
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getTransactionByProjectId(String projectId) throws VitamClientException Description copied from interface:CollectInternalClient
get a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
getTransactionByProjectId
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
deleteProjectById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> deleteProjectById(String projectId) throws VitamClientException Description copied from interface:CollectInternalClient
delete a collect project produce MediaType.APPLICATION_JSON- Specified by:
deleteProjectById
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
deleteTransactionById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> deleteTransactionById(String transactionId) throws VitamClientException Description copied from interface:CollectInternalClient
delete a collect transaction produce MediaType.APPLICATION_JSON- Specified by:
deleteTransactionById
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getProjects
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getProjects() throws VitamClientExceptionDescription copied from interface:CollectInternalClient
get all collect project by tenant Consume and produce MediaType.APPLICATION_JSON- Specified by:
getProjects
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getUnitById
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getUnitById(String unitId) throws VitamClientException Description copied from interface:CollectInternalClient
get an archive unit by Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getUnitById
in interfaceCollectInternalClient
- Returns:
- RequestResponseOK
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getUnitsByTransaction
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getUnitsByTransaction(String transactionId, com.fasterxml.jackson.databind.JsonNode query) throws VitamClientException Description copied from interface:CollectInternalClient
get an archive unit by transaction Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getUnitsByTransaction
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getObjectById
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getObjectById(String gotId) throws VitamClientException Description copied from interface:CollectInternalClient
get an object group by Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getObjectById
in interfaceCollectInternalClient
- Returns:
- RequestResponseOK
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
initTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> initTransaction(TransactionDto transactionDto, String projectId) throws VitamClientException Description copied from interface:CollectInternalClient
Initialize a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
initTransaction
in interfaceCollectInternalClient
- Returns:
- RequestResponse
guid created for the transaction - Throws:
VitamClientException
- exception occurs when parse operation failed
-
uploadArchiveUnit
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> uploadArchiveUnit(com.fasterxml.jackson.databind.JsonNode unitJsonNode, String transactionId) throws VitamClientException Description copied from interface:CollectInternalClient
ADD Archive Unit Consume and produce MediaType.APPLICATION_JSON- Specified by:
uploadArchiveUnit
in interfaceCollectInternalClient
- Returns:
- RequestResponse
Archive Unit saved - Throws:
VitamClientException
- exception occurs when parse operation failed
-
addObjectGroup
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> addObjectGroup(String unitId, Integer version, com.fasterxml.jackson.databind.JsonNode objectJsonNode, String usage) throws VitamClientException Description copied from interface:CollectInternalClient
ADD Object Group Consume and produce MediaType.APPLICATION_JSON- Specified by:
addObjectGroup
in interfaceCollectInternalClient
- Returns:
- RequestResponse
objectgroup saved - Throws:
VitamClientException
- exception occurs when parse operation failed
-
addBinary
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> addBinary(String unitId, Integer version, InputStream inputStreamUploaded, String usage) throws VitamClientException Description copied from interface:CollectInternalClient
ADD Binary Consume and produce MediaType.OCTET_STREAM- Specified by:
addBinary
in interfaceCollectInternalClient
- Returns:
- Response
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
closeTransaction
Description copied from interface:CollectInternalClient
Close Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
closeTransaction
in interfaceCollectInternalClient
- Returns:
- Response
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
generateSip
Description copied from interface:CollectInternalClient
Generate SIP + Send to Vitam produce and InputStream- Specified by:
generateSip
in interfaceCollectInternalClient
- Returns:
- InputStream
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
abortTransaction
Description copied from interface:CollectInternalClient
Abort Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
abortTransaction
in interfaceCollectInternalClient
- Returns:
- Response
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
reopenTransaction
public javax.ws.rs.core.Response reopenTransaction(String transactionId) throws VitamClientException Description copied from interface:CollectInternalClient
Reopen Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
reopenTransaction
in interfaceCollectInternalClient
- Returns:
- RequestResponseOK
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
uploadZipToTransaction
public void uploadZipToTransaction(String transactionId, InputStream inputStreamUploaded, @Nullable String encoding) throws VitamClientException Description copied from interface:CollectInternalClient
Upload zip and consume Consume and produce CommonMediaType.ZIP- Specified by:
uploadZipToTransaction
in interfaceCollectInternalClient
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
uploadZipToProject
public String uploadZipToProject(String projectId, InputStream inputStreamUploaded, @Nullable String encoding) throws VitamClientException Description copied from interface:CollectInternalClient
Upload zip to a project with automatic transaction management Consume and produce CommonMediaType.ZIP- Specified by:
uploadZipToProject
in interfaceCollectInternalClient
- Returns:
- Response
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getUnitsByProjectId
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getUnitsByProjectId(String projectId, com.fasterxml.jackson.databind.JsonNode dslQuery) throws VitamClientException Description copied from interface:CollectInternalClient
Get all AU attached to transactions related to project Id param- Specified by:
getUnitsByProjectId
in interfaceCollectInternalClient
- Returns:
- Throws:
VitamClientException
-
getObjectStreamByUnitId
public javax.ws.rs.core.Response getObjectStreamByUnitId(String unitId, String usage, int version) throws VitamClientException Description copied from interface:CollectInternalClient
Get all AU attached to transactions related to project Id param- Specified by:
getObjectStreamByUnitId
in interfaceCollectInternalClient
- Parameters:
unitId
- unit idusage
- usageversion
- version- Returns:
- Response
- Throws:
VitamClientException
- Thrown exception
-
searchProject
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> searchProject(CriteriaProjectDto criteria) throws VitamClientException Description copied from interface:CollectInternalClient
get all projects by criteria Consume and produce MediaType.APPLICATION_JSON- Specified by:
searchProject
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
updateUnitsWithCsvMetadata
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> updateUnitsWithCsvMetadata(String transactionId, InputStream metadataCsvInputStream) throws VitamClientException - Specified by:
updateUnitsWithCsvMetadata
in interfaceCollectInternalClient
- Throws:
VitamClientException
-
updateUnitsWithJsonlMetadata
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> updateUnitsWithJsonlMetadata(String transactionId, InputStream metadataJsonlInputStream) throws VitamClientException - Specified by:
updateUnitsWithJsonlMetadata
in interfaceCollectInternalClient
- Throws:
VitamClientException
-
updateTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> updateTransaction(TransactionDto transactionDto) throws VitamClientException Description copied from interface:CollectInternalClient
Update a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
updateTransaction
in interfaceCollectInternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
changeTransactionStatus
public javax.ws.rs.core.Response changeTransactionStatus(String transactionId, TransactionStatus transactionStatus) throws VitamClientException Description copied from interface:CollectInternalClient
Change Transaction Status Consume and produce MediaType.APPLICATION_JSON- Specified by:
changeTransactionStatus
in interfaceCollectInternalClient
- Returns:
- Response
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
selectUnitsWithInheritedRules
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> selectUnitsWithInheritedRules(String transactionId, com.fasterxml.jackson.databind.JsonNode selectQuery) throws VitamClientException Description copied from interface:CollectInternalClient
select Units With Inherited Rules- Specified by:
selectUnitsWithInheritedRules
in interfaceCollectInternalClient
- Parameters:
transactionId
- transaction IdselectQuery
- dsl query- Returns:
- Response
- Throws:
VitamClientException
- exception
-
attachVitamOperationId
public javax.ws.rs.core.Response attachVitamOperationId(String transactionId, String operationId) throws VitamClientException Description copied from interface:CollectInternalClient
Attach Vitam Operation Id To Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
attachVitamOperationId
in interfaceCollectInternalClient
- Returns:
- Response
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getTransactionsToAutomaticallyIngest
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getTransactionsToAutomaticallyIngest() throws VitamClientException- Specified by:
getTransactionsToAutomaticallyIngest
in interfaceCollectInternalClient
- Throws:
VitamClientException
-
bulkAtomicUpdateUnits
public RequestResponseOK<BulkAtomicUpdateResult> bulkAtomicUpdateUnits(String transactionId, com.fasterxml.jackson.databind.JsonNode updateQueriesJson) throws VitamClientException - Specified by:
bulkAtomicUpdateUnits
in interfaceCollectInternalClient
- Throws:
VitamClientException
-
staticConsumeAnyEntityAndClose
public static void staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response) This method consume everything (in particular InputStream) and close the response.- Parameters:
response
-
-
consumeAnyEntityAndClose
public final void consumeAnyEntityAndClose(javax.ws.rs.core.Response response) Description copied from interface:MockOrRestClient
Helper when an error occurs on client usage side to consume response however- Specified by:
consumeAnyEntityAndClose
in interfaceMockOrRestClient
-
checkStatus
Description copied from interface:MockOrRestClient
Check the status from the service- Specified by:
checkStatus
in interfaceMockOrRestClient
- Throws:
VitamApplicationServerException
- if the Server is unavailable
-
checkStatus
public void checkStatus(javax.ws.rs.core.MultivaluedHashMap<String, Object> headers) throws VitamApplicationServerExceptionDescription copied from interface:MockOrRestClient
Check the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificate- Specified by:
checkStatus
in interfaceMockOrRestClient
- Throws:
VitamApplicationServerException
- if the Server is unavailable
-
getResourcePath
Description copied from interface:MockOrRestClient
Get the resource path of the server.- Specified by:
getResourcePath
in interfaceMockOrRestClient
- Returns:
- the resource path as string
-
getServiceUrl
Description copied from interface:MockOrRestClient
Get the service URL- Specified by:
getServiceUrl
in interfaceMockOrRestClient
- Returns:
- the service URL
-
close
public void close()Description copied from interface:MockOrRestClient
Close the underneath http client- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceMockOrRestClient
- Specified by:
close
in interfaceVitamAutoCloseable
-
toString
-
makeSpecifyingUrl
public javax.ws.rs.core.Response makeSpecifyingUrl(VitamRequestBuilder request) throws VitamClientInternalException - Throws:
VitamClientInternalException
-
make
public javax.ws.rs.core.Response make(VitamRequestBuilder request) throws VitamClientInternalException - Throws:
VitamClientInternalException
-
getClientFactory
-
getClient
public javax.ws.rs.client.Client getClient() -
getChunkedClient
public javax.ws.rs.client.Client getChunkedClient()
-