+ /**
+ * Returns the base node to store SlcResults. If it does not exists, it is
+ * created. If a node already exists at the given path with the wrong type,
+ * it throws an exception.
+ *
+ * @param session
+ * @return
+ */
+ public static Node getSlcResultsParentNode(Session session) {
+ try {
+ String absPath = getSlcResultsBasePath(session);
+ if (session.nodeExists(absPath)) {
+ Node currNode = session.getNode(absPath);
+ if (currNode.isNodeType(NodeType.NT_UNSTRUCTURED))
+ return currNode;
+ else
+ throw new SlcException(
+ "A node already exists at this path : " + absPath
+ + " that has the wrong type. ");
+ } else {
+ Node slcResParNode = JcrUtils.mkdirs(session, absPath);
+ slcResParNode.setPrimaryType(NodeType.NT_UNSTRUCTURED);
+ session.save();
+ return slcResParNode;
+ }
+ } catch (RepositoryException re) {
+ throw new SlcException(
+ "Unexpected error while creating slcResult root parent node.",
+ re);
+ }
+ }
+