Class MetadataService
java.lang.Object
fr.gouv.vitam.collect.internal.core.service.MetadataService
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMetadataService(MetadataRepository metadataRepository, ProjectRepository projectRepository, BulkAtomicUpdateMetadataService bulkAtomicUpdateMetadataService, AdminManagementClientFactory adminManagementClientFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateOrGetAttachmentUnits(ProjectModel projectModel, String transactionId, String explicitAttachementId) Creates (or retrieves when they already exist) the static and dynamic attachment units declared on the project of the transaction.createOrGetAttachmentUnitsByProjectId(String projectId, String transactionId, String explicitAttachementId) Same ascreateOrGetAttachmentUnits(ProjectModel, String, String)for callers that only know the project id.voiddeleteObjectGroups(Collection<String> objectGroupIds) Deletes the given object groups.voiddeleteUnits(Collection<String> unitIds) Deletes the given units.com.fasterxml.jackson.databind.JsonNodesaveArchiveUnit(com.fasterxml.jackson.databind.JsonNode unit, TransactionModel transactionModel) ScrollSpliterator<com.fasterxml.jackson.databind.JsonNode> scrollObjectGroupsByTransactionId(SelectMultiQuery request, String transactionId) Scrolls over every object group of a transaction matching the given query.ScrollSpliterator<com.fasterxml.jackson.databind.JsonNode> scrollUnitsByTransactionId(SelectMultiQuery request, String transactionId) Scrolls over every unit of a transaction matching the given query.com.fasterxml.jackson.databind.JsonNodeselectObjectGroupById(String objectGroupId) com.fasterxml.jackson.databind.JsonNodeselectUnitById(String unitId) RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> selectUnitsByTransactionId(com.fasterxml.jackson.databind.JsonNode queryDsl, String transactionId) com.fasterxml.jackson.databind.JsonNodeselectUnitsWithInheritedRules(String transactionId, com.fasterxml.jackson.databind.JsonNode queryDsl) voidupdateUnitsWithJsonlMetadata(TransactionModel transaction, InputStream metadataJsonlInputStream) voidupdateUnitsWithMetadataCsv(TransactionModel transaction, InputStream is)
-
Field Details
-
BULK_SIZE
public static final int BULK_SIZE- See Also:
-
-
Constructor Details
-
MetadataService
public MetadataService(MetadataRepository metadataRepository, ProjectRepository projectRepository, BulkAtomicUpdateMetadataService bulkAtomicUpdateMetadataService, AdminManagementClientFactory adminManagementClientFactory)
-
-
Method Details
-
selectUnitById
public com.fasterxml.jackson.databind.JsonNode selectUnitById(String unitId) throws CollectInternalException - Throws:
CollectInternalException
-
selectObjectGroupById
public com.fasterxml.jackson.databind.JsonNode selectObjectGroupById(String objectGroupId) throws CollectInternalException - Throws:
CollectInternalException
-
saveArchiveUnit
public com.fasterxml.jackson.databind.JsonNode saveArchiveUnit(com.fasterxml.jackson.databind.JsonNode unit, TransactionModel transactionModel) throws CollectInternalException, InvalidParseOperationException -
updateUnitsWithMetadataCsv
public void updateUnitsWithMetadataCsv(TransactionModel transaction, InputStream is) throws CollectInternalException - Throws:
CollectInternalException
-
updateUnitsWithJsonlMetadata
public void updateUnitsWithJsonlMetadata(TransactionModel transaction, InputStream metadataJsonlInputStream) throws CollectInternalException - Throws:
CollectInternalException
-
selectUnitsByTransactionId
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> selectUnitsByTransactionId(com.fasterxml.jackson.databind.JsonNode queryDsl, String transactionId) throws CollectInternalException - Throws:
CollectInternalException
-
scrollUnitsByTransactionId
public ScrollSpliterator<com.fasterxml.jackson.databind.JsonNode> scrollUnitsByTransactionId(SelectMultiQuery request, String transactionId) Scrolls over every unit of a transaction matching the given query.- Parameters:
request- select query, scrolled by batchestransactionId- transaction the units belong to- Returns:
- a spliterator over the matching units
-
scrollObjectGroupsByTransactionId
public ScrollSpliterator<com.fasterxml.jackson.databind.JsonNode> scrollObjectGroupsByTransactionId(SelectMultiQuery request, String transactionId) Scrolls over every object group of a transaction matching the given query.- Parameters:
request- select query, scrolled by batchestransactionId- transaction the object groups belong to- Returns:
- a spliterator over the matching object groups
-
deleteUnits
Deletes the given units.- Parameters:
unitIds- ids of the units to delete- Throws:
CollectInternalException
-
deleteObjectGroups
Deletes the given object groups.- Parameters:
objectGroupIds- ids of the object groups to delete- Throws:
CollectInternalException
-
createOrGetAttachmentUnits
public Map<String,String> createOrGetAttachmentUnits(ProjectModel projectModel, String transactionId, @Nullable String explicitAttachementId) throws CollectInternalException Creates (or retrieves when they already exist) the static and dynamic attachment units declared on the project of the transaction. Shared by every upload path (zip with csv/jsonl metadata, SIP ingest) so that attachment units are always materialized the same way, before any unit of the upload is written.- Parameters:
projectModel- project holding the static (UnitUp) and dynamic (UnitUps) attachment declarationstransactionId- transaction the attachment units belong toexplicitAttachementId- unit id given through the X-Attachement-Id header, may be null- Returns:
- attachment unit ids indexed by the system id they point to, empty when an explicitAttachementId is given
- Throws:
CollectInternalException
-
createOrGetAttachmentUnitsByProjectId
public Map<String,String> createOrGetAttachmentUnitsByProjectId(String projectId, String transactionId, @Nullable String explicitAttachementId) throws CollectInternalException Same ascreateOrGetAttachmentUnits(ProjectModel, String, String)for callers that only know the project id. The project is not loaded at all when an explicitAttachementId is given.- Parameters:
projectId- project of the transactiontransactionId- transaction the attachment units belong toexplicitAttachementId- unit id given through the X-Attachement-Id header, may be null- Returns:
- attachment unit ids indexed by the system id they point to, empty when an explicitAttachementId is given
- Throws:
CollectInternalException
-
selectUnitsWithInheritedRules
public com.fasterxml.jackson.databind.JsonNode selectUnitsWithInheritedRules(String transactionId, com.fasterxml.jackson.databind.JsonNode queryDsl) throws InvalidParseOperationException - Throws:
InvalidParseOperationException
-