@Service(value="cuba_EntityImportExportService") public class EntityImportExportServiceBean extends java.lang.Object implements EntityImportExportService
NAME
Constructor and Description |
---|
EntityImportExportServiceBean() |
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 view)
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. |
public byte[] exportEntitiesToZIP(java.util.Collection<? extends Entity> entities)
EntityImportExportService
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
exportEntitiesToZIP
in interface EntityImportExportService
entities
- a collection of entities to exportpublic byte[] exportEntitiesToZIP(java.util.Collection<? extends Entity> entities, View view)
EntityImportExportService
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
exportEntitiesToZIP
in interface EntityImportExportService
entities
- a collection of entities to exportview
- before serialization to JSON entities will be reloaded with this viewpublic java.lang.String exportEntitiesToJSON(java.util.Collection<? extends Entity> entities)
EntityImportExportService
Serializes a collection of entities to JSON using EntitySerializationAPI
.
Serialization is described in the EntitySerializationAPI#toJson(Collection)
method documentation
exportEntitiesToJSON
in interface EntityImportExportService
entities
- a collection of entities to exportpublic java.lang.String exportEntitiesToJSON(java.util.Collection<? extends Entity> entities, View view)
EntityImportExportService
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
exportEntitiesToJSON
in interface EntityImportExportService
entities
- a collection of entities to exportview
- before serialization to JSON entities will be reloaded with this viewpublic java.util.Collection<Entity> importEntitiesFromJSON(java.lang.String json, EntityImportView entityImportView)
EntityImportExportService
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.importEntitiesFromJSON
in interface EntityImportExportService
json
- JSON file containing entitiesentityImportView
- EntityImportView
with the rules that describes how entities should be persisted.EntityImportView
public java.util.Collection<Entity> importEntitiesFromZIP(byte[] zipBytes, EntityImportView view)
EntityImportExportService
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.importEntitiesFromZIP
in interface EntityImportExportService
zipBytes
- byte array of ZIP archive with JSON fileview
- EntityImportView
with the rules that describes how entities should be persisted.EntityImportView
public java.util.Collection<Entity> importEntities(java.util.Collection<? extends Entity> entities, EntityImportView entityImportView)
EntityImportExportService
EntityImportExportService.importEntities(Collection, EntityImportView, boolean)
. The current method doesn't perform bean
validationimportEntities
in interface EntityImportExportService
public java.util.Collection<Entity> importEntities(java.util.Collection<? extends Entity> entities, EntityImportView importView, boolean validate)
EntityImportExportService
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.
importEntities
in interface EntityImportExportService
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