public interface BundleService
HyperonPersistenceFactory.| Modifier and Type | Method and Description |
|---|---|
Bundle |
create()
Creates bundle for the first time, based on default profile.
|
Bundle |
create(String profile)
Creates bundle for the first time, based on given profile.
|
BundleDiff |
diff(Bundle next)
Compares given bundle with initial version of the same bundle(by id).
|
BundleDiff |
diff(Bundle prev,
Bundle next)
Compares two different bundles and stores the result of comparison in
BundleDiff object. |
GmoCacheManager |
getCacheManager()
Returns cache manager, that is used within persistence engine as first level cache.
|
BundleDef |
getDefinition(String profile)
Based on given profile, bundle definition will be fetched from current Hyperon Studio environment, to which Hyperon Persistence is connected.
|
Bundle |
load(long id)
Retrieves a bundle based on given id for default profile.
|
Bundle |
load(long id,
BundleDef def)
Retrieves a bundle based on given id and bundle definition.
|
Bundle |
load(long id,
String profile)
Retrieves a bundle based on given id and profile.
|
void |
persist(Bundle bundle)
Saves bundle in tables using database connection defined with
HyperonPersistenceFactory. |
void persist(Bundle bundle)
HyperonPersistenceFactory.
bundle - to be persisted, can't be nullBundle load(long id)
HyperonPersistenceFactory.setDefaultProfile(String).
Bundle definition will be used from current Hyperon Studio environment, to which Hyperon Persistence is connected.
Rest is the same as in load(long, BundleDef). Calling this method multiple times for the same id, will always return new Bundle
instance.
BundleService service = ..;
Bundle firstBundle = service.load(12);
Bundle secondBundle = service.load(12);
firstBundle != secondBundle; // true
Objects.equals(firstBundle, secondBundle); // true
id - bundle id to loadHyperonPersistenceException - if there was no bundle definition for default profileload(long, BundleDef),
load(long, String)Bundle load(long id, BundleDef def)
BundleService service = ..;
Bundle firstBundle = service.load(12);
Bundle secondBundle = service.load(12);
firstBundle != secondBundle; // true
Objects.equals(firstBundle, secondBundle); // true
id - bundle id to loaddef - bundle definition, can't be nullDaoConfig.setBundleTable(String),
Bundle.deepcopy(),
load(long),
load(long, String)Bundle load(long id, String profile)
load(long, BundleDef). Calling this method multiple times for the same id,
will always return new Bundle instance.
BundleService service = ..;
Bundle firstBundle = service.load(12);
Bundle secondBundle = service.load(12);
firstBundle != secondBundle; // true
Objects.equals(firstBundle, secondBundle); // true
id - id bundle id to loadprofile - allows to get current domain definitionHyperonPersistenceException - if there was no bundle definition for default profileload(long),
load(long, BundleDef)BundleDef getDefinition(String profile)
profile - allows to get current domain definitionHyperonPersistenceException - if there was no bundle definition for default profileBundleDefBundle create()
HyperonPersistenceException - if there was no bundle definition for default profileDaoConfig.setBundleTable(String)Bundle create(String profile)
profile - allows to get current domain definitionHyperonPersistenceException - if there was no bundle definition for default profile- for default table nameGmoCacheManager getCacheManager()
BundleDiff diff(Bundle prev, Bundle next)
Compares two different bundles and stores the result of comparison in BundleDiff object. The result will be in form of separated collections of:
elements to insert, to update, to delete.
BundleService service = ..;
Bundle firstBundle = service.load(11);
Bundle secondBundle = service.load(22);
BundleDiff result = service.diff(firstBundle, secondBundle); // difference between these two bundles
--------------
Bundle firstBundle = service.load(33);
Bundle secondBundle = service.load(33);
BundleDiff result = service.diff(firstBundle, secondBundle); // same bundles, then no differences should be there
prev - first bundle, not nullnext - second bundle, not nullBundleDiffBundleDiff diff(Bundle next)
Compares given bundle with initial version of the same bundle(by id). Initial version means that it looks for bundle (with the same id) in:
BundleDiff object. It will
be in form of separated collections of: elements to insert, to update, to delete.
Example:
BundleService service = ..;
Bundle bundle = service.load(12);
bundle.get("policy").remove("product");
BundleDiff result = service.diff(bundle); // there will be information about deleted product from policy
This method doesn't look for previous versions of provided bundle!
next - bundle, not nullBundleDiffCopyright © 2021. All rights reserved.