コード例 #1
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.removeCategory() Input: Remove categories of Article node Expect:
  * Return empty list
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws TaxonomyAlreadyExistsException
  */
 public void testRemoveCategory()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException,
         TaxonomyAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   Node article = session.getRootNode().addNode("Article");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Education", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "News", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/Education", "Language", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/News", "Weather", "root");
   Node rootTree1 = (Node) session.getItem("/MyDocuments/Education");
   taxonomyService.addTaxonomyTree(rootTree1);
   Node rootTree2 = (Node) session.getItem("/MyDocuments/News");
   taxonomyService.addTaxonomyTree(rootTree2);
   taxonomyService.addCategory(article, "Education", "Language", true);
   taxonomyService.addCategory(article, "News", "Weather", true);
   List<Node> lstNode = mockTaxonomyService.getAllCategories(article, true);
   assertEquals(2, lstNode.size());
   taxonomyService.removeCategory(article, "Education", "Language", true);
   lstNode = mockTaxonomyService.getAllCategories(article, true);
   assertEquals(1, lstNode.size());
   taxonomyService.removeCategory(article, "News", "Weather", true);
   lstNode = mockTaxonomyService.getAllCategories(article, true);
   assertEquals(0, lstNode.size());
 }
コード例 #2
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.removeTaxonomyNode() Input: Add and remove Tennis node Expect: Node
  * Tennis has not existed
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  */
 public void testRemoveTaxonomyNode()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Tennis", "root");
   taxonomyService.removeTaxonomyNode(REPO_NAME, COLLABORATION_WS, "/MyDocuments/Tennis");
   assertFalse(session.itemExists("/MyDocuments/Tennis"));
 }
コード例 #3
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.hasTaxonomyTree(String repository, String taxonomyName) Input: Add
  * one tree: Primera Liga Expect: Return 2 taxonomy tree: System and Primera Liga tree
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws TaxonomyAlreadyExistsException
  */
 public void testHasTaxonomyTree()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException,
         TaxonomyAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Primera Liga", "root");
   taxonomyService.addTaxonomyTree((Node) session.getItem("/MyDocuments/Primera Liga"));
   assertTrue(taxonomyService.hasTaxonomyTree("System"));
   assertTrue(taxonomyService.hasTaxonomyTree("Primera Liga"));
 }
コード例 #4
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.getTaxonomyTree(String repository, String taxonomyName) Input:
  * Create taxonomy tree Music Expect: Node Music
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws TaxonomyAlreadyExistsException
  */
 public void testGetTaxonomyTree2()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException,
         TaxonomyAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Music", "root");
   Node musicTree = (Node) session.getItem("/MyDocuments/Music");
   taxonomyService.addTaxonomyTree(musicTree);
   assertTrue(dmsSesssion.itemExists(definitionPath + "/Music"));
   Node musicTreeDefinition = (Node) dmsSesssion.getItem(definitionPath + "/Music");
   assertEquals(musicTree, linkManage.getTarget(musicTreeDefinition, true));
 }
コード例 #5
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.addTaxonomyTree(Node taxonomyTree) with one tree has already
  * existed Input: add 2 tree node with same name Expect: Fire TaxonomyAlreadyExistsException
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  */
 public void testAddTaxonomyTree2()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Doc", "root");
   Node docTree = (Node) session.getItem("/MyDocuments/Doc");
   try {
     taxonomyService.addTaxonomyTree(docTree);
     taxonomyService.addTaxonomyTree(docTree);
   } catch (TaxonomyAlreadyExistsException e) {
   }
 }
コード例 #6
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 public void tearDown() throws Exception {
   List<Node> lstNode = taxonomyService.getAllTaxonomyTrees(true);
   for (Node tree : lstNode) {
     if (!tree.getName().equals("System")) taxonomyService.removeTaxonomyTree(tree.getName());
   }
   for (String s : new String[] {"/Article", "/MyDocuments"})
     if (session.itemExists(s)) {
       session.getItem(s).remove();
       session.save();
     }
   super.tearDown();
 }
