@Override public CmisObject convertObject(ObjectData objectData, OperationContext context) { if (objectData == null) { throw new IllegalArgumentException("Object data is null!"); } if (objectData.getId() == null) { throw new IllegalArgumentException("Object ID property not set!"); } if (objectData.getBaseTypeId() == null) { throw new IllegalArgumentException("Base type ID property not set!"); } ObjectType type = getTypeFromObjectData(objectData); /* determine type */ switch (objectData.getBaseTypeId()) { case CMIS_DOCUMENT: return new DocumentImpl((SessionImpl) session, type, objectData, context); case CMIS_FOLDER: return new FolderImpl((SessionImpl) session, type, objectData, context); case CMIS_POLICY: return new PolicyImpl((SessionImpl) session, type, objectData, context); case CMIS_RELATIONSHIP: return new RelationshipImpl((SessionImpl) session, type, objectData, context); case CMIS_ITEM: return new ItemImpl((SessionImpl) session, type, objectData, context); case CMIS_SECONDARY: throw new CmisRuntimeException("Secondary type is used as object type: " + objectData.getBaseTypeId()); default: throw new CmisRuntimeException("Unsupported base type: " + objectData.getBaseTypeId()); } }
private String getTestId(BaseTypeId baseTypeId) { LOG.debug("getTestDocId()"); ObjectInFolderList result = navSvc.getChildren(repositoryId, rootFolderId, "*", null, false, IncludeRelationships.NONE, null, true, MAX_ITEMS, SKIP_COUNT, null); List<ObjectInFolderData> children = result.getObjects(); LOG.debug(" found " + children.size() + " folders in getChildren()"); for (ObjectInFolderData child : children) { if (baseTypeId.equals(child.getObject().getBaseTypeId())) { return child.getObject().getId(); } } return null; }
@Override public CmisObject convertObject(ObjectData objectData, OperationContext context) { if (objectData == null) { throw new IllegalArgumentException("Object data is null!"); } if (objectData.getId() == null) { throw new IllegalArgumentException("Object ID property not set!"); } if (objectData.getBaseTypeId() == null) { throw new IllegalArgumentException("Base type ID property not set!"); } ObjectType type = getTypeFromObjectData(objectData); /* determine type */ switch (objectData.getBaseTypeId()) { case CMIS_DOCUMENT: return new DocumentImpl((SessionImpl) session, type, objectData, context); case CMIS_FOLDER: return new FolderImpl((SessionImpl) session, type, objectData, context); case CMIS_POLICY: return new PolicyImpl((SessionImpl) session, type, objectData, context); case CMIS_RELATIONSHIP: return new RelationshipImpl((SessionImpl) session, type, objectData, context); case CMIS_ITEM: return new ItemImpl((SessionImpl) session, type, objectData, context); case CMIS_SECONDARY: throw new CmisRuntimeException("Secondary type is used as object type: " + objectData.getBaseTypeId()); default: throw new CmisRuntimeException("Unsupported base type: " + objectData.getBaseTypeId()); } }
public CmisObject convertObject(ObjectData objectData, OperationContext context) { if (objectData == null) { throw new IllegalArgumentException("Object data is null!"); } ObjectType type = getTypeFromObjectData(objectData); /* determine type */ switch (objectData.getBaseTypeId()) { case CMIS_DOCUMENT: return new AlfrescoDocumentImpl((SessionImpl) this.session, type, objectData, context); case CMIS_FOLDER: return new AlfrescoFolderImpl((SessionImpl) this.session, type, objectData, context); case CMIS_POLICY: return new PolicyImpl((SessionImpl) this.session, type, objectData, context); case CMIS_RELATIONSHIP: return new RelationshipImpl((SessionImpl) this.session, type, objectData, context); default: throw new CmisRuntimeException("unsupported type: " + objectData.getBaseTypeId()); } } }
ObjectData child = children.get(i).getObject(); docId = (String) child.getProperties().getProperties().get(PropertyIds.OBJECT_ID).getFirstValue(); if (child.getBaseTypeId().equals(BaseTypeId.CMIS_DOCUMENT)) { if (numDocsFound == index) { return docId;
private void dumpFolder(String folderId, String propertyFilter, int depth) { boolean allRequiredPropertiesArePresent = propertyFilter.equals("*"); // can // be // optimized StringBuilder prefix = new StringBuilder(); for (int i = 0; i < depth; i++) { prefix.append(" "); } ObjectInFolderList result = fNavSvc.getChildren(fRepositoryId, folderId, propertyFilter, null, false, IncludeRelationships.NONE, null, true, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null); List<ObjectInFolderData> folders = result.getObjects(); if (null != folders) { LOG.debug(prefix + "found " + folders.size() + " children in folder " + folderId); int no = 0; for (ObjectInFolderData folder : folders) { LOG.debug(prefix.toString() + ++no + ": found object with id: " + folder.getObject().getId() + " and path segment: " + folder.getPathSegment()); dumpObjectProperties(folder.getObject(), depth, propertyFilter, !allRequiredPropertiesArePresent); String objectTypeBaseId = folder.getObject().getBaseTypeId().value(); if (objectTypeBaseId.equals(BaseTypeId.CMIS_FOLDER.value())) { dumpFolder(folder.getObject().getId(), propertyFilter, depth + 1); } else if (objectTypeBaseId.equals(BaseTypeId.CMIS_DOCUMENT.value())) { dumpObjectProperties(folder.getObject(), depth + 1, propertyFilter, !allRequiredPropertiesArePresent); } } } LOG.debug(""); // add empty line }
if (startFolderData.getBaseTypeId() != BaseTypeId.CMIS_FOLDER) { throw new IllegalArgumentException("Start folder is not a folder!"); nextPath.toString(), "cmis:objectId,cmis:baseTypeId,cmis:name", false, IncludeRelationships.NONE, "cmis:none", false, false, null); if (folderData.getBaseTypeId() != BaseTypeId.CMIS_FOLDER) { throw new CmisConstraintException("Cannot create a folder '" + segements[i] + "' because there is already an object with this name, which is not a folder!");
if (startFolderData.getBaseTypeId() != BaseTypeId.CMIS_FOLDER) { throw new IllegalArgumentException("Start folder is not a folder!"); nextPath.toString(), "cmis:objectId,cmis:baseTypeId,cmis:name", false, IncludeRelationships.NONE, "cmis:none", false, false, null); if (folderData.getBaseTypeId() != BaseTypeId.CMIS_FOLDER) { throw new CmisConstraintException("Cannot create a folder '" + segements[i] + "' because there is already an object with this name, which is not a folder!");
if (source.getBaseTypeId() == BaseTypeId.CMIS_ITEM) { LOG.warn("Receiver only understands CMIS 1.0. It may not be able to handle an Item object.");
info.setLastModificationDate(getDateTimeProperty(object, PropertyIds.LAST_MODIFICATION_DATE)); info.setTypeId(getIdProperty(object, PropertyIds.OBJECT_TYPE_ID)); info.setBaseType(object.getBaseTypeId()); info.setIsCurrentVersion(object.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT); info.setWorkingCopyId(null); info.setWorkingCopyOriginalId(null); if (object.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) { info.setHasParent(false); } else if (object.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) { info.setHasParent(!object.getId().equals(repositoryInfo.getRootFolderId())); } else { info.setHasAcl(capabilities.getAclCapability() == CapabilityAcl.DISCOVER || capabilities.getAclCapability() == CapabilityAcl.MANAGE); if (object.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) { info.setSupportsDescendants(Boolean.TRUE.equals(capabilities.isGetDescendantsSupported())); info.setSupportsFolderTree(Boolean.TRUE.equals(capabilities.isGetFolderTreeSupported()));
info.setLastModificationDate(getDateTimeProperty(object, PropertyIds.LAST_MODIFICATION_DATE)); info.setTypeId(getIdProperty(object, PropertyIds.OBJECT_TYPE_ID)); info.setBaseType(object.getBaseTypeId()); info.setIsCurrentVersion(object.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT); info.setWorkingCopyId(null); info.setWorkingCopyOriginalId(null); if (object.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) { info.setHasParent(false); } else if (object.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) { info.setHasParent(!object.getId().equals(repositoryInfo.getRootFolderId())); } else { info.setHasAcl(capabilities.getAclCapability() == CapabilityAcl.DISCOVER || capabilities.getAclCapability() == CapabilityAcl.MANAGE); if (object.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) { info.setSupportsDescendants(Boolean.TRUE.equals(capabilities.isGetDescendantsSupported())); info.setSupportsFolderTree(Boolean.TRUE.equals(capabilities.isGetFolderTreeSupported()));
if (source.getBaseTypeId() == BaseTypeId.CMIS_ITEM) { LOG.warn("Receiver only understands CMIS 1.0. It may not be able to handle an Item object.");
info.setLastModificationDate(getDateTimeProperty(object, PropertyIds.LAST_MODIFICATION_DATE)); info.setTypeId(getIdProperty(object, PropertyIds.OBJECT_TYPE_ID)); info.setBaseType(object.getBaseTypeId());
info.setLastModificationDate(getDateTimeProperty(object, PropertyIds.LAST_MODIFICATION_DATE)); info.setTypeId(getIdProperty(object, PropertyIds.OBJECT_TYPE_ID)); info.setBaseType(object.getBaseTypeId());