How to retrieve(fetch) Open Dataspaces
book
Article ID: KB0072571
calendar_today
Updated On:
Description
To manage our EBX application efficiently, it is always recommended to effectively manage the dataspace.A dataspace is a container that isolates different versions of datasets and organizes them. A dataspace can be branched by creating a child dataspace, which is automatically initialized with the state of its parent. Thus, modifications can be made in isolation in the child dataspace without impacting its parent or any other dataspaces. Once modifications in a child dataspace are complete, that dataspace can be compared with and merged back into the parent dataspace.Snapshots, which are static, read-only captures of the state of a dataspace at a given point in time, can be taken for reference purposes. Snapshots can be used to revert the content of a dataspace later if needed.
Environment
Can be checked on all the active EBX environments.
Resolution
To get all the Child DS we will use the getVersionChildren() as when we create the Child DataSpace it created like a SnapShot.Now from the Snapshot to get all the corresponding DS we will use .getBranchChildren(); to fetch the Actual DS for these Snapshot.
Note: A dataspace has no direct dataspace children; when a dataspace is created from another dataspace, first an initial snapshot is created, then the new dataspace is created from this initial snapshot.
Child of a DataSpace is always a version -> Either initial version/ Sub Version.
Approach to fetch all the open DataSpace
1. Get the reference data space.
2. Get all versions of the reference dataspace.
3. For each data space, if it is an initial snapshot, find all its children and recursively, all its descendants (ignoring technical versions)
Note: A data space has no direct data space for children.
When a data space is created from another data space, first an initial snapshot is created, then the new data space is created from this initial snapshot.Please refer to documentation https://docs.tibco.com/pub/ebx/6.0.1/doc/html/en/user_dataspace/userdataspace_intro.html#id1s1 for more information.
Below sample code that can be used to fetch the open dataspace currenlty present in the application
//Inside your service method where you have access to the aContext
// Retrieving the parent branch
AdaptationHome parentDataSpace = aContext.getRepository().getReferenceBranch();
// get all the children versions of this dataspace :
List <AdaptationHome> foundBranchChildren =getChildrenDataspaces(parentDataSpace);
for(AdaptationHome currentBranch:foundBranchChildren){
if(currentBranch.isOpen())
{
VM.log.kernelInfo(currentBranch.getLabelOrName(aContext.getSession().getLocale()));
}
}
// And now in the function getChildrenDataspaces you can navigate it recursively to fetch all the Child DataSpace by ignoring the technical version
private List<AdaptationHome> getChildrenDataspaces(AdaptationHome parentDataSpace) {
// TODO Auto-generated method stub
List<AdaptationHome> versionsChildren = parentDataSpace.getVersionChildren();
List <AdaptationHome> foundBranchChildren = new ArrayList<AdaptationHome>();
for (AdaptationHome currentVersion:versionsChildren) {
//get the first branch children if the version is an initial version
//we also avoid technical branches (used internally by EBX)
if(currentVersion.isInitialVersion() && ! currentVersion.isTechnicalVersion() ) {
AdaptationHome aChildren = currentVersion.getBranchChildren().get(0);
foundBranchChildren.add(aChildren);
foundBranchChildren.addAll(getChildrenDataspaces(aChildren));
}
}
return foundBranchChildren;
}
Issue/Introduction
How to retrieve(fetch) all the open Dataspaces present in the EBX Application.
Additional Information
https://docs.tibco.com/pub/ebx/6.0.1/doc/html/en/user_dataspace/userdataspace_intro.html#id1s1
https://docs.tibco.com/pub/ebx/5.9.13/doc/html/en/Java_API/com/orchestranetworks/instance/Repository.html#getReferenceBranch--
https://docs.tibco.com/pub/ebx/5.9.13/doc/html/en/Java_API/com/onwbp/adaptation/AdaptationHome.html#getBranchChildren--
https://docs.tibco.com/pub/ebx/5.9.13/doc/html/en/Java_API/com/onwbp/adaptation/AdaptationHome.html#getVersionChildren--
Feedback
thumb_up
Yes
thumb_down
No