コード例 #7
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.getTaxonomyTree(String repository, String taxonomyName) Input: Add
  * 2 tree Miscellaneous and Shoes, remove Miscellaneous tree Expect: Node Miscellaneous is remove
  * in definition and real path
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws TaxonomyAlreadyExistsException
  */
 public void testRemoveTaxonomyTree()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException,
         TaxonomyAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Miscellaneous", "root");
   taxonomyService.addTaxonomyNode(
       COLLABORATION_WS, "/MyDocuments/Miscellaneous", "Shoes", "root");
   Node miscellaneous = (Node) session.getItem("/MyDocuments/Miscellaneous");
   taxonomyService.addTaxonomyTree(miscellaneous);
   assertTrue(dmsSesssion.itemExists(definitionPath + "/Miscellaneous"));
   taxonomyService.removeTaxonomyTree("Miscellaneous");
   assertFalse(dmsSesssion.itemExists(definitionPath + "/Miscellaneous"));
   assertFalse(dmsSesssion.itemExists("/MyDocuments/Miscellaneous"));
 }
コード例 #8
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.moveTaxonomyNode() Input: Move node to other place Output: Node is
  * moved
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  */
 public void testMoveTaxonomyNode()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Serie", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Budesliga", "root");
   taxonomyService.moveTaxonomyNode(
       REPO_NAME, COLLABORATION_WS, "/MyDocuments/Serie", "/Serie", "cut");
   taxonomyService.moveTaxonomyNode(
       REPO_NAME, COLLABORATION_WS, "/MyDocuments/Budesliga", "/Budesliga", "copy");
   assertFalse(session.itemExists("/MyDocuments/Serie"));
   assertTrue(session.itemExists("/Serie"));
   assertTrue(session.itemExists("/Budesliga"));
   assertTrue(session.itemExists("/MyDocuments/Budesliga"));
 }
コード例 #9
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.addCategory() Input: Add category for article node Expect: one node
  * with primary type exo:taxonomyLink is create in taxonomy tree
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws TaxonomyAlreadyExistsException
  */
 public void testAddCategory()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException,
         TaxonomyAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   Node article = session.getRootNode().addNode("Article");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Serie", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/Serie", "A", "root");
   Node rootTree = (Node) session.getItem("/MyDocuments/Serie");
   session.save();
   taxonomyService.addTaxonomyTree(rootTree);
   taxonomyService.addCategory(article, "Serie", "A", true);
   Node link = (Node) session.getItem("/MyDocuments/Serie/A/Article");
   assertTrue(link.isNodeType("exo:taxonomyLink"));
   assertEquals(article, linkManage.getTarget(link));
 }
コード例 #10
0
  /**
   * Get content of document node. Content is got by exo:content or exo:text or exo:summary
   *
   * @param node
   * @return
   * @throws Exception
   */
  private DocumentContent getArticleContent(Node node, List<Node> taxonomyTrees) throws Exception {
    DocumentContent documentContent =
        new DocumentContent(node.getName(), getIcon(node), "", getType(node));
    // If node is added mix rss-enabled then get exo:content property
    if (node.hasProperty("exo:content")) {
      documentContent.setContent(node.getProperty("exo:content").getString());
    }
    // Some node have exo:text so we override value of exo:content
    if (node.hasProperty("exo:text")) {
      documentContent.setContent(node.getProperty("exo:text").getString());
    }
    // Some node have exo:summary so we override value of exo:content
    if (node.hasProperty("exo:summary")) {
      documentContent.setContent(node.getProperty("exo:summary").getString());
    }

    List<Node> categories = taxonomyService_.getAllCategories(node);

    CategoryNode categoryNode;
    for (Node category : categories) {
      categoryNode = getCategoryNode(category, "");
      for (Node taxonomyTree : taxonomyTrees) {
        if (category.getPath().contains(taxonomyTree.getPath())) {
          categoryNode.setParentPath(
              (category.getParent().getPath().replace(taxonomyTree.getParent().getPath(), "")));
          break;
        }
      }
      if (categoryNode != null) documentContent.getCategories().add(categoryNode);
    }
    return documentContent;
  }
コード例 #11
0
 @GET
 @Path("/all/{repoName}")
 public Response getCategory(@PathParam("repoName") String repoName) {
   List<CategoryNode> listCategoryNode = new ArrayList<CategoryNode>();
   if (repoName == null || repoName.trim().isEmpty()) {
     return Response.status(HTTPStatus.NOT_FOUND)
         .entity(new RepositoryException("Can't find repository"))
         .build();
   }
   // Get all category
   try {
     if (documentTypes.isEmpty())
       documentTypes = templateService_.getAllDocumentNodeTypes(repoName);
     List<Node> categoryNodes = taxonomyService_.getAllTaxonomyTrees(repoName);
     for (Node rootCategoryNode : categoryNodes) {
       getTaxnomyNodeRescursive(rootCategoryNode, rootCategoryNode, listCategoryNode);
     }
   } catch (Exception e) {
     LOG.error(e);
     return Response.serverError().build();
   }
   ListResultNode listResultNode = new ListResultNode();
   listResultNode.setLstNode(listCategoryNode);
   return Response.ok(listResultNode, new MediaType("application", "json")).build();
 }
