Ate Douma pushed to branch feature/translations-psp1 at cms / 
hippo-plugin-relateddocs


Commits:
75bcf256 by Unico Hommes at 2015-11-24T12:36:52+00:00
HIPPLUG-1200 rollback changes from release preparation of 
related-docs-3.x-translations-1
- - - - -
fd9f3a65 by Arent-Jan Banck at 2016-01-08T14:30:30+00:00
CMS-9856: Update copyright year to 2016
- - - - -
d448178d by Ard Schrijvers at 2016-01-21T10:50:13+00:00
HIPPLUG-1255: copy for branch relateddocs-3.2.x-rest-api
- - - - -
2f60ebcd by Ard Schrijvers at 2016-01-25T10:52:53+00:00
HIPPLUG-1255 make sure relateddocs has a nodetype definition for namespaces, 
otherwise it is skipped in the rest api output
- - - - -
4ca663b1 by Ate Douma at 2016-01-25T16:56:26+00:00
HIPPLUG-1255: implementing custom PrimaryNodeTypeVisitor instead for 
relateddocs:docs
- - - - -
c53773f8 by Ate Douma at 2016-01-25T17:01:57+00:00
HIPPLUG-1255: restoring trunk version info in preparation for merging feature 
back to trunk
- - - - -
b7fd0d8b by Ate Douma at 2016-01-25T17:04:16+00:00
HIPPLUG-1255: implementing custom PrimaryNodeTypeVisitor instead for 
relateddocs:docs
- - - - -
40abfe17 by Ate Douma at 2016-01-25T17:05:26+00:00
HIPPLUG-1255: Reintegrate rest api feature branch back into trunk
- - - - -
212f7740 by Arent-Jan Banck at 2016-01-26T13:06:14+00:00
CMS-9899: prepare branch hippo-plugin-relateddocs-3.2.x
- - - - -
2bbc9196 by Arent-Jan Banck at 2016-01-26T13:06:19+00:00
CMS-9899: prepare for next development iteration
- - - - -
689e067a by Ate Douma at 2016-01-27T13:36:01+00:00
CMS-9905: Update and align project pom parent and other dependency version 
references across all product projects
- - - - -
00983252 by Ate Douma at 2016-02-16T02:04:56+01:00
HIPPLUG-1200 merge changes from master

- - - - -


6 changed files:

- NOTICE
- addon-cms/pom.xml
- addon-cms/src/main/resources/hippoecm-extension.xml
- hst/pom.xml
- + 
hst/src/main/java/org/onehippo/relateddocs/restapi/content/RelatedDocsVisitor.java
- pom.xml


Changes:

