Class CollectInternalClientRestMock
- java.lang.Object
-
- fr.gouv.vitam.common.client.AbstractMockClient
-
- fr.gouv.vitam.collect.internal.client.CollectInternalClientRestMock
-
- All Implemented Interfaces:
CollectInternalClient
,MockOrRestClient
,VitamAutoCloseable
,java.lang.AutoCloseable
public class CollectInternalClientRestMock extends AbstractMockClient implements CollectInternalClient
Collect Client implementation for production environment
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class fr.gouv.vitam.common.client.AbstractMockClient
AbstractMockClient.FakeInboundResponse
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TRANSACTION_ID
-
Constructor Summary
Constructors Constructor Description CollectInternalClientRestMock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Response
abortTransaction(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.Response
attachVitamOperationId(java.lang.String transactionId, java.lang.String operationId)
Attach Vitam Operation Id To Transaction Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.Response
changeTransactionStatus(java.lang.String transactionId, TransactionStatus transactionStatus)
Change Transaction Status Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.Response
closeTransaction(java.lang.String transactionId)
Close Transaction Consume and produce MediaType.APPLICATION_JSONRequestResponse<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.InputStream
generateSip(java.lang.String transactionId)
Generate SIP + Send to Vitam produce and InputStreamRequestResponseOK<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.Response
getObjectStreamByUnitId(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_JSONRequestResponse<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.Response
reopenTransaction(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 RulesRequestResponse<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_JSONvoid
uploadTransactionZip(java.lang.String transactionId, java.io.InputStream inputStreamUploaded)
Upload zip and consume Consume and produce CommonMediaType.ZIP-
Methods inherited from class fr.gouv.vitam.common.client.AbstractMockClient
checkStatus, checkStatus, close, consumeAnyEntityAndClose, getResourcePath, getServiceUrl
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface fr.gouv.vitam.common.client.MockOrRestClient
checkStatus, checkStatus, close, consumeAnyEntityAndClose, getResourcePath, getServiceUrl
-
-
-
-
Method Detail
-
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)
Description copied from interface:CollectInternalClient
Update a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
updateProject
in interfaceCollectInternalClient
- Returns:
- RequestResponse
-
getProjectById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getProjectById(java.lang.String projectId)
Description copied from interface:CollectInternalClient
get a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
getProjectById
in interfaceCollectInternalClient
- Returns:
- RequestResponse
-
getTransactionByProjectId
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getTransactionByProjectId(java.lang.String projectId)
Description copied from interface:CollectInternalClient
get a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
getTransactionByProjectId
in interfaceCollectInternalClient
- Returns:
- RequestResponse
-
getTransactionById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getTransactionById(java.lang.String transactionId)
Description copied from interface:CollectInternalClient
get a collect transaction by ID Consume and produce MediaType.APPLICATION_JSON- Specified by:
getTransactionById
in interfaceCollectInternalClient
- Returns:
- RequestResponse
-
getProjects
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getProjects()
Description copied from interface:CollectInternalClient
get all collect project by tenant Consume and produce MediaType.APPLICATION_JSON- Specified by:
getProjects
in interfaceCollectInternalClient
- Returns:
- RequestResponse
-
deleteTransactionById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> deleteTransactionById(java.lang.String transactionId)
Description copied from interface:CollectInternalClient
delete a collect transaction produce MediaType.APPLICATION_JSON- Specified by:
deleteTransactionById
in interfaceCollectInternalClient
- Returns:
- RequestResponse
-
deleteProjectById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> deleteProjectById(java.lang.String projectId)
Description copied from interface:CollectInternalClient
delete a collect project produce MediaType.APPLICATION_JSON- Specified by:
deleteProjectById
in interfaceCollectInternalClient
- Returns:
- RequestResponse
-
getUnitById
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getUnitById(java.lang.String unitId)
Description copied from interface:CollectInternalClient
get an archive unit by Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getUnitById
in interfaceCollectInternalClient
- Returns:
- RequestResponseOK
-
getUnitsByTransaction
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getUnitsByTransaction(java.lang.String transactionId, com.fasterxml.jackson.databind.JsonNode query)
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
-
getObjectById
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getObjectById(java.lang.String gotId)
Description copied from interface:CollectInternalClient
get an object group by Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getObjectById
in interfaceCollectInternalClient
- Returns:
- RequestResponseOK
-
initTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> initTransaction(TransactionDto transactionDto, java.lang.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, java.lang.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(java.lang.String unitId, java.lang.Integer version, com.fasterxml.jackson.databind.JsonNode objectJsonNode, java.lang.String usage)
Description copied from interface:CollectInternalClient
ADD Object Group Consume and produce MediaType.APPLICATION_JSON- Specified by:
addObjectGroup
in interfaceCollectInternalClient
- Returns:
- RequestResponse
objectgroup saved
-
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)
Description copied from interface:CollectInternalClient
ADD Binary Consume and produce MediaType.OCTET_STREAM- Specified by:
addBinary
in interfaceCollectInternalClient
- Returns:
- Response
-
closeTransaction
public javax.ws.rs.core.Response closeTransaction(java.lang.String transactionId)
Description copied from interface:CollectInternalClient
Close Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
closeTransaction
in interfaceCollectInternalClient
- Returns:
- Response
-
generateSip
public java.io.InputStream generateSip(java.lang.String transactionId)
Description copied from interface:CollectInternalClient
Generate SIP + Send to Vitam produce and InputStream- Specified by:
generateSip
in interfaceCollectInternalClient
- Returns:
- InputStream
-
abortTransaction
public javax.ws.rs.core.Response abortTransaction(java.lang.String transactionId)
Description copied from interface:CollectInternalClient
Abort Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
abortTransaction
in interfaceCollectInternalClient
- Returns:
- Response
-
reopenTransaction
public javax.ws.rs.core.Response reopenTransaction(java.lang.String transactionId)
Description copied from interface:CollectInternalClient
Reopen Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
reopenTransaction
in interfaceCollectInternalClient
- Returns:
- RequestResponseOK
-
uploadTransactionZip
public void uploadTransactionZip(java.lang.String transactionId, java.io.InputStream inputStreamUploaded)
Description copied from interface:CollectInternalClient
Upload zip and consume Consume and produce CommonMediaType.ZIP- Specified by:
uploadTransactionZip
in interfaceCollectInternalClient
-
getUnitsByProjectId
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getUnitsByProjectId(java.lang.String projectId, com.fasterxml.jackson.databind.JsonNode dslQuery)
Description copied from interface:CollectInternalClient
Get all AU attached to transactions related to project Id param- Specified by:
getUnitsByProjectId
in interfaceCollectInternalClient
- Returns:
-
getObjectStreamByUnitId
public javax.ws.rs.core.Response getObjectStreamByUnitId(java.lang.String unitId, java.lang.String usage, int version)
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
-
searchProject
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> searchProject(CriteriaProjectDto criteria)
Description copied from interface:CollectInternalClient
get all projects by criteria Consume and produce MediaType.APPLICATION_JSON- Specified by:
searchProject
in interfaceCollectInternalClient
- Returns:
- RequestResponse
-
updateTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> updateTransaction(TransactionDto transactionDto)
Description copied from interface:CollectInternalClient
Update a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
updateTransaction
in interfaceCollectInternalClient
- Returns:
- RequestResponse
-
updateUnits
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> updateUnits(java.lang.String transactionId, java.io.InputStream is)
- Specified by:
updateUnits
in interfaceCollectInternalClient
-
changeTransactionStatus
public javax.ws.rs.core.Response changeTransactionStatus(java.lang.String transactionId, TransactionStatus transactionStatus)
Description copied from interface:CollectInternalClient
Change Transaction Status Consume and produce MediaType.APPLICATION_JSON- Specified by:
changeTransactionStatus
in interfaceCollectInternalClient
- Returns:
- Response
-
attachVitamOperationId
public javax.ws.rs.core.Response attachVitamOperationId(java.lang.String transactionId, java.lang.String operationId)
Description copied from interface:CollectInternalClient
Attach Vitam Operation Id To Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
attachVitamOperationId
in interfaceCollectInternalClient
- Returns:
- Response
-
selectUnitsWithInheritedRules
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> selectUnitsWithInheritedRules(java.lang.String transactionId, com.fasterxml.jackson.databind.JsonNode selectQuery)
Description copied from interface:CollectInternalClient
select Units With Inherited Rules- Specified by:
selectUnitsWithInheritedRules
in interfaceCollectInternalClient
- Parameters:
transactionId
- transaction IdselectQuery
- dsl query- Returns:
- Response
-
-