Updating Objects

Updating Properties

CMIS 1.0 CMIS 1.1

The page about properties explains how Java and C# data types are map to CMIS data types.

OpenCMIS (Java)

CmisObject cmisObject = ...

Map<String, Object> properties = new HashMap<String, Object>();

properties.put("my:property", "new value"); // single-value property
properties.put("my:int.property", 42);
properties.put("my:date.property", new GregorianCalendar());
properties.put("my:bool.property", true);

List<String> shoppingList = new ArrayList<String>();
shoppingList.add("milk");
shoppingList.add("bread");
shoppingList.add("cheese");
properties.put("my:shopping.list", shoppingList); // multi-value property

cmisObject.updateProperties(properties);

PortCMIS (C#)

ICmisObject cmisObject = ...

IDictonary<string, object> properties = new Dictonary<string, object>();

properties.Add("my:property", "new value"); // single-value property
properties.Add("my:int.property", 42);
properties.Add("my:date.property", DateTime.Now);
properties.Add("my:bool.property", true);

IList<string> shoppingList = new List<string>();
shoppingList.Add("milk");
shoppingList.Add("bread");
shoppingList.Add("cheese");
properties.Add("my:shopping.list", shoppingList); // multi-value property

cmisObject.UpdateProperties(properties);

Renaming an Object

If you just want to change the cmis:name property, there is a shortcut.

OpenCMIS (Java)

CmisObject cmisObject = ....
cmisObject.rename("new name");

PortCMIS (C#)

ICmisObject cmisObject = ....
cmisObject.Rename("new name");

Bulk Update

CMIS 1.1

OpenCMIS (Java)

// collect all objects to be updated
List<CmisObject> objectList = new ArrayList<CmisObject>();
objectList.add(doc1);
objectList.add(doc2);
objectList.add(doc3);

// prepare properties
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("my:project", "123456");
properties.put("my:priority", 10);

List<BulkUpdateObjectIdAndChangeToken> updatedIds = session.bulkUpdateProperties(objectList, properties, null, null);

Updating Content

See Working with Content.