=====================================
NOTICE
=====================================
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Hippo Plugin Related Documents
-Copyright 2009-2015 Hippo B.V. (http://www.onehippo.com)
+Copyright 2009-2016 Hippo B.V. (http://www.onehippo.com)
 
 This product includes software developed by:
 Hippo B.V., Amsterdam, The Netherlands (http://www.onehippo.com/);


=====================================
addon-cms/pom.xml
=====================================
--- a/addon-cms/pom.xml
+++ b/addon-cms/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <artifactId>hippo-plugin-relateddocs-parent</artifactId>
     <groupId>org.onehippo.cms7</groupId>
-    <version>3.x-translations-1.0-SNAPSHOT</version>
+    <version>4.0.0-translations-psp1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 


=====================================
addon-cms/src/main/resources/hippoecm-extension.xml
=====================================
--- a/addon-cms/src/main/resources/hippoecm-extension.xml
+++ b/addon-cms/src/main/resources/hippoecm-extension.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-    Copyright 2009 Hippo
+    Copyright 2009-2016 Hippo
 
     Licensed under the Apache License, Version 2.0 (the  "License");
     you may not use this file except in compliance with the License.


=====================================
hst/pom.xml
=====================================
--- a/hst/pom.xml
+++ b/hst/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <artifactId>hippo-plugin-relateddocs-parent</artifactId>
     <groupId>org.onehippo.cms7</groupId>
-    <version>3.x-translations-1.0-SNAPSHOT</version>
+    <version>4.0.0-translations-psp1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
@@ -29,6 +29,16 @@
   <dependencies>
 
     <dependency>
+      <groupId>org.onehippo.cms7</groupId>
+      <artifactId>hippo-services</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.onehippo.cms7</groupId>
+      <artifactId>hippo-repository-api</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>org.onehippo.cms7.hst</groupId>
       <artifactId>hst-api</artifactId>
     </dependency>
@@ -38,6 +48,11 @@
       <artifactId>hst-content-beans</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>org.onehippo.cms7.hst.components</groupId>
+      <artifactId>hst-restapi</artifactId>
+    </dependency>
+
   </dependencies>
 
 </project>
\ No newline at end of file


=====================================
hst/src/main/java/org/onehippo/relateddocs/restapi/content/RelatedDocsVisitor.java
=====================================
--- /dev/null
+++ 
b/hst/src/main/java/org/onehippo/relateddocs/restapi/content/RelatedDocsVisitor.java
@@ -0,0 +1,65 @@
+/*
+ *  Copyright 2016 Hippo B.V. (http://www.onehippo.com)
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.onehippo.relateddocs.restapi.content;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
+import org.hippoecm.hst.restapi.NodeVisitor;
+import org.hippoecm.hst.restapi.ResourceContext;
+import org.hippoecm.hst.restapi.content.visitors.DefaultNodeVisitor;
+import org.hippoecm.hst.restapi.scanning.PrimaryNodeTypeNodeVisitor;
+import org.hippoecm.repository.util.NodeIterable;
+import org.onehippo.cms7.services.contenttype.ContentTypeChild;
+
+@SuppressWarnings("unused")
+@PrimaryNodeTypeNodeVisitor
+public class RelatedDocsVisitor extends DefaultNodeVisitor {
+
+    private static final String NODETYPE_RELATEDDOCS_DOCS = "relateddocs:docs";
+    private static final String RELATEDDOCS_RELDOC = "relateddocs:reldoc";
+
+    @Override
+    public String getNodeType() {
+        return NODETYPE_RELATEDDOCS_DOCS;
+    }
+
+    protected void visitNode(final ResourceContext context, final Node node, 
final Map<String, Object> response)
+            throws RepositoryException {
+        super.visitNode(context, node, response);
+        LinkedHashMap<String, Object> relatedResponse = new LinkedHashMap<>();
+        for (Node child : new NodeIterable(node.getNodes(RELATEDDOCS_RELDOC))) 
{
+            NodeVisitor childVisitor = context.getVisitor(child);
+            childVisitor.visit(context, child, relatedResponse);
+        }
+        if (relatedResponse.containsKey(RELATEDDOCS_RELDOC)) {
+            response.put("related", relatedResponse.get(RELATEDDOCS_RELDOC));
+        }
+        else {
+            response.put("related", Collections.emptyList());
+        }
+    }
+
+    @Override
+    protected boolean skipChild(final ResourceContext context, final 
ContentTypeChild childType, final Node child)
+            throws RepositoryException {
+        return child.isNodeType(RELATEDDOCS_RELDOC);
+    }
+}


=====================================
pom.xml
=====================================
--- a/pom.xml
+++ b/pom.xml
@@ -24,27 +24,28 @@
   <parent>
     <groupId>org.onehippo.cms7</groupId>
     <artifactId>hippo-cms7-project</artifactId>
-    <version>27.3</version>
+    <version>28-SNAPSHOT</version>
   </parent>
 
   <name>Hippo Plugin Related Documents</name>
   <description>Hippo Plugin Related Documents</description>
   <artifactId>hippo-plugin-relateddocs-parent</artifactId>
-  <version>3.x-translations-1.0-SNAPSHOT</version>
+  <version>4.0.0-translations-psp1-SNAPSHOT</version>
   <packaging>pom</packaging>
 
   <inceptionYear>2009</inceptionYear>
 
   <scm>
-    
<connection>scm:svn:https://svn.onehippo.org/repos/hippo/hippo-cms7/plugins/relateddocs/branches/related-docs-3.x-translations-1</connection>
-    
<developerConnection>scm:svn:https://svn.onehippo.org/repos/hippo/hippo-cms7/plugins/relateddocs/branches/related-docs-3.x-translations-1</developerConnection>
-    
<url>https://svn.onehippo.org/repos/hippo/hippo-cms7/plugins/relateddocs/branches/related-docs-3.x-translations-1</url>
+    
<connection>scm:svn:https://svn.onehippo.org/repos/hippo/hippo-cms7/plugins/relateddocs/trunk</connection>
+    
<developerConnection>scm:svn:https://svn.onehippo.org/repos/hippo/hippo-cms7/plugins/relateddocs/trunk</developerConnection>
+    
<url>https://svn.onehippo.org/repos/hippo/hippo-cms7/plugins/relateddocs/trunk</url>
   </scm>
 
   <properties>
-    <hippo.cms.version>3.x-translations-1.0-SNAPSHOT</hippo.cms.version>
-    <hippo.repository.version>3.2.0-SNAPSHOT</hippo.repository.version>
-    <hippo.hst.version>3.2.0-SNAPSHOT</hippo.hst.version>
+    <hippo.services.version>3.0.0-SNAPSHOT</hippo.services.version>
+    <hippo.cms.version>4.0.0-translations-psp1-SNAPSHOT</hippo.cms.version>
+    
<hippo.repository.version>4.0.0-translations-psp1-SNAPSHOT</hippo.repository.version>
+    <hippo.hst.version>4.0.0-translations-psp1-SNAPSHOT</hippo.hst.version>
     <sonar.l10n.locales>nl,fr,it,de</sonar.l10n.locales>
   </properties>
 
@@ -68,6 +69,14 @@
 
   <dependencyManagement>
     <dependencies>
+
+      <dependency>
+        <groupId>org.onehippo.cms7</groupId>
+        <artifactId>hippo-services</artifactId>
+        <version>${hippo.services.version}</version>
+        <scope>provided</scope>
+      </dependency>
+
       <dependency>
         <groupId>org.onehippo.cms7.hst</groupId>
         <artifactId>hst-api</artifactId>
@@ -76,6 +85,13 @@
       </dependency>
 
       <dependency>
+        <groupId>org.onehippo.cms7.hst.components</groupId>
+        <artifactId>hst-restapi</artifactId>
+        <version>${hippo.hst.version}</version>
+        <scope>provided</scope>
+      </dependency>
+
+      <dependency>
         <groupId>org.onehippo.cms7.hst</groupId>
         <artifactId>hst-content-beans</artifactId>
         <version>${hippo.hst.version}</version>



View it on GitLab: 
https://code.onehippo.org/cms/hippo-plugin-relateddocs/compare/0b8efe21f278cadfc0b85b4d6b2a6babdecdca1f...009832521f3a2f141a5cf3b70d2d031f9c06fb84
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to