Interface EntityImportExport
- All Known Implementing Classes:
EntityImportExportImpl
-
Method Summary
Modifier and TypeMethodDescriptionexportEntitiesToJSON
(Collection<Object> entities) Serializes a collection of entities to JSON usingEntitySerialization
.exportEntitiesToJSON
(Collection<Object> entities, FetchPlan fetchPlan) Serializes a collection of entities to JSON usingEntitySerialization
.byte[]
exportEntitiesToZIP
(Collection<Object> entities) Serializes a collection of entities to JSON usingEntitySerialization
and packs the JSON file into ZIP archive.byte[]
exportEntitiesToZIP
(Collection<Object> entities, FetchPlan fetchPlan) Serializes a collection of entities to JSON usingEntitySerialization
and packs the JSON file into ZIP archive.importEntities
(Collection<Object> entities, EntityImportPlan importPlan) importEntities
(Collection<Object> entities, EntityImportPlan importPlan, boolean validate) Persists entities according to the rules, described by theimportPlan
parameter.importEntities
(Collection<Object> entities, EntityImportPlan importPlan, boolean validate, boolean optimisticLocking) Persists entities according to the rules, described by theimportPlan
parameter.importEntities
(Collection<Object> entities, EntityImportPlan importPlan, boolean validate, boolean optimisticLocking, boolean additionComposition) importEntitiesFromJson
(String json, EntityImportPlan importPlan) Deserializes the JSON and persists deserialized entities according to the rules, described by theimportPlan
parameter.importEntitiesFromZIP
(byte[] zipBytes, EntityImportPlan importPlan) Reads a zip archive that contains a JSON file, deserializes the JSON and persists deserialized entities according to the rules, described by theimportPlan
parameter.void
importEntityIntoSaveContext
(SaveContext saveContext, Object srcEntity, EntityImportPlan importPlan, boolean validate) void
importEntityIntoSaveContext
(SaveContext saveContext, Object srcEntity, EntityImportPlan importPlan, boolean validate, boolean optimisticLocking) void
importEntityIntoSaveContext
(SaveContext saveContext, Object srcEntity, EntityImportPlan importPlan, boolean validate, boolean optimisticLocking, boolean additionComposition)
-
Method Details
-
exportEntitiesToZIP
Serializes a collection of entities to JSON using
EntitySerialization
and packs the JSON file into ZIP archive.Serialization is described in the
EntitySerialization.toJson(Collection)
method documentation- Parameters:
entities
- a collection of entities to export- Returns:
- a byte array of zipped JSON file
-
exportEntitiesToZIP
Serializes a collection of entities to JSON using
EntitySerialization
and packs the JSON file into ZIP archive. Before the serialization entities will be reloaded with the fetch plan passed as method parameter.Serialization is described in the
EntitySerialization.toJson(Collection)
method documentation- Parameters:
entities
- a collection of entities to exportfetchPlan
- before serialization to JSON entities will be reloaded with this fetch plan- Returns:
- a byte array of zipped JSON file
-
exportEntitiesToJSON
Serializes a collection of entities to JSON using
EntitySerialization
. Before the serialization entities will be reloaded with the fetch plan passed as method parameter.Serialization is described in the
EntitySerialization.toJson(Collection)
method documentation- Parameters:
entities
- a collection of entities to exportfetchPlan
- before serialization to JSON entities will be reloaded with this fetch plan- Returns:
- a JSON string
-
exportEntitiesToJSON
Serializes a collection of entities to JSON using
EntitySerialization
.Serialization is described in the
EntitySerialization.toJson(Collection)
method documentation- Parameters:
entities
- a collection of entities to export- Returns:
- a JSON string
-
importEntitiesFromJson
Deserializes the JSON and persists deserialized entities according to the rules, described by theimportPlan
parameter. If the entity is not present in the database, it will be saved. Otherwise the fields of the existing entity that are in theimportPlan
will be updated.- Parameters:
json
- JSON file containing entitiesimportPlan
-EntityImportPlan
with the rules that describes how entities should be persisted.- Returns:
- a collection of entities that have been imported
- See Also:
-
importEntitiesFromZIP
Reads a zip archive that contains a JSON file, deserializes the JSON and persists deserialized entities according to the rules, described by theimportPlan
parameter. If the entity is not present in the database, it will be saved. Otherwise the fields of the existing entity that are in theimportPlan
will be updated.- Parameters:
zipBytes
- byte array of ZIP archive with JSON fileimportPlan
-EntityImportPlan
with the rules that describes how entities should be persisted.- Returns:
- a collection of entities that have been imported
- See Also:
-
importEntities
SeeimportEntities(Collection, EntityImportPlan, boolean)
. The current method doesn't perform bean validation -
importEntities
Collection<Object> importEntities(Collection<Object> entities, EntityImportPlan importPlan, boolean validate) Persists entities according to the rules, described by theimportPlan
parameter. If the entity is not present in the database, it will be saved. Otherwise the fields of the existing entity that are in theimportPlan
will be updated.If the import plan contains a property for composition attribute then all composition collection members that are absent in the passed entity will be removed.
- Parameters:
importPlan
-EntityImportPlan
with the rules that describes how entities should be persisted.validate
- whether the passed entities should be validated by the bean validation mechanism before entities are persisted- Returns:
- a collection of entities that have been imported
-
importEntities
Collection<Object> importEntities(Collection<Object> entities, EntityImportPlan importPlan, boolean validate, boolean optimisticLocking) Persists entities according to the rules, described by theimportPlan
parameter. If the entity is not present in the database, it will be saved. Otherwise the fields of the existing entity that are in theimportPlan
will be updated.If the import plan contains a property for composition attribute then all composition collection members that are absent in the passed entity will be removed.
- Parameters:
importPlan
-EntityImportPlan
with the rules that describes how entities should be persisted.validate
- whether the passed entities should be validated by the bean validation mechanism before entities are persistedoptimisticLocking
- whether the passed entities versions should be validated before entities are persisted- Returns:
- a collection of entities that have been imported
-
importEntities
Collection<Object> importEntities(Collection<Object> entities, EntityImportPlan importPlan, boolean validate, boolean optimisticLocking, boolean additionComposition) -
importEntityIntoSaveContext
void importEntityIntoSaveContext(SaveContext saveContext, Object srcEntity, EntityImportPlan importPlan, boolean validate) -
importEntityIntoSaveContext
void importEntityIntoSaveContext(SaveContext saveContext, Object srcEntity, EntityImportPlan importPlan, boolean validate, boolean optimisticLocking) -
importEntityIntoSaveContext
void importEntityIntoSaveContext(SaveContext saveContext, Object srcEntity, EntityImportPlan importPlan, boolean validate, boolean optimisticLocking, boolean additionComposition)
-