문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top