if (object.getSecondaryTypes() != null) { for (SecondaryType secondaryType : object.getSecondaryTypes()) { secondaryTypes.put(secondaryType.getId(), secondaryType);
if (object.getSecondaryTypes() != null) { for (SecondaryType secondaryType : object.getSecondaryTypes()) { secondaryTypes.put(secondaryType.getId(), secondaryType);
@Override public ObjectId createDocumentFromSource(ObjectId source, Map<String, ?> properties, ObjectId folderId, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) { if (source == null || source.getId() == null) { throw new IllegalArgumentException("Source must be set!"); } // get the type of the source document ObjectType type = null; List<SecondaryType> secondaryTypes = null; if (source instanceof CmisObject) { type = ((CmisObject) source).getType(); secondaryTypes = ((CmisObject) source).getSecondaryTypes(); } else { CmisObject sourceObj = getObject(source); type = sourceObj.getType(); secondaryTypes = sourceObj.getSecondaryTypes(); } if (type.getBaseTypeId() != BaseTypeId.CMIS_DOCUMENT) { throw new IllegalArgumentException("Source object must be a document!"); } String newId = getBinding().getObjectService().createDocumentFromSource(getRepositoryId(), source.getId(), objectFactory.convertProperties(properties, type, secondaryTypes, CREATE_AND_CHECKOUT_UPDATABILITY), (folderId == null ? null : folderId.getId()), versioningState, objectFactory.convertPolicies(policies), objectFactory.convertAces(addAces), objectFactory.convertAces(removeAces), null); if (newId == null) { return null; } return createObjectId(newId); }
@Override public ObjectId createDocumentFromSource(ObjectId source, Map<String, ?> properties, ObjectId folderId, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) { if (source == null || source.getId() == null) { throw new IllegalArgumentException("Source must be set!"); } // get the type of the source document ObjectType type = null; List<SecondaryType> secondaryTypes = null; if (source instanceof CmisObject) { type = ((CmisObject) source).getType(); secondaryTypes = ((CmisObject) source).getSecondaryTypes(); } else { CmisObject sourceObj = getObject(source); type = sourceObj.getType(); secondaryTypes = sourceObj.getSecondaryTypes(); } if (type.getBaseTypeId() != BaseTypeId.CMIS_DOCUMENT) { throw new IllegalArgumentException("Source object must be a document!"); } String newId = getBinding().getObjectService().createDocumentFromSource(getRepositoryId(), source.getId(), objectFactory.convertProperties(properties, type, secondaryTypes, CREATE_AND_CHECKOUT_UPDATABILITY), (folderId == null ? null : folderId.getId()), versioningState, objectFactory.convertPolicies(policies), objectFactory.convertAces(addAces), objectFactory.convertAces(removeAces), null); if (newId == null) { return null; } return createObjectId(newId); }