コード例 #12
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.addTaxonomyNode() Input: Add one taxonomy node below MyDocument
  * Expect: One node with primary node type = exo:taxonomy in path MyDocument/
  *
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws RepositoryException
  */
 public void testAddTaxonomyNode1()
     throws TaxonomyNodeAlreadyExistsException, RepositoryException {
   session.getRootNode().addNode("MyDocuments");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Sport", "root");
   Node taxonomyNode = (Node) session.getItem("/MyDocuments/Sport");
   assertTrue(taxonomyNode.isNodeType("exo:taxonomy"));
 }
コード例 #13
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.getAllCategories() Input: Add 3 categories to node Expect: return 3
  * categories
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws TaxonomyAlreadyExistsException
  */
 public void testGetAllCategories()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException,
         TaxonomyAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   Node article = session.getRootNode().addNode("Article");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Culture", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "News", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/News", "Politics", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/Culture", "Foods", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/Culture", "Art", "root");
   Node rootTree1 = (Node) session.getItem("/MyDocuments/Culture");
   Node rootTree2 = (Node) session.getItem("/MyDocuments/News");
   taxonomyService.addTaxonomyTree(rootTree1);
   taxonomyService.addTaxonomyTree(rootTree2);
   taxonomyService.addCategories(article, "Culture", new String[] {"Foods", "Art"}, true);
   taxonomyService.addCategory(article, "News", "Politics", true);
   List<Node> lstNode = mockTaxonomyService.getAllCategories(article, true);
   Node taxoLink1 = (Node) session.getItem("/MyDocuments/Culture/Foods");
   Node taxoLink2 = (Node) session.getItem("/MyDocuments/Culture/Art");
   Node taxoLink3 = (Node) session.getItem("/MyDocuments/News/Politics");
   assertEquals(3, lstNode.size());
   assertTrue(lstNode.contains(taxoLink1));
   assertTrue(lstNode.contains(taxoLink2));
   assertTrue(lstNode.contains(taxoLink3));
 }
コード例 #14
0
ファイル: WCMComposerImpl.java プロジェクト: ultrahertz/ecms
 public List<Node> getCategories(Node node) throws Exception {
   if (taxonomyService == null) taxonomyService = WCMCoreUtils.getService(TaxonomyService.class);
   List<Node> listCategories = new ArrayList<Node>();
   List<Node> listNode = getAllTaxonomyTrees();
   for (Node itemNode : listNode) {
     listCategories.addAll(taxonomyService.getCategories(node, itemNode.getName()));
   }
   return listCategories;
 }
コード例 #15
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.hasCategories() Input: Add categories for article node Expect:
  * return true with category is added return false with category that is not added
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws TaxonomyAlreadyExistsException
  */
 public void testHasCategories()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException,
         TaxonomyAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   Node article = session.getRootNode().addNode("Article");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Budesliga", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Serie", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/Serie", "A", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/Serie", "B", "root");
   Node rootTree1 = (Node) session.getItem("/MyDocuments/Serie");
   Node rootTree2 = (Node) session.getItem("/MyDocuments/Budesliga");
   taxonomyService.addTaxonomyTree(rootTree1);
   taxonomyService.addTaxonomyTree(rootTree2);
   taxonomyService.addCategories(article, "Serie", new String[] {"A", "B"}, true);
   assertTrue(mockTaxonomyService.hasCategories(article, "Serie", true));
   assertFalse(mockTaxonomyService.hasCategories(article, "Budesliga", true));
 }
コード例 #16
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.addTaxonomyNode() throws TaxonomyNodeAlreadyExistsException when
  * Already exist node Input: Add 2 taxonomy node below MyDocument path Ouput:
  * TaxonomyNodeAlreadyExistsException
  *
  * @throws RepositoryException
  */
 public void testAddTaxonomyNode2() throws RepositoryException {
   try {
     session.getRootNode().addNode("MyDocuments");
     session.save();
     taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Sport", "root");
     taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Sport", "root");
   } catch (TaxonomyNodeAlreadyExistsException e) {
   }
 }
