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,java.lang.AutoCloseable
public class CollectInternalClientRest extends DefaultClient implements CollectInternalClient
Collect Client implementation for production environment
-
-
Field Summary
-
Fields inherited from interface fr.gouv.vitam.common.client.BasicClient
STATUS_URL
-
-
Constructor Summary
Constructors Constructor Description CollectInternalClientRest(VitamClientFactoryInterface<?> factory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.ResponseabortTransaction(java.lang.String transactionId)Abort Transaction Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>addBinary(java.lang.String unitId, java.lang.Integer version, java.io.InputStream inputStreamUploaded, java.lang.String usage)ADD Binary Consume and produce MediaType.OCTET_STREAMRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>addObjectGroup(java.lang.String unitId, java.lang.Integer version, com.fasterxml.jackson.databind.JsonNode objectJsonNode, java.lang.String usage)ADD Object Group Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.ResponseattachVitamOperationId(java.lang.String transactionId, java.lang.String operationId)Attach Vitam Operation Id To Transaction Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.ResponsechangeTransactionStatus(java.lang.String transactionId, TransactionStatus transactionStatus)Change Transaction Status Consume and produce MediaType.APPLICATION_JSONvoidcheckStatus()Check the status from the servicevoidcheckStatus(javax.ws.rs.core.MultivaluedHashMap<java.lang.String,java.lang.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(java.lang.String transactionId)Close Transaction Consume and produce MediaType.APPLICATION_JSONvoidconsumeAnyEntityAndClose(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(java.lang.String projectId)delete a collect project produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>deleteTransactionById(java.lang.String transactionId)delete a collect transaction produce MediaType.APPLICATION_JSONjava.io.InputStreamgenerateSip(java.lang.String transactionId)Generate SIP + Send to Vitam produce and InputStreamjavax.ws.rs.client.ClientgetChunkedClient()javax.ws.rs.client.ClientgetClient()VitamClientFactory<?>getClientFactory()RequestResponseOK<com.fasterxml.jackson.databind.JsonNode>getObjectById(java.lang.String gotId)get an object group by Id Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.ResponsegetObjectStreamByUnitId(java.lang.String unitId, java.lang.String usage, int version)Get all AU attached to transactions related to project Id paramRequestResponse<com.fasterxml.jackson.databind.JsonNode>getProjectById(java.lang.String projectId)get a collect project Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>getProjects()get all collect project by tenant Consume and produce MediaType.APPLICATION_JSONjava.lang.StringgetResourcePath()Get the resource path of the server.java.lang.StringgetServiceUrl()Get the service URLRequestResponse<com.fasterxml.jackson.databind.JsonNode>getTransactionById(java.lang.String transactionId)get a collect transaction by ID Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>getTransactionByProjectId(java.lang.String projectId)get a collect transaction Consume and produce MediaType.APPLICATION_JSONRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>getUnitById(java.lang.String unitId)get an archive unit by Id Consume and produce MediaType.APPLICATION_JSONRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>getUnitsByProjectId(java.lang.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(java.lang.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, java.lang.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)javax.ws.rs.core.ResponsereopenTransaction(java.lang.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(java.lang.String transactionId, com.fasterxml.jackson.databind.JsonNode selectQuery)select Units With Inherited Rulesstatic voidstaticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)This method consume everything (in particular InputStream) and close the response.java.lang.StringtoString()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>updateUnits(java.lang.String transactionId, java.io.InputStream is)RequestResponseOK<com.fasterxml.jackson.databind.JsonNode>uploadArchiveUnit(com.fasterxml.jackson.databind.JsonNode unitJsonNode, java.lang.String transactionId)ADD Archive Unit Consume and produce MediaType.APPLICATION_JSONvoiduploadTransactionZip(java.lang.String transactionId, java.io.InputStream inputStreamUploaded)Upload zip and consume Consume and produce CommonMediaType.ZIP-
Methods 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
-
-
-
-
Constructor Detail
-
CollectInternalClientRest
public CollectInternalClientRest(VitamClientFactoryInterface<?> factory)
-
-
Method Detail
-
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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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 VitamClientException
Description 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(java.lang.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(java.lang.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(java.lang.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, java.lang.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, java.lang.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(java.lang.String unitId, java.lang.Integer version, com.fasterxml.jackson.databind.JsonNode objectJsonNode, java.lang.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(java.lang.String unitId, java.lang.Integer version, java.io.InputStream inputStreamUploaded, java.lang.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
public javax.ws.rs.core.Response closeTransaction(java.lang.String transactionId) throws VitamClientExceptionDescription 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
public java.io.InputStream generateSip(java.lang.String transactionId) throws VitamClientExceptionDescription 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
public javax.ws.rs.core.Response abortTransaction(java.lang.String transactionId) throws VitamClientExceptionDescription 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(java.lang.String transactionId) throws VitamClientExceptionDescription 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
-
uploadTransactionZip
public void uploadTransactionZip(java.lang.String transactionId, java.io.InputStream inputStreamUploaded) throws VitamClientExceptionDescription copied from interface:CollectInternalClientUpload zip and consume Consume and produce CommonMediaType.ZIP- Specified by:
uploadTransactionZipin interfaceCollectInternalClient- Throws:
VitamClientException- exception occurs when parse operation failed
-
getUnitsByProjectId
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getUnitsByProjectId(java.lang.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(java.lang.String unitId, java.lang.String usage, int version) throws VitamClientExceptionDescription 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
-
updateUnits
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> updateUnits(java.lang.String transactionId, java.io.InputStream is) throws VitamClientException
- Specified by:
updateUnitsin 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(java.lang.String transactionId, TransactionStatus transactionStatus) throws VitamClientExceptionDescription 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(java.lang.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(java.lang.String transactionId, java.lang.String operationId) throws VitamClientExceptionDescription 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
-
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
public void checkStatus() throws VitamApplicationServerExceptionDescription 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<java.lang.String,java.lang.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
public java.lang.String getResourcePath()
Description copied from interface:MockOrRestClientGet the resource path of the server.- Specified by:
getResourcePathin interfaceMockOrRestClient- Returns:
- the resource path as string
-
getServiceUrl
public java.lang.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 interfacejava.lang.AutoCloseable- Specified by:
closein interfaceMockOrRestClient- Specified by:
closein interfaceVitamAutoCloseable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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
public VitamClientFactory<?> getClientFactory()
-
getClient
public javax.ws.rs.client.Client getClient()
-
getChunkedClient
public javax.ws.rs.client.Client getChunkedClient()
-
-