chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r934741 - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org...
Date Fri, 16 Apr 2010 10:53:05 GMT
Author: fguillaume
Date: Fri Apr 16 10:53:04 2010
New Revision: 934741

URL: http://svn.apache.org/viewvc?rev=934741&view=rev
Log:
Refactor to get rid of duplicate DTOs (and their interfaces): Rendition

Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/RenditionData.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RenditionDataImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java?rev=934741&r1=934740&r2=934741&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java
Fri Apr 16 10:53:04 2010
@@ -19,23 +19,18 @@
 package org.apache.chemistry.opencmis.client.api;
 
 import org.apache.chemistry.opencmis.commons.api.ContentStream;
+import org.apache.chemistry.opencmis.commons.api.RenditionData;
 
 /**
  * {@see Document#getRenditions()}. Domain Model 2.4.2
  */
-public interface Rendition {
-
-  String getMimeType();
+public interface Rendition extends RenditionData {
 
   long getLength();
 
-  String getKind();
-
-  String getTitle();
-
-  int getHeight();
+  long getHeight();
 
-  int getWidth();
+  long getWidth();
 
   Document getRenditionDocument();
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java?rev=934741&r1=934740&r2=934741&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java
Fri Apr 16 10:53:04 2010
@@ -1199,11 +1199,11 @@ public abstract class AbstractCmisTestCa
 
     assertEquals("Rendition kind:", expected.getKind(), actual.getKind());
     assertEquals("Rendition MIME type:", expected.getMimeType(), actual.getMimeType());
-    assertEquals("Rendition length:", expected.getLength(), actual.getLength());
+    assertEquals("Rendition length:", expected.getBigLength(), actual.getBigLength());
     assertEquals("Rendition stream id:", expected.getStreamId(), actual.getStreamId());
     assertEquals("Rendition title:", expected.getTitle(), actual.getTitle());
-    assertEquals("Rendition height:", expected.getHeight(), actual.getHeight());
-    assertEquals("Rendition width:", expected.getWidth(), actual.getWidth());
+    assertEquals("Rendition height:", expected.getBigHeight(), actual.getBigHeight());
+    assertEquals("Rendition width:", expected.getBigWidth(), actual.getBigWidth());
     assertEquals("Rendition document id:", expected.getRenditionDocumentId(), actual
         .getRenditionDocumentId());
   }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java?rev=934741&r1=934740&r2=934741&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java
Fri Apr 16 10:53:04 2010
@@ -18,7 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.runtime;
 
-import java.io.Serializable;
+import java.math.BigInteger;
 
 import org.apache.chemistry.opencmis.client.api.CmisObject;
 import org.apache.chemistry.opencmis.client.api.Document;
@@ -26,118 +26,52 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.Rendition;
 import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.commons.api.ContentStream;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.RenditionDataImpl;
 
 /**
  * Implementation of <code>Rendition</code>.
  */
-public class RenditionImpl implements Rendition, Serializable {
-
-  private static final long serialVersionUID = 1L;
+public class RenditionImpl extends RenditionDataImpl implements Rendition {
 
   private Session session;
   private String objectId;
-  private String streamId;
-  private String renditionDocumentId;
-  private String kind;
-  private long length;
-  private String mimetype;
-  private String title;
-  private int height;
-  private int width;
 
   /**
    * Constructor.
    */
   public RenditionImpl(Session session, String objectId, String streamId,
-      String renditionDocumentId, String kind, long length, String mimetype, String title,
+      String renditionDocumentId, String kind, long length, String mimeType, String title,
       int height, int width) {
+        super(streamId, mimeType, BigInteger.valueOf(length), kind, title,
+                BigInteger.valueOf(width), BigInteger.valueOf(height),
+                renditionDocumentId);
     this.session = session;
     this.objectId = objectId;
-    this.streamId = streamId;
-    this.renditionDocumentId = renditionDocumentId;
-    this.kind = kind;
-    this.mimetype = mimetype;
-    this.title = title;
-    this.height = height;
-    this.width = width;
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.opencmis.client.api.Rendition#getKind()
-   */
-  public String getKind() {
-    return this.kind;
-  }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.opencmis.client.api.Rendition#getLength()
-   */
   public long getLength() {
-    return this.length;
+    return fLength == null ? -1 : fLength.longValue();
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.opencmis.client.api.Rendition#getMimeType()
-   */
-  public String getMimeType() {
-    return this.mimetype;
-  }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.opencmis.client.api.Rendition#getTitle()
-   */
-  public String getTitle() {
-    return this.title;
+  public long getHeight() {
+    return fHeight == null ? -1 : fHeight.longValue();
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.opencmis.client.api.Rendition#getHeight()
-   */
-  public int getHeight() {
-    return this.height;
+  public long getWidth() {
+    return fWidth == null ? -1 : fWidth.longValue();
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.opencmis.client.api.Rendition#getWidth()
-   */
-  public int getWidth() {
-    return this.width;
-  }
-
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.opencmis.client.api.Rendition#getRenditionDocument()
-   */
   public Document getRenditionDocument() {
     return getRenditionDocument(session.getDefaultContext());
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see
-   * org.apache.opencmis.client.api.Rendition#getRenditionDocument(org.apache.opencmis.client.api
-   * .OperationContext)
-   */
   public Document getRenditionDocument(OperationContext context) {
-    if (this.renditionDocumentId == null) {
+    if (fRenditionDocumentId == null) {
       return null;
     }
-
-    CmisObject rendDoc = session.getObject(session.createObjectId(this.renditionDocumentId),
+    CmisObject rendDoc = session.getObject(session.createObjectId(fRenditionDocumentId),
         context);
     if (!(rendDoc instanceof Document)) {
       return null;
@@ -146,24 +80,18 @@ public class RenditionImpl implements Re
     return (Document) rendDoc;
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.opencmis.client.api.Rendition#getContentStream()
-   */
   public ContentStream getContentStream() {
-    if ((objectId == null) || (streamId == null)) {
+    if ((objectId == null) || (fStreamId == null)) {
       return null;
     }
 
     ContentStream contentStream = session.getBinding().getObjectService().getContentStream(
-        session.getRepositoryInfo().getId(), objectId, streamId, null, null, null);
+        session.getRepositoryInfo().getId(), objectId, fStreamId, null, null, null);
     if (contentStream == null) {
       return null;
     }
 
-    // TODO: what should happen if the length is not set?
-    long length = (contentStream.getBigLength() == null ? -1 : contentStream.getBigLength().longValue());
+    long length = contentStream.getBigLength() == null ? -1 : contentStream.getBigLength().longValue();
 
     return session.getObjectFactory().createContentStream(contentStream.getFileName(), length,
         contentStream.getMimeType(), contentStream.getStream());

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java?rev=934741&r1=934740&r2=934741&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
Fri Apr 16 10:53:04 2010
@@ -172,9 +172,9 @@ public class PersistentObjectFactoryImpl
     }
 
     // TODO: what should happen if the length is not set?
-    long length = (rendition.getLength() == null ? -1 : rendition.getLength().longValue());
-    int height = (rendition.getHeight() == null ? -1 : rendition.getHeight().intValue());
-    int width = (rendition.getWidth() == null ? -1 : rendition.getWidth().intValue());
+    long length = (rendition.getBigLength() == null ? -1 : rendition.getBigLength().longValue());
+    int height = (rendition.getBigHeight() == null ? -1 : rendition.getBigHeight().intValue());
+    int width = (rendition.getBigWidth() == null ? -1 : rendition.getBigWidth().intValue());
 
     return new RenditionImpl(this.session, objectId, rendition.getStreamId(), rendition
         .getRenditionDocumentId(), rendition.getKind(), length, rendition.getMimeType(),
rendition

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/RenditionData.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/RenditionData.java?rev=934741&r1=934740&r2=934741&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/RenditionData.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/RenditionData.java
Fri Apr 16 10:53:04 2010
@@ -27,15 +27,15 @@ public interface RenditionData extends E
 
   String getMimeType();
 
-  BigInteger getLength();
+  BigInteger getBigLength();
 
   String getKind();
 
   String getTitle();
 
-  BigInteger getHeight();
+  BigInteger getBigHeight();
 
-  BigInteger getWidth();
+  BigInteger getBigWidth();
 
   String getRenditionDocumentId();
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java?rev=934741&r1=934740&r2=934741&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java
Fri Apr 16 10:53:04 2010
@@ -1576,14 +1576,14 @@ public final class Converter {
 
     RenditionDataImpl result = new RenditionDataImpl();
 
-    result.setHeight(rendition.getHeight());
+    result.setBigHeight(rendition.getHeight());
     result.setKind(rendition.getKind());
-    result.setLength(rendition.getLength());
+    result.setBigLength(rendition.getLength());
     result.setMimeType(rendition.getMimetype());
     result.setRenditionDocumentId(rendition.getRenditionDocumentId());
     result.setStreamId(rendition.getStreamId());
     result.setTitle(rendition.getTitle());
-    result.setWidth(rendition.getWidth());
+    result.setBigWidth(rendition.getWidth());
 
     // handle extensions
     convertExtension(rendition, result);
@@ -1601,14 +1601,14 @@ public final class Converter {
 
     CmisRenditionType result = new CmisRenditionType();
 
-    result.setHeight(rendition.getHeight());
+    result.setHeight(rendition.getBigHeight());
     result.setKind(rendition.getKind());
-    result.setLength(rendition.getLength());
+    result.setLength(rendition.getBigLength());
     result.setMimetype(rendition.getMimeType());
     result.setRenditionDocumentId(rendition.getRenditionDocumentId());
     result.setStreamId(rendition.getStreamId());
     result.setTitle(rendition.getTitle());
-    result.setWidth(rendition.getWidth());
+    result.setWidth(rendition.getBigWidth());
 
     // handle extensions
     convertExtension(rendition, result);

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RenditionDataImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RenditionDataImpl.java?rev=934741&r1=934740&r2=934741&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RenditionDataImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RenditionDataImpl.java
Fri Apr 16 10:53:04 2010
@@ -24,22 +24,38 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ *
  */
 public class RenditionDataImpl extends AbstractExtensionData implements RenditionData {
 
-  private String fStreamId;
+  protected String fStreamId;
   private String fMimeType;
-  private BigInteger fLength;
+  protected BigInteger fLength;
   private String fKind;
   private String fTitle;
-  private BigInteger fHeight;
-  private BigInteger fWidth;
-  private String fRenditionDocumentId;
+  protected BigInteger fWidth;
+  protected BigInteger fHeight;
+  protected String fRenditionDocumentId;
+
+  public RenditionDataImpl() {
+  }
+
+  public RenditionDataImpl(String streamId, String mimeType, BigInteger length,
+          String kind, String title, BigInteger width, BigInteger height,
+          String renditionDocumentId) {
+      setStreamId(streamId);
+      setMimeType(mimeType);
+      setBigLength(length);
+      setKind(kind);
+      setTitle(title);
+      setBigWidth(width);
+      setBigHeight(height);
+      setRenditionDocumentId(renditionDocumentId);
+  }
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.opencmis.client.provider.RenditionData#getStreamId()
    */
   public String getStreamId() {
@@ -52,7 +68,7 @@ public class RenditionDataImpl extends A
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.opencmis.client.provider.RenditionData#getMimeType()
    */
   public String getMimeType() {
@@ -65,20 +81,20 @@ public class RenditionDataImpl extends A
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.opencmis.client.provider.RenditionData#getLength()
    */
-  public BigInteger getLength() {
+  public BigInteger getBigLength() {
     return fLength;
   }
 
-  public void setLength(BigInteger length) {
+  public void setBigLength(BigInteger length) {
     fLength = length;
   }
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.opencmis.client.provider.RenditionData#getKind()
    */
   public String getKind() {
@@ -91,7 +107,7 @@ public class RenditionDataImpl extends A
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.opencmis.client.provider.RenditionData#getTitle()
    */
   public String getTitle() {
@@ -104,33 +120,33 @@ public class RenditionDataImpl extends A
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.opencmis.client.provider.RenditionData#getHeight()
    */
-  public BigInteger getHeight() {
+  public BigInteger getBigHeight() {
     return fHeight;
   }
 
-  public void setHeight(BigInteger height) {
+  public void setBigHeight(BigInteger height) {
     fHeight = height;
   }
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.opencmis.client.provider.RenditionData#getWidth()
    */
-  public BigInteger getWidth() {
+  public BigInteger getBigWidth() {
     return fWidth;
   }
 
-  public void setWidth(BigInteger width) {
+  public void setBigWidth(BigInteger width) {
     fWidth = width;
   }
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.opencmis.client.provider.RenditionData#getRenditionDocumentId()
    */
   public String getRenditionDocumentId() {
@@ -143,7 +159,7 @@ public class RenditionDataImpl extends A
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see java.lang.Object#toString()
    */
   @Override

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java?rev=934741&r1=934740&r2=934741&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java
Fri Apr 16 10:53:04 2010
@@ -53,14 +53,14 @@ import org.apache.chemistry.opencmis.ser
 
 
 /**
- * A helper class used from various methods to fill the ObjectInfoHolder structure with 
- * the required information to generate all the links in the AtomPub binding. Use this 
+ * A helper class used from various methods to fill the ObjectInfoHolder structure with
+ * the required information to generate all the links in the AtomPub binding. Use this
  * class as a convenience class for starting the implementation. For productive use it
  * is highly recommended that a server implementation replaces this implementation by
  * a more efficient one. This default implementation can only rely on the services and
- * therefore requires a round-trip for each object to the server once again. This can 
+ * therefore requires a round-trip for each object to the server once again. This can
  * be avoided in a repository specific implementation.
- * 
+ *
  */
 
 public class ObjectInfoHelper
@@ -68,25 +68,25 @@ public class ObjectInfoHelper
     private CmisObjectService _objSvc;
     private CmisRepositoryService _repSvc;
     private CmisNavigationService _navSvc;
-    
+
     private Map<String, RepositoryCapabilities > _repos = new HashMap<String, RepositoryCapabilities
>();
     private Map<String, Boolean > _mapPolicies = new HashMap<String, Boolean >();
     private Map<String, Boolean > _mapRelationships = new HashMap<String, Boolean
>();
-    
+
     public ObjectInfoHelper(CmisRepositoryService repSvc, CmisObjectService objSvc, CmisNavigationService
navSvc) {
         _objSvc = objSvc;
         _repSvc = repSvc;
         _navSvc = navSvc;
     }
-    
+
     /**
-     * fill an ObjectInfoHolder object with required information needed for Atom binding

+     * fill an ObjectInfoHolder object with required information needed for Atom binding
      * to be able to generate the necessary links in AtomPub
-     * 
+     *
      * @param context
      *          call context of the current request
      * @param repositoryId
-     *          id of repository 
+     *          id of repository
      * @param objectId
      *          object to retrieve information for
      * @param objectInfos
@@ -94,17 +94,17 @@ public class ObjectInfoHelper
      */
     public ObjectData fillObjectInfoHolder(CallContext context, String repositoryId, String
objectId,
         ObjectInfoHolder objectInfos) {
-        
+
       if (null == objectInfos || null == objectId)
         return null;
-      
+
       // call getObject to get the required information to fill ObjectInfoHolder
       ObjectData objData = getObject(context, repositoryId, objectId);
       fillObjectInfoHolder(context, repositoryId, objData, objectInfos);
-      
+
       return objData; // might be useful as return value in some service methods
     }
-    
+
     /**
      * Fill object in
      * @param context
@@ -119,9 +119,9 @@ public class ObjectInfoHelper
         if (filterContainsRequiredProperties(filter))
             fillObjectInfoHolder(context, repositoryId, objData, objectInfos);
         else // get object again as we need almost all system properties
-            fillObjectInfoHolder(context, repositoryId, objData.getId(), objectInfos);  
     
+            fillObjectInfoHolder(context, repositoryId, objData.getId(), objectInfos);
     }
-    
+
     public boolean filterContainsRequiredProperties(String filter) {
         if (filter==null)
             return false;
@@ -146,16 +146,16 @@ public class ObjectInfoHelper
         if (!filter.contains(PropertyIds.CONTENT_STREAM_ID))
             return false;
         return true;
-        
+
     }
     /**
-     * fill an ObjectInfoHolder object with required information needed for Atom binding

+     * fill an ObjectInfoHolder object with required information needed for Atom binding
      * to be able to generate the necessary links in AtomPub
-     * 
+     *
      * @param context
      *          call context of the current request
      * @param repositoryId
-     *          id of repository 
+     *          id of repository
      * @param objData
      *          object data to grab information from
      * @param objectInfos
@@ -163,20 +163,20 @@ public class ObjectInfoHelper
      */
     public void fillObjectInfoHolder(CallContext context, String repositoryId, ObjectData
objData,
         ObjectInfoHolder objectInfos) {
-        
+
         if (null==objData || null==objectInfos)
             return;
-                
+
         // Get required information about the repository and cache it for later use:
-        
+
         Map<String, PropertyData<?>> properties = objData.getProperties().getProperties();
         RepositoryCapabilities repoCaps = _repos.get(repositoryId);
         if (null == repoCaps) {
             RepositoryInfo repoInfo = _repSvc.getRepositoryInfo(null, repositoryId, null);
             repoCaps = repoInfo.getCapabilities();
-            _repos.put(repositoryId, repoCaps);          
+            _repos.put(repositoryId, repoCaps);
         }
-        
+
         Boolean supportsRelationships = _mapRelationships.get(repositoryId);
         Boolean supportsPolicies = _mapPolicies.get(repositoryId);
         if (null == supportsRelationships || null == supportsPolicies) {
@@ -192,32 +192,32 @@ public class ObjectInfoHelper
             _mapRelationships.put(repositoryId, supportsRelationships);
             _mapPolicies.put(repositoryId, supportsPolicies);
         }
-        
+
         ObjectInfoImpl objInfo = new ObjectInfoImpl();
        // Fill all setters:
         objInfo.setId(objData.getId());
         objInfo.setName(getStringProperty(properties, PropertyIds.NAME));
-        objInfo.setCreatedBy(getStringProperty(properties, PropertyIds.CREATED_BY)); 
-        objInfo.setCreationDate(getDateProperty(properties, PropertyIds.CREATION_DATE));

+        objInfo.setCreatedBy(getStringProperty(properties, PropertyIds.CREATED_BY));
+        objInfo.setCreationDate(getDateProperty(properties, PropertyIds.CREATION_DATE));
         objInfo.setLastModificationDate(getDateProperty(properties, PropertyIds.LAST_MODIFICATION_DATE));
         objInfo.setTypeId(getStringProperty(properties, PropertyIds.OBJECT_TYPE_ID));
         String baseId = getStringProperty(properties, PropertyIds.BASE_TYPE_ID);
         objInfo.setBaseType(BaseTypeId.fromValue(baseId));
-        
+
         boolean isVersioned = getStringProperty(properties, PropertyIds.VERSION_SERIES_ID)
!= null;
-        // versioning information: 
-        if (isVersioned) {          
-          objInfo.setIsCurrentVersion(getBooleanProperty(properties, PropertyIds.IS_LATEST_VERSION));

+        // versioning information:
+        if (isVersioned) {
+          objInfo.setIsCurrentVersion(getBooleanProperty(properties, PropertyIds.IS_LATEST_VERSION));
           objInfo.setVersionSeriesId(getStringProperty(properties, PropertyIds.VERSION_SERIES_ID));
           objInfo.setWorkingCopyId(getStringProperty(properties, PropertyIds.VERSION_SERIES_CHECKED_OUT_ID));
           objInfo.setWorkingCopyOriginalId(null);
         } else { // unversioned document
-          objInfo.setIsCurrentVersion (true); 
+          objInfo.setIsCurrentVersion (true);
           objInfo.setVersionSeriesId(null);
           objInfo.setWorkingCopyId(null);
           objInfo.setWorkingCopyOriginalId(null);
         }
-        
+
         String fileName = getStringProperty(properties, PropertyIds.CONTENT_STREAM_FILE_NAME);
         String mimeType = getStringProperty(properties, PropertyIds.CONTENT_STREAM_MIME_TYPE);
         String streamId = getStringProperty(properties, PropertyIds.CONTENT_STREAM_ID);
@@ -232,7 +232,7 @@ public class ObjectInfoHelper
           objInfo.setContentType(null);
           objInfo.setFileName(null);
         }
-        
+
         if (objInfo.getBaseType() == BaseTypeId.CMIS_FOLDER)
             objInfo.setHasParent(getStringProperty(properties, PropertyIds.PARENT_ID) !=
null);
         else if (objInfo.getBaseType() == BaseTypeId.CMIS_DOCUMENT) {
@@ -241,44 +241,44 @@ public class ObjectInfoHelper
             else
                 objInfo.setHasParent(true);
         } else
-            objInfo.setHasParent(false);            
-        
+            objInfo.setHasParent(false);
+
         // Renditions, currently not supported by in-memory provider
         objInfo.setRenditionInfos(convertRenditions(objData.getRenditions()));
-        
+
         List<String> sourceIds = new ArrayList<String>();
         List<String> targetIds = new ArrayList<String>();
         getRelationshipIds(objData, sourceIds, targetIds);
-        
+
         // Relationships, currently not supported
         objInfo.setSupportsRelationships(supportsRelationships);
         objInfo.setRelationshipSourceIds(sourceIds);
         objInfo.setRelationshipTargetIds(targetIds);
-        
+
         objInfo.setSupportsPolicies(supportsPolicies);
-        
+
         objInfo.setHasAcl(repoCaps.getAclCapability() != CapabilityAcl.NONE);
-        
+
         String baseTypeId = getStringProperty(properties, PropertyIds.BASE_TYPE_ID);
         boolean isFolder = baseTypeId != null && baseTypeId.equals(BaseTypeId.CMIS_FOLDER.value());
-        
+
         objInfo.setSupportsDescendants(isFolder && repoCaps.isGetDescendantsSupported());;
         objInfo.setSupportsFolderTree(isFolder && repoCaps.isGetFolderTreeSupported());
-        
+
         objectInfos.addObjectInfo(objInfo);
     }
 
-        
-        
+
+
 
     /**
-     * fill an ObjectInfoHolder object with required information needed for Atom binding

+     * fill an ObjectInfoHolder object with required information needed for Atom binding
      * to be able to generate the necessary links in AtomPub
-     * 
+     *
      * @param context
      *          call context of the current request
      * @param repositoryId
-     *          id of repository 
+     *          id of repository
      * @param objList
      *          object list, fill information for each element
      * @param objectInfos
@@ -290,25 +290,25 @@ public class ObjectInfoHelper
         ObjectList objList,
         ObjectInfoHolder objectInfos)
     {
-          
+
         if (null != objectInfos && null != objList && null != objList.getObjects())
{
             // Fill object information for all children in result list
             List<ObjectData> listObjects = objList.getObjects();
             if (null != listObjects)
                 for (ObjectData object : listObjects) {
                     fillObjectInfoHolder(context, repositoryId, object.getId(), objectInfos);
-                }    
+                }
         }
     }
 
     /**
-     * fill an ObjectInfoHolder object with required information needed for Atom binding

+     * fill an ObjectInfoHolder object with required information needed for Atom binding
      * to be able to generate the necessary links in AtomPub
-     * 
+     *
      * @param context
      *          call context of the current request
      * @param repositoryId
-     *          id of repository 
+     *          id of repository
      * @param objList
      *          object list, fill information for each element
      * @param objectInfos
@@ -330,13 +330,13 @@ public class ObjectInfoHelper
     }
 
     /**
-     * fill an ObjectInfoHolder object with required information needed for Atom binding

+     * fill an ObjectInfoHolder object with required information needed for Atom binding
      * to be able to generate the necessary links in AtomPub
-     * 
+     *
      * @param context
      *          call context of the current request
      * @param repositoryId
-     *          id of repository 
+     *          id of repository
      * @param objList
      *          object list, fill information for each element
      * @param objectInfos
@@ -358,13 +358,13 @@ public class ObjectInfoHelper
     }
 
     /**
-     * fill an ObjectInfoHolder object with required information needed for Atom binding

+     * fill an ObjectInfoHolder object with required information needed for Atom binding
      * to be able to generate the necessary links in AtomPub
-     * 
+     *
      * @param context
      *          call context of the current request
      * @param repositoryId
-     *          id of repository 
+     *          id of repository
      * @param objList
      *          object list, fill information for each element
      * @param objectInfos
@@ -381,17 +381,17 @@ public class ObjectInfoHelper
 
         for (ObjectParentData object : objParents) {
             fillObjectInfoHolder(context, repositoryId, object.getObject().getId(), objectInfos);
-        }        
+        }
     }
-        
+
     /**
-     * fill an ObjectInfoHolder object with required information needed for Atom binding

+     * fill an ObjectInfoHolder object with required information needed for Atom binding
      * to be able to generate the necessary links in AtomPub
-     * 
+     *
      * @param context
      *          call context of the current request
      * @param repositoryId
-     *          id of repository 
+     *          id of repository
      * @param objList
      *          object list, fill information for each element recursively
      * @param objectInfos
@@ -405,12 +405,12 @@ public class ObjectInfoHelper
     {
         if (null == objectInfos || null == oifcList)
             return;
-          
+
         for (ObjectInFolderContainer object : oifcList) {
             fillObjectInfoHolderFolderContainer(context, repositoryId, object, objectInfos);
-        }    
+        }
     }
-    
+
     private void fillObjectInfoHolderFolderContainer(
         CallContext context,
         String repositoryId,
@@ -427,7 +427,7 @@ public class ObjectInfoHelper
         for (ObjectInFolderContainer object : oifc.getChildren()) {
           // call recursively
           fillObjectInfoHolderFolderContainer(context, repositoryId, object, objectInfos);
-        }    
+        }
     }
 
     private Boolean getBooleanProperty(Map<String, PropertyData<?>> props, String
key) {
@@ -441,7 +441,7 @@ public class ObjectInfoHelper
         String val = null==pdVal ? null : (String) pdVal.getFirstValue();
         return val;
     }
-    
+
     private GregorianCalendar getDateProperty(Map<String, PropertyData<?>> props,
String key) {
         PropertyData<?> pdVal = props.get(key);
         GregorianCalendar val = null==pdVal ? null : (GregorianCalendar) pdVal.getFirstValue();
@@ -455,34 +455,34 @@ public class ObjectInfoHelper
     }
 
     private ObjectData getObject(CallContext context, String repositoryId, String objectId)
{
-        
-        ObjectData od = _objSvc.getObject(context, repositoryId, objectId, null, false, 
+
+        ObjectData od = _objSvc.getObject(context, repositoryId, objectId, null, false,
             IncludeRelationships.BOTH, "*", true, true, null, null);
         return od;
     }
 
     private List<RenditionInfo> convertRenditions(List<RenditionData> renditions)
{
-        
+
         if (null==renditions)
             return null;
-        
+
         List<RenditionInfo> rendInfos = new ArrayList<RenditionInfo>(renditions.size());
         RenditionInfosImpl ri = new RenditionInfosImpl();
         for (RenditionData rd : renditions) {
             ri.setContentType(rd.getMimeType());
             ri.setId(rd.getStreamId());
             ri.setKind(rd.getKind());
-            ri.setLength(rd.getLength());
+            ri.setLength(rd.getBigLength());
             ri.setTitle(rd.getTitle());
-            rendInfos.add(ri);            
+            rendInfos.add(ri);
         }
         return rendInfos;
     }
-    
+
     private void getRelationshipIds(ObjectData objData, List<String> sourceIds, List<String>
targetIds) {
         if (null==objData || null == objData.getRelationships())
             return;
-        
+
         String objectId = objData.getId();
         for (ObjectData rel : objData.getRelationships()) {
             String relId = getStringProperty(rel.getProperties().getProperties(), PropertyIds.OBJECT_ID);
@@ -497,7 +497,7 @@ public class ObjectInfoHelper
 
     private boolean documentHasParent(CallContext context, String repositoryId, String objectId)
     {
-        List<ObjectParentData> opd = _navSvc.getObjectParents(context, repositoryId,
objectId, null, false, IncludeRelationships.NONE, 
+        List<ObjectParentData> opd = _navSvc.getObjectParents(context, repositoryId,
objectId, null, false, IncludeRelationships.NONE,
             null, false, null, null);
 
         return opd!= null && opd.size()>0;



Mime
View raw message