0

I know how to read the properties of a CMIS Document.

But how to tell which property is modifiable, which property is read-only?
Using OpenCMIS/DotCMIS.

For instance, CMIS Workbench seems to know, because in its Property Editor, it only lists the field cmis:name, and not the other fields (like cmis:id).

enter image description here

Gagravarr
  • 47,320
  • 10
  • 111
  • 156
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373

1 Answers1

3

The PropertyDefinition object gives the updatability of a property. With OpenCMIS, you can retrieve "cmis:name" updatability like this :

TypeDefinition typeDef = session.getTypeDefinition("cmis:document");
Map<String,PropertyDefinition<?>> propertyDefs = typeDef.getPropertyDefinitions();
PropertyDefinition namePropertyDef = propertyDefs.get("cmis:name");
Updatability nameUpdatability = namePropertyDef.getUpdatability();

if (Updatability.READONLY.equals(nameUpdatability)
    throw new Exception("This field can not be upated");

You can have a look on OpenCMIS javadoc for details about updatability values

Julien Boulay
  • 1,164
  • 7
  • 15