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
FieldsFields inherited from interface fr.gouv.vitam.common.client.BasicClient
STATUS_URL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.ResponseabortTransaction(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.ResponseattachVitamOperationId(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.ResponsechangeTransactionStatus(String transactionId, TransactionStatus transactionStatus) Change Transaction Status Consume and produce MediaType.APPLICATION_JSONvoidCheck the status from the servicevoidcheckStatus(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 certificatevoidclose()Close the underneath http clientjavax.ws.rs.core.ResponsecloseTransaction(String transactionId) Close Transaction Consume and produce MediaType.APPLICATION_JSONfinal voidconsumeAnyEntityAndClose(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.Clientjavax.ws.rs.client.ClientRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>getObjectById(String gotId) get an object group by Id Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.ResponsegetObjectStreamByUnitId(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.Responsemake(VitamRequestBuilder request) javax.ws.rs.core.ResponsemakeSpecifyingUrl(VitamRequestBuilder request) RequestResponse<com.fasterxml.jackson.databind.JsonNode>reclassification(String transactionId, com.fasterxml.jackson.databind.JsonNode reclassificationRequest) Start a reclassification workflow on collectjavax.ws.rs.core.ResponsereopenTransaction(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 RulesRequestResponse<com.fasterxml.jackson.databind.JsonNode>startDeletion(String transactionId, DeletionRequestBody deletionRequestBody) Performs a deletion action workflow on collect.RequestResponse<com.fasterxml.jackson.databind.JsonNode>startEliminationAction(String transactionId, EliminationRequestBody eliminationRequestBody) Performs an elimination action workflow on collect.static voidstaticConsumeAnyEntityAndClose(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.ZIPvoiduploadZipToTransaction(String transactionId, InputStream inputStreamUploaded, String encoding, String attachementId) Upload zip and consume Consume and produce CommonMediaType.ZIPMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:CollectInternalClientInitialize a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
initProjectin 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:CollectInternalClientUpdate a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
updateProjectin 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:CollectInternalClientget a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
getProjectByIdin 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:CollectInternalClientget a collect transaction by ID Consume and produce MediaType.APPLICATION_JSON- Specified by:
getTransactionByIdin 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:CollectInternalClientget a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
getTransactionByProjectIdin 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:CollectInternalClientdelete a collect project produce MediaType.APPLICATION_JSON- Specified by:
deleteProjectByIdin 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:CollectInternalClientdelete a collect transaction produce MediaType.APPLICATION_JSON- Specified by:
deleteTransactionByIdin 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:CollectInternalClientget all collect project by tenant Consume and produce MediaType.APPLICATION_JSON- Specified by:
getProjectsin 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:CollectInternalClientget an archive unit by Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getUnitByIdin 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:CollectInternalClientget an archive unit by transaction Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getUnitsByTransactionin 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:CollectInternalClientget an object group by Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getObjectByIdin 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:CollectInternalClientInitialize a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
initTransactionin 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:CollectInternalClientADD Archive Unit Consume and produce MediaType.APPLICATION_JSON- Specified by:
uploadArchiveUnitin 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:CollectInternalClientADD Object Group Consume and produce MediaType.APPLICATION_JSON- Specified by:
addObjectGroupin 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:CollectInternalClientADD Binary Consume and produce MediaType.OCTET_STREAM- Specified by:
addBinaryin interfaceCollectInternalClient- Returns:
- Response
- Throws:
VitamClientException- exception occurs when parse operation failed
-
closeTransaction
Description copied from interface:CollectInternalClientClose Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
closeTransactionin interfaceCollectInternalClient- Returns:
- Response
- Throws:
VitamClientException- exception occurs when parse operation failed
-
generateSip
Description copied from interface:CollectInternalClientGenerate SIP + Send to Vitam produce and InputStream- Specified by:
generateSipin interfaceCollectInternalClient- Returns:
- InputStream
- Throws:
VitamClientException- exception occurs when parse operation failed
-
abortTransaction
Description copied from interface:CollectInternalClientAbort Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
abortTransactionin 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:CollectInternalClientReopen Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
reopenTransactionin interfaceCollectInternalClient- Returns:
- RequestResponseOK
- Throws:
VitamClientException- exception occurs when parse operation failed
-
uploadZipToTransaction
public void uploadZipToTransaction(String transactionId, InputStream inputStreamUploaded, @Nullable String encoding, @Nullable String attachementId) throws VitamClientException Description copied from interface:CollectInternalClientUpload zip and consume Consume and produce CommonMediaType.ZIP- Specified by:
uploadZipToTransactionin 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:CollectInternalClientUpload zip to a project with automatic transaction management Consume and produce CommonMediaType.ZIP- Specified by:
uploadZipToProjectin 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:CollectInternalClientGet all AU attached to transactions related to project Id param- Specified by:
getUnitsByProjectIdin interfaceCollectInternalClient- Returns:
- Throws:
VitamClientException
-
getObjectStreamByUnitId
public javax.ws.rs.core.Response getObjectStreamByUnitId(String unitId, String usage, int version) throws VitamClientException Description copied from interface:CollectInternalClientGet all AU attached to transactions related to project Id param- Specified by:
getObjectStreamByUnitIdin 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:CollectInternalClientget all projects by criteria Consume and produce MediaType.APPLICATION_JSON- Specified by:
searchProjectin 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:
updateUnitsWithCsvMetadatain interfaceCollectInternalClient- Throws:
VitamClientException
-
updateUnitsWithJsonlMetadata
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> updateUnitsWithJsonlMetadata(String transactionId, InputStream metadataJsonlInputStream) throws VitamClientException - Specified by:
updateUnitsWithJsonlMetadatain interfaceCollectInternalClient- Throws:
VitamClientException
-
updateTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> updateTransaction(TransactionDto transactionDto) throws VitamClientException Description copied from interface:CollectInternalClientUpdate a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
updateTransactionin 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:CollectInternalClientChange Transaction Status Consume and produce MediaType.APPLICATION_JSON- Specified by:
changeTransactionStatusin 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:CollectInternalClientselect Units With Inherited Rules- Specified by:
selectUnitsWithInheritedRulesin 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:CollectInternalClientAttach Vitam Operation Id To Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
attachVitamOperationIdin interfaceCollectInternalClient- Returns:
- Response
- Throws:
VitamClientException- exception occurs when parse operation failed
-
getTransactionsToAutomaticallyIngest
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getTransactionsToAutomaticallyIngest() throws VitamClientException- Specified by:
getTransactionsToAutomaticallyIngestin interfaceCollectInternalClient- Throws:
VitamClientException
-
bulkAtomicUpdateUnits
public RequestResponseOK<BulkAtomicUpdateResult> bulkAtomicUpdateUnits(String transactionId, com.fasterxml.jackson.databind.JsonNode updateQueriesJson) throws VitamClientException - Specified by:
bulkAtomicUpdateUnitsin interfaceCollectInternalClient- Throws:
VitamClientException
-
reclassification
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> reclassification(String transactionId, com.fasterxml.jackson.databind.JsonNode reclassificationRequest) throws VitamClientException Description copied from interface:CollectInternalClientStart a reclassification workflow on collect- Specified by:
reclassificationin interfaceCollectInternalClient- Parameters:
transactionId- transaction IdreclassificationRequest- List of attachment and detachment operations in unit graph.- Returns:
- Response
- Throws:
VitamClientException
-
startEliminationAction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> startEliminationAction(String transactionId, EliminationRequestBody eliminationRequestBody) throws VitamClientException Description copied from interface:CollectInternalClientPerforms an elimination action workflow on collect.- Specified by:
startEliminationActionin interfaceCollectInternalClient- Parameters:
transactionId- transaction IdeliminationRequestBody- Dsl request for elimination.- Returns:
- Response given response
- Throws:
VitamClientException
-
startDeletion
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> startDeletion(String transactionId, DeletionRequestBody deletionRequestBody) throws VitamClientException Description copied from interface:CollectInternalClientPerforms a deletion action workflow on collect.- Specified by:
startDeletionin interfaceCollectInternalClient- Parameters:
transactionId- transaction IddeletionRequestBody- Dsl request for deletion.- Returns:
- Response given response
- 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:MockOrRestClientHelper when an error occurs on client usage side to consume response however- Specified by:
consumeAnyEntityAndClosein interfaceMockOrRestClient
-
checkStatus
Description copied from interface:MockOrRestClientCheck the status from the service- Specified by:
checkStatusin 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:MockOrRestClientCheck the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificate- Specified by:
checkStatusin interfaceMockOrRestClient- Throws:
VitamApplicationServerException- if the Server is unavailable
-
getResourcePath
Description copied from interface:MockOrRestClientGet the resource path of the server.- Specified by:
getResourcePathin interfaceMockOrRestClient- Returns:
- the resource path as string
-
getServiceUrl
Description copied from interface:MockOrRestClientGet the service URL- Specified by:
getServiceUrlin interfaceMockOrRestClient- Returns:
- the service URL
-
close
public void close()Description copied from interface:MockOrRestClientClose the underneath http client- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMockOrRestClient- Specified by:
closein 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()
-