chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r928409 - in /incubator/chemistry/trunk/opencmis: opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/ opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ opencmis-client...
Date Sun, 28 Mar 2010 14:33:04 GMT
Author: fmui
Date: Sun Mar 28 14:33:03 2010
New Revision: 928409

URL: http://svn.apache.org/viewvc?rev=928409&view=rev
Log:
CMIS-184: replaced List<Property<?>> with Map<String, ?>

Removed:
    incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-fit/log4j.log.1
Modified:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Folder.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-impl/src/main/java/org/apache/opencmis/commons/impl/dataobjects/AbstractPropertyData.java
    incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-fit/src/test/java/org/apache/opencmis/fit/runtime/WriteObjectIT.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java Sun Mar 28 14:33:03 2010
@@ -117,7 +117,7 @@ public interface CmisObject extends Obje
 
   ObjectId updateProperties();
 
-  ObjectId updateProperties(Map<String, Object> properties);
+  ObjectId updateProperties(Map<String, ?> properties);
 
   // relationship service
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java Sun Mar 28 14:33:03 2010
@@ -19,6 +19,7 @@
 package org.apache.opencmis.client.api;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.opencmis.commons.enums.VersioningState;
 
@@ -43,7 +44,7 @@ public interface Document extends Fileab
 
   void cancelCheckOut();
 
