문제

In OpenCMIS (or DotCMIS), how to tell whether a CmisObject represents a file or a folder?

Specification: http://chemistry.apache.org/java/0.5.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/CmisObject.html

도움이 되었습니까?

해결책

This works:

if (cmisObject instanceof Folder) { ... }
if (cmisObject instanceof Document) { ... }

And this works:

if (cmisObject.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) { ... }
if (cmisObject.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) { ... }

다른 팁

Here is the way I have found (C# syntax):

cmisObject is DotCMIS.Client.Impl.Folder

Any better idea is welcome!

Florian Müller's answer adapted and tested for DotCMIS:

if (cmisObject is IFolder) { ... }
if (cmisObject is IDocument) { ... }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top