コード例 #17
0
ファイル: WCMComposerImpl.java プロジェクト: ultrahertz/ecms
 /**
  * Gets the node by category.
  *
  * @param parameters the parameters
  * @return the node by category
  * @throws Exception the exception
  */
 private Node getNodeByCategory(String parameters) throws Exception {
   try {
     if (taxonomyService == null) taxonomyService = WCMCoreUtils.getService(TaxonomyService.class);
     Node taxonomyTree = taxonomyService.getTaxonomyTree(parameters.split("/")[0]);
     Node symlink = taxonomyTree.getNode(parameters.substring(parameters.indexOf("/") + 1));
     return linkManager.getTarget(symlink);
   } catch (Exception e) {
     return null;
   }
 }
コード例 #18
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.getCategories() Input: Add 2 categories to article node Expect:
  * Return 2 node of categories
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws TaxonomyAlreadyExistsException
  */
 public void testGetCategories()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException,
         TaxonomyAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   Node article = session.getRootNode().addNode("Article");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Stories", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/Stories", "Homorous", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments/Stories", "Fairy", "root");
   Node rootTree = (Node) session.getItem("/MyDocuments/Stories");
   taxonomyService.addTaxonomyTree(rootTree);
   taxonomyService.addCategories(article, "Stories", new String[] {"Homorous", "Fairy"}, true);
   List<Node> lstNode = mockTaxonomyService.getCategories(article, "Stories", true);
   Node taxoLink1 = (Node) session.getItem("/MyDocuments/Stories/Homorous");
   Node taxoLink2 = (Node) session.getItem("/MyDocuments/Stories/Fairy");
   assertEquals(2, lstNode.size());
   assertTrue(lstNode.contains(taxoLink1));
   assertTrue(lstNode.contains(taxoLink2));
 }
コード例 #19
0
 @GET
 @Path("/articles/{repoName}/{docPath:.*}/")
 public Response getArticles(
     @PathParam("repoName") String repoName, @PathParam("docPath") String docPath) {
   DocumentContent docNode = null;
   ListResultNode listResultNode = new ListResultNode();
   if (docPath != null) {
     String taxonomyTree = docPath.split("/")[0];
     String path = docPath.substring(taxonomyTree.length());
     if (path.startsWith("/")) {
       path = path.substring(1);
     }
     try {
       if (documentTypes.isEmpty())
         documentTypes = templateService_.getAllDocumentNodeTypes(repoName);
       Node taxonomyNode = taxonomyService_.getTaxonomyTree(repoName, taxonomyTree);
       if (taxonomyNode == null)
         throw new PathNotFoundException("Can't find category " + taxonomyTree);
       if (!path.equals("")) {
         taxonomyNode = taxonomyNode.getNode(path);
       }
       if (linkManager_.isLink(taxonomyNode)) {
         List<Node> taxonomyTrees = taxonomyService_.getAllTaxonomyTrees(repoName);
         docNode = getArticleContent(linkManager_.getTarget(taxonomyNode), taxonomyTrees);
         return Response.ok(docNode, new MediaType("application", "json")).build();
       } else if (taxonomyNode.isNodeType("exo:taxonomy")) {
         listResultNode.setLstNode(getArticleNode(taxonomyNode, documentTypes));
         Collections.sort(listResultNode.getLstNode(), new NameComparator());
         return Response.ok(listResultNode, new MediaType("application", "json")).build();
       }
     } catch (PathNotFoundException exc) {
       LOG.error("Path Not found " + exc.getMessage(), exc);
       return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build();
     } catch (Exception e) {
       LOG.error(e);
       return Response.serverError().build();
     }
   }
   return Response.ok().build();
 }
