public interface EntityImportExportService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
exportEntitiesToJSON(java.util.Collection<? extends Entity> entities)
Serializes a collection of entities to JSON using
EntitySerializationAPI . |
java.lang.String |
exportEntitiesToJSON(java.util.Collection<? extends Entity> entities,
View view)
Serializes a collection of entities to JSON using
EntitySerializationAPI . |
byte[] |
exportEntitiesToZIP(java.util.Collection<? extends Entity> entities)
Serializes a collection of entities to JSON using
EntitySerializationAPI and packs the JSON file into ZIP archive. |
byte[] |
exportEntitiesToZIP(java.util.Collection<? extends Entity> entities,
View view)
Serializes a collection of entities to JSON using
EntitySerializationAPI and packs the JSON file into ZIP archive. |
java.util.Collection<Entity> |
importEntities(java.util.Collection<? extends Entity> entities,
EntityImportView entityImportView)
|
java.util.Collection<Entity> |
importEntities(java.util.Collection<? extends Entity> entities,
EntityImportView importView,
boolean validate)
Persists entities according to the rules, described by the
entityImportView parameter. |
java.util.Collection<Entity> |
importEntitiesFromJSON(java.lang.String json,
EntityImportView entityImportView)
Deserializes the JSON and persists deserialized entities according to the rules, described by the
entityImportView parameter. |
java.util.Collection<Entity> |
importEntitiesFromZIP(byte[] zipBytes,
EntityImportView entityImportView)
Reads a zip archive that contains a JSON file, deserializes the JSON and persists deserialized entities according
to the rules, described by the
entityImportView parameter. |
static final java.lang.String NAME
byte[] exportEntitiesToZIP(java.util.Collection<? extends Entity> entities)
Serializes a collection of entities to JSON using EntitySerializationAPI
and packs the JSON file into ZIP archive.
Serialization is described in the EntitySerializationAPI#toJson(Collection)
method documentation
entities
- a collection of entities to exportbyte[] exportEntitiesToZIP(java.util.Collection<? extends Entity> entities, View view)
Serializes a collection of entities to JSON using EntitySerializationAPI
and packs the JSON file into ZIP archive. Before the serialization entities will be
reloaded with the view passed as method parameter.
Serialization is described in the EntitySerializationAPI#toJson(Collection)
method documentation
entities
- a collection of entities to exportview
- before serialization to JSON entities will be reloaded with this viewjava.lang.String exportEntitiesToJSON(java.util.Collection<? extends Entity> entities)
Serializes a collection of entities to JSON using EntitySerializationAPI
.
Serialization is described in the EntitySerializationAPI#toJson(Collection)
method documentation
entities
- a collection of entities to exportjava.lang.String exportEntitiesToJSON(java.util.Collection<? extends Entity> entities, View view)
Serializes a collection of entities to JSON using EntitySerializationAPI
. Before the serialization entities will be reloaded with the view passed as method
parameter.
Serialization is described in the EntitySerializationAPI#toJson(Collection)
method documentation
entities
- a collection of entities to exportview
- before serialization to JSON entities will be reloaded with this viewjava.util.Collection<Entity> importEntitiesFromJSON(java.lang.String json, EntityImportView entityImportView)
entityImportView
parameter. If the entity is not present in the database, it will be saved. Otherwise the fields
of the existing entity that are in the entityImportView
will be updated.json
- JSON file containing entitiesentityImportView
- EntityImportView
with the rules that describes how entities should be persisted.EntityImportView
java.util.Collection<Entity> importEntitiesFromZIP(byte[] zipBytes, EntityImportView entityImportView)
entityImportView
parameter. If the entity is not present in the database,
it will be saved. Otherwise the fields of the existing entity that are in the entityImportView
will be
updated.zipBytes
- byte array of ZIP archive with JSON fileentityImportView
- EntityImportView
with the rules that describes how entities should be persisted.EntityImportView
java.util.Collection<Entity> importEntities(java.util.Collection<? extends Entity> entities, EntityImportView entityImportView)
importEntities(Collection, EntityImportView, boolean)
. The current method doesn't perform bean
validationjava.util.Collection<Entity> importEntities(java.util.Collection<? extends Entity> entities, EntityImportView importView, boolean validate)
entityImportView
parameter. If the entity is
not present in the database, it will be saved. Otherwise the fields of the existing entity that are in the entityImportView
will be updated.
If the view contains a property for composition attribute then all composition collection members that are absent in the passed entity will be removed.
importView
- EntityImportView
with the rules that describes how entities should be persisted.validate
- whether the passed entities should be validated by the BeanValidation
mechanism before entities are persisted