+ /** Override normal behaviour to initialize display of the workspace */
+ @Override
+ public synchronized Object[] getChildren() {
+ if (isLoaded()) {
+ return super.getChildren();
+ } else {
+ // initialize current object
+ try {
+ // Lazy connect the first time we retrieve children
+ if (currSession == null)
+ login();
+
+ // Retrieve already existing distribution
+ Query groupQuery = currSession
+ .getWorkspace()
+ .getQueryManager()
+ .createQuery(
+ "select * from ["
+ + SlcTypes.SLC_MODULAR_DISTRIBUTION
+ + "]", Query.JCR_SQL2);
+ NodeIterator distributions = groupQuery.execute().getNodes();
+ distribs: while (distributions.hasNext()) {
+ Node currDist = distributions.nextNode();
+ Node distBase = currDist.getParent().getParent();
+ if (!distBase.isNodeType(SlcTypes.SLC_ARTIFACT_BASE))
+ continue distribs;
+ String groupId = distBase
+ .getProperty(SlcNames.SLC_GROUP_ID).getString();
+ String artifactId = distBase.getProperty(
+ SlcNames.SLC_ARTIFACT_ID).getString();
+
+ String name;
+ String type;
+ if (ModularDistBaseElem.AETHER_BINARIES_TYPE
+ .equals(artifactId)) {
+ name = groupId;
+ type = ModularDistBaseElem.AETHER_BINARIES_TYPE;
+ } else {
+ name = artifactId;
+ type = ModularDistBaseElem.AETHER_DEP_TYPE;
+ }
+ if (getChildByName(name) == null)
+ addChild(new ModularDistBaseElem(WorkspaceElem.this,
+ name, distBase, type));
+ }
+ // Add empty group base that have been marked as relevant
+ groupQuery = currSession
+ .getWorkspace()
+ .getQueryManager()
+ .createQuery(
+ "select * from ["
+ + SlcTypes.SLC_RELEVANT_CATEGORY + "]",
+ Query.JCR_SQL2);
+ distributions = groupQuery.execute().getNodes();
+ while (distributions.hasNext()) {
+ Node distBase = distributions.nextNode();
+ String groupBaseId = distBase.getProperty(
+ SlcNames.SLC_GROUP_BASE_ID).getString();
+ if (getChildByName(groupBaseId) == null)
+ addChild(new ModularDistBaseElem(WorkspaceElem.this,
+ groupBaseId, distBase,
+ ModularDistBaseElem.AETHER_CATEGORY_BASE));
+ }
+ return super.getChildren();
+ } catch (RepositoryException e) {
+ throw new ArgeoException(
+ "Cannot initialize WorkspaceNode UI object."
+ + getName(), e);
+ }
+ }