You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2014/02/19 10:34:31 UTC

svn commit: r1569665 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chem...

Author: fmui
Date: Wed Feb 19 09:34:30 2014
New Revision: 1569665

URL: http://svn.apache.org/r1569665
Log:
CMIS-757: allow arbitrary AtomPub links 

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/LinkInfo.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/LinkInfoImpl.java   (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ObjectInfo.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/ObjectInfoImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AbstractAtomPubServiceCall.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java?rev=1569665&r1=1569664&r2=1569665&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java Wed Feb 19 09:34:30 2014
@@ -96,8 +96,8 @@ public interface CmisObject extends Obje
 
     /**
      * Updates the provided properties. If the repository created a new object,
-     * for example a new version, the object id of the new object is returned.
-     * Otherwise the object id of the current object is returned.
+     * for example a new version, the object ID of the new object is returned.
+     * Otherwise the object ID of the current object is returned.
      * 
      * @param properties
      *            the properties to update

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/LinkInfo.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/LinkInfo.java?rev=1569665&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/LinkInfo.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/LinkInfo.java Wed Feb 19 09:34:30 2014
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.chemistry.opencmis.commons.server;
+
+/**
+ * This class contains information about an arbitrary Atom link. This data is
+ * used to generate the appropriate additional links in AtomPub entries and
+ * feeds.
+ */
+public interface LinkInfo {
+
+    /**
+     * Returns the link rel attribute.
+     */
+    String getRel();
+
+    /**
+     * Returns the link href attribute.
+     */
+    String getHref();
+
+    /**
+     * Returns the link type attribute.
+     */
+    String getType();
+
+    /**
+     * Returns the link id attribute.
+     */
+    String getId();
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/LinkInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ObjectInfo.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ObjectInfo.java?rev=1569665&r1=1569664&r2=1569665&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ObjectInfo.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ObjectInfo.java Wed Feb 19 09:34:30 2014
@@ -31,14 +31,14 @@ import org.apache.chemistry.opencmis.com
 public interface ObjectInfo {
 
     /**
-     * Returns the object id.
+     * Returns the object ID.
      */
     String getId();
 
     /**
-     * Returns an id for the atom:id tag. This id must comply with the Atom
-     * specification. If this method returns <code>null</code>, OpenCMIS
-     * generates a valid id.
+     * Returns an ID for the atom:id tag. This ID must comply with the Atom
+     * specification. If this method returns {@code null}, OpenCMIS generates a
+     * valid ID.
      */
     String getAtomId();
 
@@ -63,7 +63,7 @@ public interface ObjectInfo {
     GregorianCalendar getLastModificationDate();
 
     /**
-     * Returns the type id.
+     * Returns the type ID.
      */
     String getTypeId();
 
@@ -73,98 +73,97 @@ public interface ObjectInfo {
     BaseTypeId getBaseType();
 
     /**
-     * Returns <code>true</code> if the object is a document and if it is the
-     * current version or it is not versionable, <code>false</code> otherwise.
+     * Returns {@code true} if the object is a document and if it is the current
+     * version or it is not versionable, {@code false} otherwise.
      */
     boolean isCurrentVersion();
 
     /**
-     * Returns the version series id if the object is a document and it is
-     * versionable, <code>null</code> otherwise.
+     * Returns the version series ID if the object is a document and it is
+     * versionable, {@code null} otherwise.
      */
     String getVersionSeriesId();
 
     /**
-     * Returns the working copy id if the object is a document and a working
-     * copy exists, <code>null</code> otherwise.
+     * Returns the working copy ID if the object is a document and a working
+     * copy exists, {@code null} otherwise.
      */
     String getWorkingCopyId();
 
     /**
-     * Returns the original id of the working copy if the object is a document
-     * and a working copy, <code>null</code> otherwise.
+     * Returns the original ID of the working copy if the object is a document
+     * and a working copy, {@code null} otherwise.
      */
     String getWorkingCopyOriginalId();
 
     /**
-     * Returns <code>true</code> if the object is a document and has content,
-     * <code>false</code> otherwise.
+     * Returns {@code true} if the object is a document and has content,
+     * {@code false} otherwise.
      */
     boolean hasContent();
 
     /**
      * Returns the content type of the content if the object is a document and
-     * has content, <code>null</code> otherwise.
+     * has content, {@code null} otherwise.
      */
     String getContentType();
 
     /**
      * Returns the file name of the content if the object is a document and has
-     * content, <code>null</code> otherwise.
+     * content, {@code null} otherwise.
      */
     String getFileName();
 
     /**
-     * Returns rendition information if the object has renditions,
-     * <code>null</code> otherwise.
+     * Returns rendition information if the object has renditions, {@code null}
+     * otherwise.
      */
     List<RenditionInfo> getRenditionInfos();
 
     /**
-     * Returns <code>true</code> if the object supports relationships even if no
-     * relationships exist, <code>false</code> otherwise.
+     * Returns {@code true} if the object supports relationships even if no
+     * relationships exist, {@code false} otherwise.
      */
     boolean supportsRelationships();
 
     /**
-     * Returns <code>true</code> if the object supports policies even if no
-     * policies are applied, <code>false</code> otherwise.
+     * Returns {@code true} if the object supports policies even if no policies
+     * are applied, {@code false} otherwise.
      */
     boolean supportsPolicies();
 
     /**
-     * Returns <code>true</code> if the object has an ACL, <code>false</code>
-     * otherwise.
+     * Returns {@code true} if the object has an ACL, {@code false} otherwise.
      */
     boolean hasAcl();
 
     /**
-     * Returns <code>true</code> if the object has at least one parent,
-     * <code>false</code> otherwise.
+     * Returns {@code true} if the object has at least one parent, {@code false}
+     * otherwise.
      */
     boolean hasParent();
 
     /**
-     * Returns <code>true</code> if the object is a folder and supports
-     * <code>getDescendants</code>, <code>false</code> otherwise.
+     * Returns {@code true} if the object is a folder and supports
+     * {@code getDescendants}, {@code false} otherwise.
      */
     boolean supportsDescendants();
 
     /**
-     * Returns <code>true</code> if the object is a folder and supports
-     * <code>getFolderTree</code>, <code>false</code> otherwise.
+     * Returns {@code true} if the object is a folder and supports
+     * {@code getFolderTree}, {@code false} otherwise.
      */
     boolean supportsFolderTree();
 
     /**
-     * Returns the list of ids of the relationships that originate from this
-     * object, <code>null</code> is no such relationships exist.
+     * Returns the list of IDs of the relationships that originate from this
+     * object, {@code null} is no such relationships exist.
      */
     List<String> getRelationshipSourceIds();
 
     /**
-     * Returns the list of ids of the relationships that point to this object,
-     * <code>null</code> is no such relationships exist.
+     * Returns the list of IDs of the relationships that point to this object,
+     * {@code null} is no such relationships exist.
      */
     List<String> getRelationshipTargetIds();
 
@@ -172,4 +171,10 @@ public interface ObjectInfo {
      * Returns the full object.
      */
     ObjectData getObject();
+
+    /**
+     * Returns the list of additional links related to this object, {@code null}
+     * is no such links exist.
+     */
+    List<LinkInfo> getAdditionalLinks();
 }

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/LinkInfoImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/LinkInfoImpl.java?rev=1569665&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/LinkInfoImpl.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/LinkInfoImpl.java Wed Feb 19 09:34:30 2014
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.chemistry.opencmis.commons.impl.server;
+
+import org.apache.chemistry.opencmis.commons.server.LinkInfo;
+
+/**
+ * Implementation of the {@link LinkInfo} interface.
+ */
+public class LinkInfoImpl implements LinkInfo {
+
+    private String rel;
+    private String href;
+    private String type = null;
+    private String id = null;
+
+    public LinkInfoImpl() {
+    }
+
+    public LinkInfoImpl(String rel, String href) {
+        this.rel = rel;
+        this.href = href;
+    }
+
+    public LinkInfoImpl(String rel, String href, String type) {
+        this(rel, href);
+        this.type = type;
+    }
+
+    public LinkInfoImpl(String rel, String href, String type, String id) {
+        this(rel, href, type);
+        this.id = id;
+    }
+
+    public String getRel() {
+        return rel;
+    }
+
+    public void setRel(String rel) {
+        this.rel = rel;
+    }
+
+    public String getHref() {
+        return href;
+    }
+
+    public void setHref(String href) {
+        this.href = href;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/LinkInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/ObjectInfoImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/ObjectInfoImpl.java?rev=1569665&r1=1569664&r2=1569665&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/ObjectInfoImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/ObjectInfoImpl.java Wed Feb 19 09:34:30 2014
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.server.LinkInfo;
 import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
 import org.apache.chemistry.opencmis.commons.server.RenditionInfo;
 
@@ -55,6 +56,7 @@ public class ObjectInfoImpl implements O
     private boolean supportsFolderTree = false;
     private List<String> relationshipSourceIds = null;
     private List<String> relationshipTargetIds = null;
+    private List<LinkInfo> additionalLinks = null;
     private ObjectData object = null;
 
     public ObjectInfoImpl() {
@@ -257,6 +259,14 @@ public class ObjectInfoImpl implements O
         this.relationshipTargetIds = relationshipTargetIds;
     }
 
+    public List<LinkInfo> getAdditionalLinks() {
+        return additionalLinks;
+    }
+
+    public void setAdditionalLinks(List<LinkInfo> additionalLinks) {
+        this.additionalLinks = additionalLinks;
+    }
+
     public ObjectData getObject() {
         return object;
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AbstractAtomPubServiceCall.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AbstractAtomPubServiceCall.java?rev=1569665&r1=1569664&r2=1569665&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AbstractAtomPubServiceCall.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AbstractAtomPubServiceCall.java Wed Feb 19 09:34:30 2014
@@ -41,6 +41,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
+import org.apache.chemistry.opencmis.commons.server.LinkInfo;
 import org.apache.chemistry.opencmis.commons.server.NamespaceDefinitions;
 import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
 import org.apache.chemistry.opencmis.commons.server.RenditionInfo;
@@ -258,6 +259,12 @@ public abstract class AbstractAtomPubSer
             }
         }
 
+        if (info.getAdditionalLinks() != null) {
+            for (LinkInfo linkInfo : info.getAdditionalLinks()) {
+                entry.writeLink(linkInfo.getRel(), linkInfo.getHref(), linkInfo.getType(), linkInfo.getId());
+            }
+        }
+
         // write children
         if ((children != null) && (children.size() > 0)) {
             writeObjectChildren(service, entry, info, children, repositoryId, baseUrl, cmisVersion);