Domanda

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top