Class CollectExternalClientRest
- java.lang.Object
-
- fr.gouv.vitam.common.external.client.DefaultClient
-
- fr.gouv.vitam.collect.external.client.CollectExternalClientRest
-
- All Implemented Interfaces:
CollectExternalClient
,MockOrRestClient
,BasicClient
,VitamAutoCloseable
,java.lang.AutoCloseable
public class CollectExternalClientRest extends DefaultClient implements CollectExternalClient
Collect Client implementation for production environment
-
-
Field Summary
-
Fields inherited from interface fr.gouv.vitam.common.external.client.BasicClient
STATUS_URL
-
-
Constructor Summary
Constructors Constructor Description CollectExternalClientRest(VitamClientFactoryInterface<?> factory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RequestResponse<com.fasterxml.jackson.databind.JsonNode>
abortTransaction(VitamContext vitamContext, java.lang.String transactionId)
Abort Transaction Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.Response
addBinary(VitamContext vitamContext, java.lang.String unitId, java.lang.Integer version, java.io.InputStream inputStreamUploaded, java.lang.String usage)
ADD Binary Consume and produce MediaType.OCTET_STREAMRequestResponse<com.fasterxml.jackson.databind.JsonNode>
addObjectGroup(VitamContext vitamContext, 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_JSONvoid
checkStatus()
Check the status from the servicevoid
checkStatus(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 certificatevoid
close()
Close the underneath http clientRequestResponse<com.fasterxml.jackson.databind.JsonNode>
closeTransaction(VitamContext vitamContext, java.lang.String transactionId)
Close Transaction Consume and produce MediaType.APPLICATION_JSONvoid
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(VitamContext vitamContext, java.lang.String projectId)
delete a collect project produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
deleteTransactionById(VitamContext vitamContext, java.lang.String transactionId)
delete a collect transaction produce MediaType.APPLICATION_JSONjavax.ws.rs.client.Client
getChunkedClient()
javax.ws.rs.client.Client
getClient()
VitamClientFactory<?>
getClientFactory()
RequestResponse<com.fasterxml.jackson.databind.JsonNode>
getObjectById(VitamContext vitamContext, java.lang.String gotId)
get an object group by Id Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.Response
getObjectStreamByUnitId(VitamContext vitamContext, 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(VitamContext vitamContext, java.lang.String projectId)
get a collect project Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
getProjects(VitamContext vitamContext)
get all collect project by tenant Consume and produce MediaType.APPLICATION_JSONjava.lang.String
getResourcePath()
Get the resource path of the server.java.lang.String
getServiceUrl()
Get the service URLRequestResponse<com.fasterxml.jackson.databind.JsonNode>
getTransactionById(VitamContext vitamContext, java.lang.String transactionId)
get a collect transaction by ID Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
getTransactionByProjectId(VitamContext vitamContext, java.lang.String projectId)
get a collect transaction Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
getUnitById(VitamContext vitamContext, java.lang.String unitId)
get an archive unit by Id Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
getUnitsByTransaction(VitamContext vitamContext, 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>
ingest(VitamContext vitamContext, java.lang.String transactionId)
Generate SIP + Send to Vitam Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
initProject(VitamContext vitamContext, ProjectDto projectDto)
Initialize a collect project Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
initTransaction(VitamContext vitamContext, TransactionDto transactionDto, java.lang.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)
RequestResponse<com.fasterxml.jackson.databind.JsonNode>
reopenTransaction(VitamContext vitamContext, java.lang.String transactionId)
Reopen Transaction Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
searchProject(VitamContext vitamContext, CriteriaProjectDto criteria)
get all projects by criteria Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
selectUnitsWithInheritedRules(VitamContext vitamContext, java.lang.String transactionId, com.fasterxml.jackson.databind.JsonNode selectQuery)
static void
staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)
java.lang.String
toString()
RequestResponse<com.fasterxml.jackson.databind.JsonNode>
updateProject(VitamContext vitamContext, ProjectDto projectDto)
Update a collect project Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
updateTransaction(VitamContext vitamContext, TransactionDto transactionDto)
Update a collect transaction Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
updateUnits(VitamContext vitamContext, java.lang.String transactionId, java.io.InputStream is)
RequestResponse<com.fasterxml.jackson.databind.JsonNode>
uploadArchiveUnit(VitamContext vitamContext, com.fasterxml.jackson.databind.JsonNode unitJsonNode, java.lang.String transactionId)
ADD Archive Unit Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>
uploadProjectZip(VitamContext vitamContext, java.lang.String transactionId, java.io.InputStream inputStreamUploaded)
Upload zip and consume Consume 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
-
CollectExternalClientRest
public CollectExternalClientRest(VitamClientFactoryInterface<?> factory)
-
-
Method Detail
-
initProject
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> initProject(VitamContext vitamContext, ProjectDto projectDto) throws VitamClientException
Description copied from interface:CollectExternalClient
Initialize a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
initProject
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
updateProject
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> updateProject(VitamContext vitamContext, ProjectDto projectDto) throws VitamClientException
Description copied from interface:CollectExternalClient
Update a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
updateProject
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getProjectById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getProjectById(VitamContext vitamContext, java.lang.String projectId) throws VitamClientException
Description copied from interface:CollectExternalClient
get a collect project Consume and produce MediaType.APPLICATION_JSON- Specified by:
getProjectById
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getTransactionById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getTransactionById(VitamContext vitamContext, java.lang.String transactionId) throws VitamClientException
Description copied from interface:CollectExternalClient
get a collect transaction by ID Consume and produce MediaType.APPLICATION_JSON- Specified by:
getTransactionById
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getTransactionByProjectId
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getTransactionByProjectId(VitamContext vitamContext, java.lang.String projectId) throws VitamClientException
Description copied from interface:CollectExternalClient
get a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
getTransactionByProjectId
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
deleteProjectById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> deleteProjectById(VitamContext vitamContext, java.lang.String projectId) throws VitamClientException
Description copied from interface:CollectExternalClient
delete a collect project produce MediaType.APPLICATION_JSON- Specified by:
deleteProjectById
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
deleteTransactionById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> deleteTransactionById(VitamContext vitamContext, java.lang.String transactionId) throws VitamClientException
Description copied from interface:CollectExternalClient
delete a collect transaction produce MediaType.APPLICATION_JSON- Specified by:
deleteTransactionById
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getProjects
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getProjects(VitamContext vitamContext) throws VitamClientException
Description copied from interface:CollectExternalClient
get all collect project by tenant Consume and produce MediaType.APPLICATION_JSON- Specified by:
getProjects
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getUnitById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getUnitById(VitamContext vitamContext, java.lang.String unitId) throws VitamClientException
Description copied from interface:CollectExternalClient
get an archive unit by Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getUnitById
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getUnitsByTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getUnitsByTransaction(VitamContext vitamContext, java.lang.String transactionId, com.fasterxml.jackson.databind.JsonNode query) throws VitamClientException
Description copied from interface:CollectExternalClient
get an archive unit by transaction Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getUnitsByTransaction
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getObjectById
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> getObjectById(VitamContext vitamContext, java.lang.String gotId) throws VitamClientException
Description copied from interface:CollectExternalClient
get an object group by Id Consume and produce MediaType.APPLICATION_JSON- Specified by:
getObjectById
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
initTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> initTransaction(VitamContext vitamContext, TransactionDto transactionDto, java.lang.String projectId) throws VitamClientException
Description copied from interface:CollectExternalClient
Initialize a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
initTransaction
in interfaceCollectExternalClient
- Returns:
- RequestResponse
guid created for the transaction - Throws:
VitamClientException
- exception occurs when parse operation failed
-
uploadArchiveUnit
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> uploadArchiveUnit(VitamContext vitamContext, com.fasterxml.jackson.databind.JsonNode unitJsonNode, java.lang.String transactionId) throws VitamClientException
Description copied from interface:CollectExternalClient
ADD Archive Unit Consume and produce MediaType.APPLICATION_JSON- Specified by:
uploadArchiveUnit
in interfaceCollectExternalClient
- Returns:
- RequestResponse
Archive Unit saved - Throws:
VitamClientException
- exception occurs when parse operation failed
-
addObjectGroup
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> addObjectGroup(VitamContext vitamContext, java.lang.String unitId, java.lang.Integer version, com.fasterxml.jackson.databind.JsonNode objectJsonNode, java.lang.String usage) throws VitamClientException
Description copied from interface:CollectExternalClient
ADD Object Group Consume and produce MediaType.APPLICATION_JSON- Specified by:
addObjectGroup
in interfaceCollectExternalClient
- Returns:
- RequestResponse
objectgroup saved - Throws:
VitamClientException
- exception occurs when parse operation failed
-
addBinary
public javax.ws.rs.core.Response addBinary(VitamContext vitamContext, java.lang.String unitId, java.lang.Integer version, java.io.InputStream inputStreamUploaded, java.lang.String usage) throws VitamClientException
Description copied from interface:CollectExternalClient
ADD Binary Consume and produce MediaType.OCTET_STREAM- Specified by:
addBinary
in interfaceCollectExternalClient
- Returns:
- Response
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
closeTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> closeTransaction(VitamContext vitamContext, java.lang.String transactionId) throws VitamClientException
Description copied from interface:CollectExternalClient
Close Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
closeTransaction
in interfaceCollectExternalClient
- Returns:
- Response
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
ingest
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> ingest(VitamContext vitamContext, java.lang.String transactionId) throws VitamClientException
Description copied from interface:CollectExternalClient
Generate SIP + Send to Vitam Consume and produce MediaType.APPLICATION_JSON- Specified by:
ingest
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
abortTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> abortTransaction(VitamContext vitamContext, java.lang.String transactionId) throws VitamClientException
Description copied from interface:CollectExternalClient
Abort Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
abortTransaction
in interfaceCollectExternalClient
- Returns:
- Response
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
reopenTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> reopenTransaction(VitamContext vitamContext, java.lang.String transactionId) throws VitamClientException
Description copied from interface:CollectExternalClient
Reopen Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
reopenTransaction
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
uploadProjectZip
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> uploadProjectZip(VitamContext vitamContext, java.lang.String transactionId, java.io.InputStream inputStreamUploaded) throws VitamClientException
Description copied from interface:CollectExternalClient
Upload zip and consume Consume CommonMediaType.ZIP- Specified by:
uploadProjectZip
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
getObjectStreamByUnitId
public javax.ws.rs.core.Response getObjectStreamByUnitId(VitamContext vitamContext, java.lang.String unitId, java.lang.String usage, int version) throws VitamClientException
Description copied from interface:CollectExternalClient
Get all AU attached to transactions related to project Id param- Specified by:
getObjectStreamByUnitId
in interfaceCollectExternalClient
- Parameters:
vitamContext
- security contextunitId
- unit idusage
- usageversion
- version- Returns:
- Response
- Throws:
VitamClientException
- Thrown exception
-
searchProject
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> searchProject(VitamContext vitamContext, CriteriaProjectDto criteria) throws VitamClientException
Description copied from interface:CollectExternalClient
get all projects by criteria Consume and produce MediaType.APPLICATION_JSON- Specified by:
searchProject
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
updateUnits
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> updateUnits(VitamContext vitamContext, java.lang.String transactionId, java.io.InputStream is) throws VitamClientException
- Specified by:
updateUnits
in interfaceCollectExternalClient
- Throws:
VitamClientException
-
updateTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> updateTransaction(VitamContext vitamContext, TransactionDto transactionDto) throws VitamClientException
Description copied from interface:CollectExternalClient
Update a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
updateTransaction
in interfaceCollectExternalClient
- Returns:
- RequestResponse
- Throws:
VitamClientException
- exception occurs when parse operation failed
-
selectUnitsWithInheritedRules
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> selectUnitsWithInheritedRules(VitamContext vitamContext, java.lang.String transactionId, com.fasterxml.jackson.databind.JsonNode selectQuery) throws VitamClientException
- Specified by:
selectUnitsWithInheritedRules
in interfaceCollectExternalClient
- Throws:
VitamClientException
-
staticConsumeAnyEntityAndClose
public static void staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response 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
public void checkStatus() throws VitamApplicationServerException
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<java.lang.String,java.lang.Object> headers) throws VitamApplicationServerException
Description 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
public java.lang.String 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
public java.lang.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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceMockOrRestClient
- Specified by:
close
in interfaceVitamAutoCloseable
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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
-
getChunkedClient
public javax.ws.rs.client.Client getChunkedClient()
-
getClient
public javax.ws.rs.client.Client getClient()
-
getClientFactory
public VitamClientFactory<?> getClientFactory()
-
-