- // private ResultParent[] initializeResultTree() {\r
- // try {\r
- // // Force initialization of the tree structure if needed\r
- // SlcJcrResultUtils.getSlcResultsParentNode(session);\r
- // SlcJcrResultUtils.getMyResultParentNode(session);\r
- // // Remove yesterday and last 7 days virtual folders\r
- // // ResultParent[] roots = new ResultParent[5];\r
- // ResultParent[] roots = new ResultParent[3];\r
- //\r
- // // My results\r
- // roots[0] = new ParentNodeFolder(null,\r
- // SlcJcrResultUtils.getMyResultParentNode(session),\r
- // SlcUiConstants.DEFAULT_MY_RESULTS_FOLDER_LABEL);\r
- //\r
- // // today\r
- // Calendar cal = Calendar.getInstance();\r
- // String relPath = JcrUtils.dateAsPath(cal);\r
- // List<String> datePathes = new ArrayList<String>();\r
- // datePathes.add(relPath);\r
- // roots[1] = new VirtualFolder(null,\r
- // ResultParentUtils.getResultsForDates(session, datePathes),\r
- // "Today");\r
- //\r
- // // // Yesterday\r
- // // cal = Calendar.getInstance();\r
- // // cal.add(Calendar.DAY_OF_YEAR, -1);\r
- // // relPath = JcrUtils.dateAsPath(cal);\r
- // // datePathes = new ArrayList<String>();\r
- // // datePathes.add(relPath);\r
- // // roots[2] = new VirtualFolder(null,\r
- // // ResultParentUtils.getResultsForDates(session, datePathes),\r
- // // "Yesterday");\r
- // // // Last 7 days\r
- // //\r
- // // cal = Calendar.getInstance();\r
- // // datePathes = new ArrayList<String>();\r
- // //\r
- // // for (int i = 0; i < 7; i++) {\r
- // // cal.add(Calendar.DAY_OF_YEAR, -i);\r
- // // relPath = JcrUtils.dateAsPath(cal);\r
- // // datePathes.add(relPath);\r
- // // }\r
- // // roots[3] = new VirtualFolder(null,\r
- // // ResultParentUtils.getResultsForDates(session, datePathes),\r
- // // "Last 7 days");\r
- //\r
- // // All results\r
- // Node otherResultsPar = session.getNode(SlcJcrResultUtils\r
- // .getSlcResultsBasePath(session));\r
- // // roots[4] = new ParentNodeFolder(null, otherResultsPar,\r
- // // "All results");\r
- // roots[2] = new ParentNodeFolder(null, otherResultsPar,\r
- // "All results");\r
- // return roots;\r
- // } catch (RepositoryException re) {\r
- // throw new ArgeoException(\r
- // "Unexpected error while initializing ResultTree.", re);\r
- // }\r
- // }\r
+ private Node[] initializeResultTree() {\r
+ try {\r
+\r
+ NodeIterator ni = templatesParentNode.getNodes();\r
+ List<Node> templates = new ArrayList<Node>();\r
+\r
+ while (ni.hasNext()) {\r
+ Node currNode = ni.nextNode();\r
+ if (currNode.isNodeType(AkbTypes.AKB_ENV_TEMPLATE))\r
+ templates.add(currNode);\r
+ }\r
+\r
+ Node[] templateArr = templates.toArray(new Node[templates.size()]);\r
+\r
+ return templateArr;\r
+ } catch (RepositoryException re) {\r
+ throw new AkbException("Error while initializing templates Tree.",\r
+ re);\r
+ }\r
+ }\r