-  ObjectId checkIn(boolean major, List<Property<?>> properties, ContentStream contentStream,
+  ObjectId checkIn(boolean major, Map<String, ?> properties, ContentStream contentStream,
       String checkinComment, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces);
 
   Document getObjectOfLatestVersion(boolean major);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Folder.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Folder.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Folder.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Folder.java Sun Mar 28 14:33:03 2010
@@ -19,6 +19,7 @@
 package org.apache.opencmis.client.api;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.opencmis.client.api.objecttype.ObjectType;
 import org.apache.opencmis.client.api.util.Container;
@@ -32,18 +33,18 @@ import org.apache.opencmis.commons.enums
 public interface Folder extends FileableCmisObject {
 
   // object service
-  Document createDocument(List<Property<?>> properties, ContentStream contentStream,
+  Document createDocument(Map<String, ?> properties, ContentStream contentStream,
       VersioningState versioningState, List<Policy> policies, List<Ace> addAces,
       List<Ace> removeAces, OperationContext context);
 
-  Document createDocumentFromSource(ObjectId source, List<Property<?>> properties,
+  Document createDocumentFromSource(ObjectId source, Map<String, ?> properties,
       VersioningState versioningState, List<Policy> policies, List<Ace> addAces,
       List<Ace> removeAces, OperationContext context);
 
-  Folder createFolder(List<Property<?>> properties, List<Policy> policies, List<Ace> addAces,
+  Folder createFolder(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
       List<Ace> removeAces, OperationContext context);
 
-  Policy createPolicy(List<Property<?>> properties, List<Policy> policies, List<Ace> addAces,
+  Policy createPolicy(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
       List<Ace> removeAces, OperationContext context);
 
   /**

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java Sun Mar 28 14:33:03 2010
@@ -20,6 +20,7 @@ package org.apache.opencmis.client.api;
 
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.opencmis.client.api.objecttype.ObjectType;
@@ -165,20 +166,20 @@ public interface Session {
 
   // create
 
-  ObjectId createDocument(List<Property<?>> properties, ObjectId folderId,
+  ObjectId createDocument(Map<String, ?> properties, ObjectId folderId,
       ContentStream contentStream, VersioningState versioningState, List<Policy> policies,
       List<Ace> addAces, List<Ace> removeAces);
 
-  ObjectId createDocumentFromSource(ObjectId source, List<Property<?>> properties,
-      ObjectId folderId, VersioningState versioningState, List<Policy> policies, List<Ace> addAces,
+  ObjectId createDocumentFromSource(ObjectId source, Map<String, ?> properties, ObjectId folderId,
+      VersioningState versioningState, List<Policy> policies, List<Ace> addAces,
       List<Ace> removeAces);
 
-  ObjectId createFolder(List<Property<?>> properties, ObjectId folderId, List<Policy> policies,
+  ObjectId createFolder(Map<String, ?> properties, ObjectId folderId, List<Policy> policies,
       List<Ace> addAces, List<Ace> removeAces);
 
-  ObjectId createPolicy(List<Property<?>> properties, ObjectId folderId, List<Policy> policies,
+  ObjectId createPolicy(Map<String, ?> properties, ObjectId folderId, List<Policy> policies,
       List<Ace> addAces, List<Ace> removeAces);
 
-  ObjectId createRelationship(List<Property<?>> properties, List<Policy> policies,
-      List<Ace> addAces, List<Ace> removeAces);
+  ObjectId createRelationship(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
+      List<Ace> removeAces);
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java Sun Mar 28 14:33:03 2010
@@ -19,7 +19,6 @@
 package org.apache.opencmis.client.api.repository;
 
 import java.io.InputStream;
-import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -98,7 +97,7 @@ public interface ObjectFactory {
 
   Map<String, Property<?>> convertProperties(ObjectType objectType, PropertiesData properties);
 
-  PropertiesData convertProperties(Collection<Property<?>> properties,
+  PropertiesData convertProperties(Map<String, ?> properties, ObjectType type,
       Set<Updatability> updatabilityFilter);
 
   List<QueryProperty<?>> convertQueryProperties(PropertiesData properties);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java Sun Mar 28 14:33:03 2010
@@ -97,6 +97,7 @@ public abstract class AbstractPersistent
     this.session = session;
     this.objectType = objectType;
     this.creationContext = new OperationContextImpl(context);
+    this.refreshTimestamp = System.currentTimeMillis();
 
     ObjectFactory of = getObjectFactory();
 
@@ -269,7 +270,8 @@ public abstract class AbstractPersistent
       // it's time to update
       getProvider().getObjectService().updateProperties(getRepositoryId(), objectIdHolder,
           changeTokenHolder,
-          getObjectFactory().convertProperties(this.properties.values(), updatebility), null);
+          getObjectFactory().convertProperties(this.properties, this.objectType, updatebility),
+          null);
 
       if (objectIdHolder.getValue() == null) {
         return null;
@@ -287,8 +289,8 @@ public abstract class AbstractPersistent
    * 
    * @see org.apache.opencmis.client.api.CmisObject#updateProperties(java.util.Map)
    */
-  public ObjectId updateProperties(Map<String, Object> updateProperties) {
-    if ((updateProperties == null) || (updateProperties.isEmpty())) {
+  public ObjectId updateProperties(Map<String, ?> properties) {
+    if ((properties == null) || (properties.isEmpty())) {
       throw new IllegalArgumentException("Properties must not be empty!");
     }
 
@@ -309,20 +311,10 @@ public abstract class AbstractPersistent
         updatebility.add(Updatability.WHENCHECKEDOUT);
       }
 
-      // build property list
-      ObjectFactory of = getObjectFactory();
-      List<Property<?>> propertyList = new ArrayList<Property<?>>();
-      for (Map.Entry<String, Object> property : updateProperties.entrySet()) {
-        PropertyDefinition<?> propertyDefinition = checkProperty(property.getKey(), property
-            .getValue());
-
-        // create property
-        propertyList.add(of.createProperty(propertyDefinition, property.getValue()));
-      }
-
       // it's time to update
       getProvider().getObjectService().updateProperties(getRepositoryId(), objectIdHolder,
-          changeTokenHolder, of.convertProperties(propertyList, updatebility), null);
+          changeTokenHolder,
+          getObjectFactory().convertProperties(properties, this.objectType, updatebility), null);
 
       if (objectIdHolder.getValue() == null) {
         return null;

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java Sun Mar 28 14:33:03 2010
@@ -22,6 +22,7 @@ import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.opencmis.client.api.Ace;
@@ -161,31 +162,37 @@ public class PersistentDocumentImpl exte
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.api.Document#checkIn(boolean, java.util.List,
+   * @see org.apache.opencmis.client.api.Document#checkIn(boolean, java.util.Map,
    * org.apache.opencmis.client.api.ContentStream, java.lang.String, java.util.List, java.util.List,
    * java.util.List)
    */
-  public ObjectId checkIn(boolean major, List<Property<?>> properties, ContentStream contentStream,
+  public ObjectId checkIn(boolean major, Map<String, ?> properties, ContentStream contentStream,
       String checkinComment, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
-    String objectId = getObjectId();
-    Holder<String> objectIdHolder = new Holder<String>(objectId);
+    readLock();
+    try {
+      String objectId = getObjectId();
+      Holder<String> objectIdHolder = new Holder<String>(objectId);
 
-    ObjectFactory of = getObjectFactory();
+      ObjectFactory of = getObjectFactory();
 
-    Set<Updatability> updatebility = new HashSet<Updatability>();
-    updatebility.add(Updatability.READWRITE);
-    updatebility.add(Updatability.WHENCHECKEDOUT);
-
-    getProvider().getVersioningService().checkIn(getRepositoryId(), objectIdHolder, major,
-        of.convertProperties(properties, updatebility), of.convertContentStream(contentStream),
-        checkinComment, of.convertPolicies(policies), of.convertAces(addAces),
-        of.convertAces(removeAces), null);
+      Set<Updatability> updatebility = new HashSet<Updatability>();
+      updatebility.add(Updatability.READWRITE);
+      updatebility.add(Updatability.WHENCHECKEDOUT);
+
+      getProvider().getVersioningService().checkIn(getRepositoryId(), objectIdHolder, major,
+          of.convertProperties(properties, getType(), updatebility),
+          of.convertContentStream(contentStream), checkinComment, of.convertPolicies(policies),
+          of.convertAces(addAces), of.convertAces(removeAces), null);
 
-    if (objectIdHolder.getValue() == null) {
-      return null;
-    }
+      if (objectIdHolder.getValue() == null) {
+        return null;
+      }
 
-    return getSession().createObjectId(objectIdHolder.getValue());
+      return getSession().createObjectId(objectIdHolder.getValue());
+    }
+    finally {
+      readUnlock();
+    }
   }
 
   /*

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java Sun Mar 28 14:33:03 2010
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.opencmis.client.api.Ace;
@@ -34,7 +35,6 @@ import org.apache.opencmis.client.api.Fo
 import org.apache.opencmis.client.api.ObjectId;
 import org.apache.opencmis.client.api.OperationContext;
 import org.apache.opencmis.client.api.Policy;
-import org.apache.opencmis.client.api.Property;
 import org.apache.opencmis.client.api.objecttype.ObjectType;
 import org.apache.opencmis.client.api.repository.ObjectFactory;
 import org.apache.opencmis.client.api.util.Container;
@@ -42,6 +42,7 @@ import org.apache.opencmis.client.api.ut
 import org.apache.opencmis.client.runtime.util.AbstractPagingList;
 import org.apache.opencmis.client.runtime.util.ContainerImpl;
 import org.apache.opencmis.commons.PropertyIds;
+import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
 import org.apache.opencmis.commons.enums.IncludeRelationships;
 import org.apache.opencmis.commons.enums.UnfileObjects;
 import org.apache.opencmis.commons.enums.Updatability;
@@ -76,12 +77,12 @@ public class PersistentFolderImpl extend
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.api.Folder#createDocument(java.util.List,
+   * @see org.apache.opencmis.client.api.Folder#createDocument(java.util.Map,
    * org.apache.opencmis.client.api.ContentStream,
    * org.apache.opencmis.commons.enums.VersioningState, java.util.List, java.util.List,
    * java.util.List, org.apache.opencmis.client.api.OperationContext)
    */
-  public Document createDocument(List<Property<?>> properties, ContentStream contentStream,
+  public Document createDocument(Map<String, ?> properties, ContentStream contentStream,
       VersioningState versioningState, List<Policy> policies, List<Ace> addAces,
       List<Ace> removeAces, OperationContext context) {
     String objectId = getObjectId();
@@ -89,7 +90,7 @@ public class PersistentFolderImpl extend
     ObjectFactory of = getObjectFactory();
 
     String newId = getProvider().getObjectService().createDocument(getRepositoryId(),
-        of.convertProperties(properties, CREATE_UPDATABILITY), objectId,
+        of.convertProperties(properties, null, CREATE_UPDATABILITY), objectId,
         of.convertContentStream(contentStream), versioningState, of.convertPolicies(policies),
         of.convertAces(addAces), of.convertAces(removeAces), null);
 
@@ -112,26 +113,41 @@ public class PersistentFolderImpl extend
    * 
    * @see
    * org.apache.opencmis.client.api.Folder#createDocumentFromSource(org.apache.opencmis.client.api
-   * .ObjectId, java.util.List, org.apache.opencmis.commons.enums.VersioningState, java.util.List,
+   * .ObjectId, java.util.Map, org.apache.opencmis.commons.enums.VersioningState, java.util.List,
    * java.util.List, java.util.List, org.apache.opencmis.client.api.OperationContext)
    */
-  public Document createDocumentFromSource(ObjectId source, List<Property<?>> properties,
+  public Document createDocumentFromSource(ObjectId source, Map<String, ?> properties,
       VersioningState versioningState, List<Policy> policies, List<Ace> addAces,
       List<Ace> removeAces, OperationContext context) {
-    String objectId = getObjectId();
-
     if ((source == null) || (source.getId() == null)) {
       throw new IllegalArgumentException("Source must be set!");
     }
 
+    String objectId = getObjectId();
+
+    // get the type of the source document
+    ObjectType type = null;
+    if (source instanceof CmisObject) {
+      type = ((CmisObject) source).getBaseType();
+    }
+    else {
+      CmisObject sourceObj = getSession().getObject(source);
+      type = sourceObj.getType();
+    }
+
+    if (type.getBaseTypeId() != BaseObjectTypeIds.CMIS_DOCUMENT) {
+      throw new IllegalArgumentException("Source object must be a document!");
+    }
+
     ObjectFactory of = getObjectFactory();
 
     Set<Updatability> updatebility = new HashSet<Updatability>();
     updatebility.add(Updatability.READWRITE);
 
     String newId = getProvider().getObjectService().createDocumentFromSource(getRepositoryId(),
-        source.getId(), of.convertProperties(properties, updatebility), objectId, versioningState,
-        of.convertPolicies(policies), of.convertAces(addAces), of.convertAces(removeAces), null);
+        source.getId(), of.convertProperties(properties, type, updatebility), objectId,
+        versioningState, of.convertPolicies(policies), of.convertAces(addAces),
+        of.convertAces(removeAces), null);
 
     // if no context is provided the object will not be fetched
     if ((context == null) || (newId == null)) {
@@ -150,17 +166,17 @@ public class PersistentFolderImpl extend
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.api.Folder#createFolder(java.util.List, java.util.List,
+   * @see org.apache.opencmis.client.api.Folder#createFolder(java.util.Map, java.util.List,
    * java.util.List, java.util.List, org.apache.opencmis.client.api.OperationContext)
    */
-  public Folder createFolder(List<Property<?>> properties, List<Policy> policies,
-      List<Ace> addAces, List<Ace> removeAces, OperationContext context) {
+  public Folder createFolder(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
+      List<Ace> removeAces, OperationContext context) {
     String objectId = getObjectId();
 
     ObjectFactory of = getObjectFactory();
 
     String newId = getProvider().getObjectService().createFolder(getRepositoryId(),
-        of.convertProperties(properties, CREATE_UPDATABILITY), objectId,
+        of.convertProperties(properties, null, CREATE_UPDATABILITY), objectId,
         of.convertPolicies(policies), of.convertAces(addAces), of.convertAces(removeAces), null);
 
     // if no context is provided the object will not be fetched
@@ -180,17 +196,17 @@ public class PersistentFolderImpl extend
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.api.Folder#createPolicy(java.util.List, java.util.List,
+   * @see org.apache.opencmis.client.api.Folder#createPolicy(java.util.Map, java.util.List,
    * java.util.List, java.util.List, org.apache.opencmis.client.api.OperationContext)
    */
-  public Policy createPolicy(List<Property<?>> properties, List<Policy> policies,
-      List<Ace> addAces, List<Ace> removeAces, OperationContext context) {
+  public Policy createPolicy(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
+      List<Ace> removeAces, OperationContext context) {
     String objectId = getObjectId();
 
     ObjectFactory of = getObjectFactory();
 
     String newId = getProvider().getObjectService().createPolicy(getRepositoryId(),
-        of.convertProperties(properties, CREATE_UPDATABILITY), objectId,
+        of.convertProperties(properties, null, CREATE_UPDATABILITY), objectId,
         of.convertPolicies(policies), of.convertAces(addAces), of.convertAces(removeAces), null);
 
     // if no context is provided the object will not be fetched

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java Sun Mar 28 14:33:03 2010
@@ -41,7 +41,6 @@ import org.apache.opencmis.client.api.Ob
 import org.apache.opencmis.client.api.OperationContext;
 import org.apache.opencmis.client.api.PersistentSession;
 import org.apache.opencmis.client.api.Policy;
-import org.apache.opencmis.client.api.Property;
 import org.apache.opencmis.client.api.QueryResult;
 import org.apache.opencmis.client.api.objecttype.ObjectType;
 import org.apache.opencmis.client.api.repository.ObjectFactory;
@@ -58,6 +57,7 @@ import org.apache.opencmis.commons.Sessi
 import org.apache.opencmis.commons.api.TypeDefinition;
 import org.apache.opencmis.commons.api.TypeDefinitionContainer;
 import org.apache.opencmis.commons.api.TypeDefinitionList;
+import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
 import org.apache.opencmis.commons.enums.IncludeRelationships;
 import org.apache.opencmis.commons.enums.Updatability;
 import org.apache.opencmis.commons.enums.VersioningState;
@@ -73,6 +73,14 @@ import org.apache.opencmis.commons.provi
 /**
  * Persistent model session.
  */
+/**
+ * @author florianm
+ *
+ */
+/**
+ * @author florianm
+ * 
+ */
 public class PersistentSessionImpl implements PersistentSession, Serializable {
 
   private static final OperationContext DEFAULT_CONTEXT = new OperationContextImpl(null, false,
@@ -724,12 +732,12 @@ public class PersistentSessionImpl imple
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.api.Session#createDocument(java.util.List,
+   * @see org.apache.opencmis.client.api.Session#createDocument(java.util.Map,
    * org.apache.opencmis.client.api.ObjectId, org.apache.opencmis.client.api.ContentStream,
    * org.apache.opencmis.commons.enums.VersioningState, java.util.List, java.util.List,
    * java.util.List)
    */
-  public ObjectId createDocument(List<Property<?>> properties, ObjectId folderId,
+  public ObjectId createDocument(Map<String, ?> properties, ObjectId folderId,
       ContentStream contentStream, VersioningState versioningState, List<Policy> policies,
       List<Ace> addAces, List<Ace> removeAces) {
     if ((folderId != null) && (folderId.getId() == null)) {
@@ -737,7 +745,7 @@ public class PersistentSessionImpl imple
     }
 
     String newId = getProvider().getObjectService().createDocument(getRepositoryId(),
-        objectFactory.convertProperties(properties, CREATE_UPDATABILITY),
+        objectFactory.convertProperties(properties, null, CREATE_UPDATABILITY),
         (folderId == null ? null : folderId.getId()),
         objectFactory.convertContentStream(contentStream), versioningState,
         objectFactory.convertPolicies(policies), objectFactory.convertAces(addAces),
@@ -755,19 +763,33 @@ public class PersistentSessionImpl imple
    * 
    * @see
    * org.apache.opencmis.client.api.Session#createDocumentFromSource(org.apache.opencmis.client.
-   * api.Document, java.util.List, java.lang.String,
+   * api.ObjectId, java.util.Map, org.apache.opencmis.client.api.ObjectId,
    * org.apache.opencmis.commons.enums.VersioningState, java.util.List, java.util.List,
    * java.util.List)
    */
-  public ObjectId createDocumentFromSource(ObjectId source, List<Property<?>> properties,
+  public ObjectId createDocumentFromSource(ObjectId source, Map<String, ?> properties,
       ObjectId folderId, VersioningState versioningState, List<Policy> policies, List<Ace> addAces,
       List<Ace> removeAces) {
     if ((folderId != null) && (folderId.getId() == null)) {
       throw new IllegalArgumentException("Folder Id must be set!");
     }
 
+    // get the type of the source document
+    ObjectType type = null;
+    if (source instanceof CmisObject) {
+      type = ((CmisObject) source).getBaseType();
+    }
+    else {
+      CmisObject sourceObj = getObject(source);
+      type = sourceObj.getType();
+    }
+
+    if (type.getBaseTypeId() != BaseObjectTypeIds.CMIS_DOCUMENT) {
+      throw new IllegalArgumentException("Source object must be a document!");
+    }
+
     String newId = getProvider().getObjectService().createDocumentFromSource(getRepositoryId(),
-        source.getId(), objectFactory.convertProperties(properties, CREATE_UPDATABILITY),
+        source.getId(), objectFactory.convertProperties(properties, type, CREATE_UPDATABILITY),
         (folderId == null ? null : folderId.getId()), versioningState,
         objectFactory.convertPolicies(policies), objectFactory.convertAces(addAces),
         objectFactory.convertAces(removeAces), null);
@@ -782,17 +804,17 @@ public class PersistentSessionImpl imple
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.api.Session#createFolder(java.util.List, java.lang.String,
-   * java.util.List, java.util.List, java.util.List)
+   * @see org.apache.opencmis.client.api.Session#createFolder(java.util.Map,
+   * org.apache.opencmis.client.api.ObjectId, java.util.List, java.util.List, java.util.List)
    */
-  public ObjectId createFolder(List<Property<?>> properties, ObjectId folderId,
-      List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
+  public ObjectId createFolder(Map<String, ?> properties, ObjectId folderId, List<Policy> policies,
+      List<Ace> addAces, List<Ace> removeAces) {
     if ((folderId != null) && (folderId.getId() == null)) {
       throw new IllegalArgumentException("Folder Id must be set!");
     }
 
     String newId = getProvider().getObjectService().createFolder(getRepositoryId(),
-        objectFactory.convertProperties(properties, CREATE_UPDATABILITY),
+        objectFactory.convertProperties(properties, null, CREATE_UPDATABILITY),
         (folderId == null ? null : folderId.getId()), objectFactory.convertPolicies(policies),
         objectFactory.convertAces(addAces), objectFactory.convertAces(removeAces), null);
 
@@ -806,17 +828,17 @@ public class PersistentSessionImpl imple
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.api.Session#createPolicy(java.util.List, java.lang.String,
-   * java.util.List, java.util.List, java.util.List)
+   * @see org.apache.opencmis.client.api.Session#createPolicy(java.util.Map,
+   * org.apache.opencmis.client.api.ObjectId, java.util.List, java.util.List, java.util.List)
    */
-  public ObjectId createPolicy(List<Property<?>> properties, ObjectId folderId,
-      List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
+  public ObjectId createPolicy(Map<String, ?> properties, ObjectId folderId, List<Policy> policies,
+      List<Ace> addAces, List<Ace> removeAces) {
     if ((folderId != null) && (folderId.getId() == null)) {
       throw new IllegalArgumentException("Folder Id must be set!");
     }
 
     String newId = getProvider().getObjectService().createPolicy(getRepositoryId(),
-        objectFactory.convertProperties(properties, CREATE_UPDATABILITY),
+        objectFactory.convertProperties(properties, null, CREATE_UPDATABILITY),
         (folderId == null ? null : folderId.getId()), objectFactory.convertPolicies(policies),
         objectFactory.convertAces(addAces), objectFactory.convertAces(removeAces), null);
 
@@ -830,13 +852,13 @@ public class PersistentSessionImpl imple
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.api.Session#createRelationship(java.util.List, java.util.List,
+   * @see org.apache.opencmis.client.api.Session#createRelationship(java.util.Map, java.util.List,
    * java.util.List, java.util.List)
    */
-  public ObjectId createRelationship(List<Property<?>> properties, List<Policy> policies,
+  public ObjectId createRelationship(Map<String, ?> properties, List<Policy> policies,
       List<Ace> addAces, List<Ace> removeAces) {
     String newId = getProvider().getObjectService().createRelationship(getRepositoryId(),
-        objectFactory.convertProperties(properties, CREATE_UPDATABILITY),
+        objectFactory.convertProperties(properties, null, CREATE_UPDATABILITY),
         objectFactory.convertPolicies(policies), objectFactory.convertAces(addAces),
         objectFactory.convertAces(removeAces), null);
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java Sun Mar 28 14:33:03 2010
@@ -23,7 +23,7 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Collections;
 import java.util.GregorianCalendar;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -75,6 +75,7 @@ import org.apache.opencmis.commons.api.P
 import org.apache.opencmis.commons.api.PropertyUriDefinition;
 import org.apache.opencmis.commons.api.RelationshipTypeDefinition;
 import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.enums.Cardinality;
 import org.apache.opencmis.commons.enums.Updatability;
 import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.opencmis.commons.provider.AccessControlEntry;
@@ -445,31 +446,54 @@ public class PersistentObjectFactoryImpl
   /*
    * (non-Javadoc)
    * 
-   * @see
-   * org.apache.opencmis.client.api.repository.ObjectFactory#convertProperties(java.util.Collection,
-   * java.util.Set)
+   * @see org.apache.opencmis.client.api.repository.ObjectFactory#convertProperties(java.util.Map,
+   * org.apache.opencmis.client.api.objecttype.ObjectType, java.util.Set)
    */
   @SuppressWarnings("unchecked")
-  public PropertiesData convertProperties(Collection<Property<?>> properties,
+  public PropertiesData convertProperties(Map<String, ?> properties, ObjectType type,
       Set<Updatability> updatabilityFilter) {
     // check input
     if (properties == null) {
       throw new IllegalArgumentException("Properties must be set!");
     }
 
-    ProviderObjectFactory pof = getProviderObjectFactory();
+    // get the type
+    if (type == null) {
+      Object typeId = properties.get(PropertyIds.CMIS_OBJECT_TYPE_ID);
+      if (!(typeId instanceof String)) {
+        throw new IllegalArgumentException("Type or type property must be set!");
+      }
 
-    // iterate through properties and convert them
+      type = session.getTypeDefinition(typeId.toString());
+    }
+
+    // some preparation
+    ProviderObjectFactory pof = getProviderObjectFactory();
     List<PropertyData<?>> propertyList = new ArrayList<PropertyData<?>>();
-    for (Property<?> property : properties) {
-      if (property == null) {
+
+    // the big loop
+    for (Map.Entry<String, ?> property : properties.entrySet()) {
+      if ((property == null) || (property.getKey() == null)) {
         continue;
       }
 
-      PropertyDefinition<?> definition = property.getDefinition();
+      String id = property.getKey();
+      Object value = property.getValue();
+
+      if (value instanceof Property<?>) {
+        Property<?> p = (Property<?>) value;
+        if (!id.equals(p.getId())) {
+          throw new IllegalArgumentException("Property id mismatch: '" + id + "' != '" + p.getId()
+              + "'!");
+        }
+        value = (p.getDefinition().getCardinality() == Cardinality.SINGLE ? p.getValue() : p
+            .getValues());
+      }
+
+      // get the property definition
+      PropertyDefinition<?> definition = type.getPropertyDefintions().get(id);
       if (definition == null) {
-        throw new IllegalArgumentException("Property +'" + property.getId()
-            + "' has no property defintion!");
+        throw new IllegalArgumentException("Property +'" + id + "' is not valid for this type!");
       }
 
       // check updatability
@@ -479,38 +503,151 @@ public class PersistentObjectFactoryImpl
         }
       }
 
+      // single and multi value check
+      List<?> values;
+      if (value == null) {
+        values = null;
+      }
+      else if (value instanceof List<?>) {
+        if (definition.getCardinality() != Cardinality.MULTI) {
+          throw new IllegalArgumentException("Property '" + id + "' is not a multi value property!");
+        }
+        values = (List<?>) value;
+
+        // check if the list is homogeneous and does not contain null values
+        Class<?> valueClazz = null;
+        for (Object o : values) {
+          if (o == null) {
+            throw new IllegalArgumentException("Property '" + id + "' contains null values!");
+          }
+          if (valueClazz == null) {
+            valueClazz = o.getClass();
+          }
+          else {
+            if (!valueClazz.isInstance(o)) {
+              throw new IllegalArgumentException("Property '" + id + "' is inhomogeneous!");
+            }
+          }
+        }
+      }
+      else {
+        if (definition.getCardinality() != Cardinality.SINGLE) {
+          throw new IllegalArgumentException("Property '" + id
+              + "' is not a single value property!");
+        }
+        values = Collections.singletonList(value);
+      }
+
+      // assemble property
+      PropertyData<?> propertyData = null;
+      Object firstValue = (values == null ? null : values.get(0));
+
       if (definition instanceof PropertyStringDefinition) {
-        propertyList.add(pof.createPropertyStringData(property.getId(), (List<String>) property
-            .getValues()));
+        if (firstValue == null) {
+          propertyData = pof.createPropertyStringData(id, (List<String>) null);
+        }
+        else if (firstValue instanceof String) {
+          propertyData = pof.createPropertyStringData(id, (List<String>) values);
+        }
+        else {
+          throw new IllegalArgumentException("Property '" + id + "' is a String property!");
+        }
       }
       else if (definition instanceof PropertyIdDefinition) {
-        propertyList.add(pof.createPropertyIdData(property.getId(), (List<String>) property
-            .getValues()));
+        if (firstValue == null) {
+          propertyData = pof.createPropertyIdData(id, (List<String>) null);
+        }
+        else if (firstValue instanceof String) {
+          propertyData = pof.createPropertyIdData(id, (List<String>) values);
+        }
+        else {
+          throw new IllegalArgumentException("Property '" + id + "' is an Id property!");
+        }
       }
       else if (definition instanceof PropertyHtmlDefinition) {
-        propertyList.add(pof.createPropertyHtmlData(property.getId(), (List<String>) property
-            .getValues()));
+        if (firstValue == null) {
+          propertyData = pof.createPropertyHtmlData(id, (List<String>) values);
+        }
+        else if (firstValue instanceof String) {
+          propertyData = pof.createPropertyHtmlData(id, (List<String>) values);
+        }
+        else {
+          throw new IllegalArgumentException("Property '" + id + "' is a HTML property!");
+        }
       }
       else if (definition instanceof PropertyUriDefinition) {
-        propertyList.add(pof.createPropertyUriData(property.getId(), (List<String>) property
-            .getValues()));
+        if (firstValue == null) {
+          propertyData = pof.createPropertyUriData(id, (List<String>) null);
+        }
+        else if (firstValue instanceof String) {
+          propertyData = pof.createPropertyUriData(id, (List<String>) values);
+        }
+        else {
+          throw new IllegalArgumentException("Property '" + id + "' is an URI property!");
+        }
       }
       else if (definition instanceof PropertyIntegerDefinition) {
-        propertyList.add(pof.createPropertyIntegerData(property.getId(),
-            (List<BigInteger>) property.getValues()));
+        if (firstValue == null) {
+          propertyData = pof.createPropertyIntegerData(id, (List<BigInteger>) null);
+        }
+        else if (firstValue instanceof BigInteger) {
+          propertyData = pof.createPropertyIntegerData(id, (List<BigInteger>) values);
+        }
+        else if ((firstValue instanceof Byte) || (firstValue instanceof Short)
+            || (firstValue instanceof Integer) || (firstValue instanceof Long)) {
+          // we accept all kinds of integers
+          List<BigInteger> list = new ArrayList<BigInteger>(values.size());
+          for (Object v : values) {
+            list.add(BigInteger.valueOf(((Number) v).longValue()));
+          }
+
+          propertyData = pof.createPropertyIntegerData(id, list);
+        }
+        else {
+          throw new IllegalArgumentException("Property '" + id + "' is an Integer property!");
+        }
       }
       else if (definition instanceof PropertyBooleanDefinition) {
-        propertyList.add(pof.createPropertyBooleanData(property.getId(), (List<Boolean>) property
-            .getValues()));
+        if (firstValue == null) {
+          propertyData = pof.createPropertyBooleanData(id, (List<Boolean>) null);
+        }
+        else if (firstValue instanceof Boolean) {
+          propertyData = pof.createPropertyBooleanData(id, (List<Boolean>) values);
+        }
+        else {
+          throw new IllegalArgumentException("Property '" + id + "' is a Boolean property!");
+        }
       }
       else if (definition instanceof PropertyDecimalDefinition) {
-        propertyList.add(pof.createPropertyDecimalData(property.getId(),
-            (List<BigDecimal>) property.getValues()));
+        if (firstValue == null) {
+          propertyData = pof.createPropertyDecimalData(id, (List<BigDecimal>) null);
+        }
+        else if (firstValue instanceof BigDecimal) {
+          propertyData = pof.createPropertyDecimalData(id, (List<BigDecimal>) values);
+        }
+        else {
+          throw new IllegalArgumentException("Property '" + id + "' is a Decimal property!");
+        }
       }
       else if (definition instanceof PropertyDateTimeDefinition) {
-        propertyList.add(pof.createPropertyDateTimeData(property.getId(),
-            (List<GregorianCalendar>) property.getValues()));
+        if (firstValue == null) {
+          propertyData = pof.createPropertyDateTimeData(id, (List<GregorianCalendar>) null);
+        }
+        else if (firstValue instanceof GregorianCalendar) {
+          propertyData = pof.createPropertyDateTimeData(id, (List<GregorianCalendar>) values);
+        }
+        else {
+          throw new IllegalArgumentException("Property '" + id + "' is a Decimal property!");
+        }
       }
+
+      // do we have something?
+      if (propertyData == null) {
+        throw new IllegalArgumentException("Property '" + id
+            + "' doesn't match the property defintion!");
+      }
+
+      propertyList.add(propertyData);
     }
 
     return pof.createPropertiesData(propertyList);

Modified: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-impl/src/main/java/org/apache/opencmis/commons/impl/dataobjects/AbstractPropertyData.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-impl/src/main/java/org/apache/opencmis/commons/impl/dataobjects/AbstractPropertyData.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-impl/src/main/java/org/apache/opencmis/commons/impl/dataobjects/AbstractPropertyData.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-impl/src/main/java/org/apache/opencmis/commons/impl/dataobjects/AbstractPropertyData.java Sun Mar 28 14:33:03 2010
@@ -19,6 +19,7 @@
 package org.apache.opencmis.commons.impl.dataobjects;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.opencmis.commons.provider.PropertyData;
@@ -101,12 +102,22 @@ public abstract class AbstractPropertyDa
   }
 
   public void setValues(List<T> values) {
-    fValues = values;
+    if (values == null) {
+      fValues = Collections.emptyList();
+    }
+    else {
+      fValues = values;
+    }
   }
 
   public void setValue(T value) {
-    fValues = new ArrayList<T>(1);
-    fValues.add(value);
+    if (value == null) {
+      fValues = Collections.emptyList();
+    }
+    else {
+      fValues = new ArrayList<T>(1);
+      fValues.add(value);
+    }
   }
 
   /*

Modified: incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-fit/src/test/java/org/apache/opencmis/fit/runtime/WriteObjectIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-fit/src/test/java/org/apache/opencmis/fit/runtime/WriteObjectIT.java?rev=928409&r1=928408&r2=928409&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-fit/src/test/java/org/apache/opencmis/fit/runtime/WriteObjectIT.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-test/opencmis-test-fit/src/test/java/org/apache/opencmis/fit/runtime/WriteObjectIT.java Sun Mar 28 14:33:03 2010
@@ -27,7 +27,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 
 import org.apache.opencmis.client.api.ContentStream;
@@ -35,6 +37,7 @@ import org.apache.opencmis.client.api.Do
 import org.apache.opencmis.client.api.ObjectId;
 import org.apache.opencmis.client.api.Property;
 import org.apache.opencmis.client.api.objecttype.ObjectType;
+import org.apache.opencmis.commons.PropertyIds;
 import org.apache.opencmis.commons.api.PropertyDefinition;
 import org.apache.opencmis.commons.enums.CmisProperties;
 import org.apache.opencmis.commons.enums.VersioningState;
@@ -50,6 +53,8 @@ public class WriteObjectIT extends Abstr
 		String folderName = UUID.randomUUID().toString();
 		String typeId = FixtureData.FOLDER_TYPE_ID.value();
 
+		
+		/*
 		ObjectType ot = this.session.getTypeDefinition(typeId);
 		Collection<PropertyDefinition<?>> pdefs = ot.getPropertyDefintions()
 				.values();
@@ -78,7 +83,12 @@ public class WriteObjectIT extends Abstr
 			}
 
 		}
+		*/
 
+		Map<String, Object> properties = new HashMap<String, Object>();
+		properties.put(PropertyIds.CMIS_NAME, folderName);
+		properties.put(PropertyIds.CMIS_OBJECT_TYPE_ID, typeId);
+		
 		ObjectId id = this.session.createFolder(properties, parentId, null,
 				null, null);
 		assertNotNull(id);
@@ -91,6 +101,7 @@ public class WriteObjectIT extends Abstr
 		String folderName = UUID.randomUUID().toString();
 		String typeId = FixtureData.DOCUMENT_TYPE_ID.value();
 
+		/*
 		ObjectType ot = this.session.getTypeDefinition(typeId);
 		Collection<PropertyDefinition<?>> pdefs = ot.getPropertyDefintions()
 				.values();
@@ -119,13 +130,18 @@ public class WriteObjectIT extends Abstr
 				 * custom property definition (note: document type should not
 				 * have further mandatory properties)
 				 */
-				this.log
+/*				this.log
 						.info(
 								"Custom property found but not supported in test case!",
 								e);
 			}
 		}
-
+*/
+		
+		Map<String, Object> properties = new HashMap<String, Object>();
+		properties.put(PropertyIds.CMIS_NAME, folderName);
+		properties.put(PropertyIds.CMIS_OBJECT_TYPE_ID, typeId);
+		
 		String filename = UUID.randomUUID().toString();
 		String mimetype = "text/html; charset=UTF-8";
 		String content1 = "Im Walde rauscht ein Wasserfall. Wenn's nicht mehr rauscht ist's Wasser all.";
@@ -164,6 +180,7 @@ public class WriteObjectIT extends Abstr
 
 			ObjectId parentFolder = session.createObjectId(Fixture
 					.getTestRootId());
+			/*
 			List<Property<?>> srcProperties = srcDocument.getProperties();
 			assertNotNull(srcProperties);
 			List<Property<?>> dstProperties = new ArrayList<Property<?>>();
@@ -179,9 +196,14 @@ public class WriteObjectIT extends Abstr
 					dstProperties.add(p);
 				}
 			}
-
+*/
+			String name = UUID.randomUUID().toString();
+			
+			Map<String, Object> properties = new HashMap<String, Object>();
+			properties.put(PropertyIds.CMIS_NAME, name);
+			
 			ObjectId dstDocumentId = this.session.createDocumentFromSource(
-					srcDocument, dstProperties, parentFolder,
+					srcDocument, properties, parentFolder,
 					VersioningState.NONE, null, null, null);
 			assertNotNull(dstDocumentId);
 			Document dstDocument = (Document) this.session



Mime
View raw message