コード例 #20
0
 @GET
 @Path("/all/{repoName}/{catePath:.*}/")
 public Response getCategory(
     @PathParam("repoName") String repoName, @PathParam("catePath") String catePath) {
   List<CategoryNode> listCategoryNode = new ArrayList<CategoryNode>();
   if (catePath != null && !catePath.trim().isEmpty()) {
     String taxonomyTree = catePath.split("/")[0];
     String path = catePath.substring(taxonomyTree.length());
     if (path.startsWith("/")) {
       path = path.substring(1);
     }
     try {
       Node taxonomyTreeNode = taxonomyService_.getTaxonomyTree(repoName, taxonomyTree);
       if (taxonomyTreeNode == null)
         throw new PathNotFoundException("Can't find category " + taxonomyTree);
       Node category;
       NodeIterator iterNode;
       if (path.equals("")) {
         iterNode = taxonomyTreeNode.getNodes();
       } else {
         iterNode = taxonomyTreeNode.getNode(path).getNodes();
       }
       CategoryNode categoryNode;
       while (iterNode.hasNext()) {
         category = iterNode.nextNode();
         categoryNode = getCategoryNode(category, makePath(category, taxonomyTreeNode));
         if (categoryNode != null) listCategoryNode.add(categoryNode);
       }
     } catch (PathNotFoundException exc) {
       LOG.error("Path Not found " + exc.getMessage(), exc);
       return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build();
     } catch (Exception e) {
       LOG.error(e);
       return Response.serverError().build();
     }
   }
   ListResultNode listResultNode = new ListResultNode();
   Collections.sort(listCategoryNode, new NameComparator());
   listResultNode.setLstNode(listCategoryNode);
   return Response.ok(listResultNode, new MediaType("application", "json")).build();
 }
コード例 #21
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.getAllTaxonomyTrees(String repository, boolean system) Input: Add 2
  * taxonomy tree Output: size of tree increase 2 trees
  *
  * @throws RepositoryException
  * @throws TaxonomyNodeAlreadyExistsException
  * @throws TaxonomyAlreadyExistsException
  */
 public void testGetAllTaxonomyTrees1()
     throws RepositoryException, TaxonomyNodeAlreadyExistsException,
         TaxonomyAlreadyExistsException {
   session.getRootNode().addNode("MyDocuments");
   session.save();
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Champion Leage", "root");
   taxonomyService.addTaxonomyNode(COLLABORATION_WS, "/MyDocuments", "Europa", "root");
   Node championLeague = (Node) session.getItem("/MyDocuments/Europa");
   Node europa = (Node) session.getItem("/MyDocuments/Champion Leage");
   int totalTree1 = taxonomyService.getAllTaxonomyTrees(REPO_NAME).size();
   taxonomyService.addTaxonomyTree(championLeague);
   taxonomyService.addTaxonomyTree(europa);
   int totalTree2 = taxonomyService.getAllTaxonomyTrees(true).size();
   assertEquals(2, totalTree2 - totalTree1);
 }
コード例 #22
0
 private List<DocumentContent> getArticleNode(Node node, List<String> allDocumentType)
     throws Exception {
   List<DocumentContent> docs = new ArrayList<DocumentContent>();
   NodeIterator nodes = node.getNodes();
   Node docNode;
   List<Node> taxonomyTrees =
       taxonomyService_.getAllTaxonomyTrees(
           ((ManageableRepository) node.getSession().getRepository())
               .getConfiguration()
               .getName());
   while (nodes.hasNext()) {
     docNode = nodes.nextNode();
     if (linkManager_.isLink(docNode)) {
       docNode = linkManager_.getTarget(docNode);
       if (allDocumentType.contains(docNode.getPrimaryNodeType().getName())) {
         docs.add(getArticleContent(docNode, taxonomyTrees));
       }
     }
   }
   return docs;
 }
コード例 #23
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.getTaxonomyTree(String repository, String taxonomyName, boolean
  * system) Expect: return System tree
  *
  * @throws Exception
  */
 public void testGetTaxonomyTree1() throws Exception {
   Node systemTree = taxonomyService.getTaxonomyTree(REPO_NAME, "System");
   assertNotNull(systemTree);
 }
コード例 #24
0
ファイル: WCMComposerImpl.java プロジェクト: ultrahertz/ecms
 List<Node> getAllTaxonomyTrees() throws RepositoryException {
   if (taxonomyService == null) taxonomyService = WCMCoreUtils.getService(TaxonomyService.class);
   return taxonomyService.getAllTaxonomyTrees();
 }
コード例 #25
0
ファイル: TestTaxonomyService.java プロジェクト: hailt/ecms
 /**
  * Test method TaxonomyService.getAllTaxonomyTrees(String repository) Expect: return one tree in
  * repository
  *
  * @throws Exception
  */
 public void testGetAllTaxonomyTrees2() throws Exception {
   assertEquals(1, taxonomyService.getAllTaxonomyTrees(REPO_NAME).size());
 }