org.apache.chemistry.opencmis.commons.data.ExtensionsData Java Examples

The following examples show how to use org.apache.chemistry.opencmis.commons.data.ExtensionsData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LDCmisService.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
	log.debug("** getRepositoryInfo");

	validateSession();

	String latestChangeLogToken;
	if (cachedChangeLogToken != null) {
		latestChangeLogToken = cachedChangeLogToken;
	} else {
		latestChangeLogToken = getLatestChangeLogToken(repositoryId);
		cachedChangeLogToken = latestChangeLogToken;
	}

	for (LDRepository repo : repositories.values()) {
		if (repo.getId().equals(repositoryId)) {
			return repo.getRepositoryInfo(getCallContext(), latestChangeLogToken);
		}
	}

	throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!");
}
 
Example #2
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
        BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkId("Object Id", objectId);
    renditionFilter = getDefaultRenditionFilter(renditionFilter);
    maxItems = getMaxItems(maxItems);
    skipCount = getSkipCount(skipCount);

    try {
        return getWrappedService().getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount,
                extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #3
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
        Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
        String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkIds("Version Series Id", objectId, versionSeriesId);
    major = getDefaultFalse(major);
    includeAllowableActions = getDefaultFalse(includeAllowableActions);
    includeRelationships = getDefault(includeRelationships);
    renditionFilter = getDefaultRenditionFilter(renditionFilter);
    includePolicyIds = getDefaultFalse(includePolicyIds);
    includeAcl = getDefaultFalse(includeAcl);

    try {
        return getWrappedService().getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter,
                includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl,
                extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #4
Source File: PublicApiAlfrescoCmisService.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Overridden to capture content upload for publishing to analytics service.
 */
@Override
public String createDocument(String repositoryId, Properties properties, String folderId,
            ContentStream contentStream, VersioningState versioningState,
            List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension)
{
    String newId = super.createDocument(
                repositoryId,
                properties,
                folderId,
                contentStream,
                versioningState,
                policies,
                addAces,
                removeAces,
                extension);
    return newId;
}
 
Example #5
Source File: PublicApiAlfrescoCmisService.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension)
{
	Network network = null;
	
	try
	{
        checkRepositoryId(repositoryId);
        network = networksService.getNetwork(repositoryId);
	}
	catch(Exception e)
	{
		// ACE-2540: Avoid information leak. Same response if repository does not exist or if user is not a member
        throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!");
	}

    return getRepositoryInfo(network);
}
 
Example #6
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId, BigInteger depth,
        String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
        String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkId("Folder Id", folderId);
    depth = getDepth(depth);
    includeAllowableActions = getDefaultFalse(includeAllowableActions);
    includeRelationships = getDefault(includeRelationships);
    renditionFilter = getDefaultRenditionFilter(renditionFilter);
    includePathSegment = getDefaultFalse(includePathSegment);

    try {
        return getWrappedService().getFolderTree(repositoryId, folderId, depth, filter, includeAllowableActions,
                includeRelationships, renditionFilter, includePathSegment, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #7
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId, BigInteger depth,
        String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
        String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkId("Folder Id", folderId);
    depth = getDepth(depth);
    includeAllowableActions = getDefaultFalse(includeAllowableActions);
    includeRelationships = getDefault(includeRelationships);
    renditionFilter = getDefaultRenditionFilter(renditionFilter);
    includePathSegment = getDefaultFalse(includePathSegment);

    try {
        return getWrappedService().getDescendants(repositoryId, folderId, depth, filter, includeAllowableActions,
                includeRelationships, renditionFilter, includePathSegment, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #8
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
        BigInteger maxItems, BigInteger skipCount, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // what kind of object is it?
    CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");

    if (info.isVariant(CMISObjectVariant.ASSOC))
    {
        return Collections.emptyList();
    }
    else
    {
        return connector.getRenditions(info.getNodeRef(), renditionFilter, maxItems, skipCount);
    }
}
 
Example #9
Source File: PublicApiAlfrescoCmisService.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Overridden to capture content upload for publishing to analytics service.
 */
@Override
public void setContentStream(String repositoryId, Holder<String> objectId,
            Boolean overwriteFlag, Holder<String> changeToken, ContentStream contentStream,
            ExtensionsData extension)
{
    FileFilterMode.setClient(Client.cmis);
    try
    {
        super.setContentStream(repositoryId, objectId, overwriteFlag, changeToken, contentStream, extension);
    }
    finally
    {
        FileFilterMode.clearClient();
    }
}
 
Example #10
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
        Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
        Boolean includeRelativePathSegment, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkId("Object Id", objectId);
    includeAllowableActions = getDefaultFalse(includeAllowableActions);
    includeRelationships = getDefault(includeRelationships);
    renditionFilter = getDefaultRenditionFilter(renditionFilter);
    includeRelativePathSegment = getDefaultFalse(includeRelativePathSegment);

    try {
        return getWrappedService().getObjectParents(repositoryId, objectId, filter, includeAllowableActions,
                includeRelationships, renditionFilter, includeRelativePathSegment, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #11
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public ObjectList getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
        String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    includeProperties = getDefaultFalse(includeProperties);
    includePolicyIds = getDefaultFalse(includePolicyIds);
    includeAcl = getDefaultFalse(includeAcl);
    maxItems = getMaxItems(maxItems);

    try {
        return getWrappedService().getContentChanges(repositoryId, changeLogToken, includeProperties, filter,
                includePolicyIds, includeAcl, maxItems, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #12
Source File: AbstractCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
        Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
        String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
    return service
            .getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter,
                    includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl,
                    extension);
}
 
Example #13
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkId("Object Id", objectId);
    onlyBasicPermissions = getDefaultTrue(onlyBasicPermissions);

    try {
        return getWrappedService().getAcl(repositoryId, objectId, onlyBasicPermissions, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #14
Source File: LDCmisService.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties, String folderId,
		VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces,
		ExtensionsData extension) {
	validateSession();
	return getRepository().createDocumentFromSource(getCallContext(), sourceId, folderId);
}
 
Example #15
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
        BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    includePropertyDefinitions = getDefaultFalse(includePropertyDefinitions);
    maxItems = getTypesMaxItems(maxItems);
    skipCount = getSkipCount(skipCount);

    try {
        return getWrappedService().getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems,
                skipCount, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #16
Source File: LDCmisService.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions,
		IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
		Boolean includeAcl, ExtensionsData extension) {
	validateSession();
	return getRepository().getObjectByPath(getCallContext(), path, filter, includeAllowableActions,
			includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
}
 
Example #17
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public ObjectList getContentChanges(
        String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
        String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    return connector.getContentChanges(changeLogToken, maxItems);
}
 
Example #18
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // find the type
    TypeDefinitionWrapper tdw = connector.getOpenCMISDictionaryService().findType(typeId);
    if (tdw == null)
    {
        throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
    }

    // return type definition
    return tdw.getTypeDefinition(true);
}
 
Example #19
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
        Boolean includeAllowableActions, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkIds("Version Series Id", objectId, versionSeriesId);
    includeAllowableActions = getDefaultFalse(includeAllowableActions);

    try {
        return getWrappedService().getAllVersions(repositoryId, objectId, versionSeriesId, filter,
                includeAllowableActions, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #20
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
        Boolean major, String filter, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkIds("Version Series Id", objectId, versionSeriesId);
    major = getDefaultFalse(major);

    try {
        return getWrappedService().getPropertiesOfLatestVersion(repositoryId, objectId, versionSeriesId, major,
                filter, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #21
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
        ContentStream contentStream, String checkinComment, List<String> policies, Acl addAces, Acl removeAces,
        ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkHolderId("Object Id", objectId);
    major = getDefaultTrue(major);

    try {
        getWrappedService().checkIn(repositoryId, objectId, major, properties, contentStream, checkinComment,
                policies, addAces, removeAces, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #22
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get node ref
    CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");

    if (!info.isDocument())
    {
        throw new CmisInvalidArgumentException("Object is not a document!");
    }

    final NodeRef nodeRef = info.getNodeRef();

    // get the folder node ref
    final NodeRef folderNodeRef = getOrCreateFolderInfo(folderId, "Folder").getNodeRef();

    // check primary parent
    if (connector.getNodeService().getPrimaryParent(nodeRef).getParentRef().equals(folderNodeRef))
    {
        throw new CmisConstraintException(
                "Unfiling from primary parent folder is not supported! Use deleteObject() instead.");
    }

    connector.getNodeService().removeChild(folderNodeRef, nodeRef);
}
 
Example #23
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public String createFolder(String repositoryId, final Properties properties, String folderId,
        final List<String> policies, final Acl addAces, final Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get the parent folder node ref
    final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Folder");

    // get name and type
    final String name = connector.getNameProperty(properties, null);
    final String objectTypeId = connector.getObjectTypeIdProperty(properties);
    final TypeDefinitionWrapper type = connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_FOLDER);

    connector.checkChildObjectType(parentInfo, type.getTypeId());

    // run transaction
    FileInfo fileInfo = connector.getFileFolderService().create(
            parentInfo.getNodeRef(), name, type.getAlfrescoClass());
    NodeRef nodeRef = fileInfo.getNodeRef();

    connector.setProperties(nodeRef, type, properties, new String[] { PropertyIds.NAME, PropertyIds.OBJECT_TYPE_ID });
    connector.applyPolicies(nodeRef, type, policies);
    connector.applyACL(nodeRef, type, addAces, removeAces);
    
    connector.getActivityPoster().postFileFolderAdded(nodeRef);

    String objectId = connector.createObjectId(nodeRef);
    return objectId;
}
 
Example #24
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
        Acl addAces, Acl removeAces, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkProperties(properties);
    checkProperty(properties, PropertyIds.OBJECT_TYPE_ID, String.class);
    checkId("Folder Id", folderId);

    try {
        return getWrappedService().createFolder(repositoryId, properties, folderId, policies, addAces, removeAces,
                extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #25
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void checkOut(
        String repositoryId, final Holder<String> objectId, ExtensionsData extension,
        final Holder<Boolean> contentCopied)
{
    checkRepositoryId(repositoryId);

    CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");

    // Check for current version
    if (info.isVariant(CMISObjectVariant.CURRENT_VERSION))
    {
        // Good
    }
    else if (info.isVariant(CMISObjectVariant.VERSION))
    {
        throw new CmisInvalidArgumentException("Can't check out an old version of a document");
    }
    else {   
        throw new CmisInvalidArgumentException("Only documents can be checked out! Object was a " + info.getObjectVariant().toString());
    }

    // get object
    final NodeRef nodeRef = info.getNodeRef();

    if (!((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).isVersionable())
    {
        throw new CmisConstraintException("Document is not versionable!");
    }
    
    // check out
    NodeRef pwcNodeRef = connector.getCheckOutCheckInService().checkout(nodeRef);
    CMISNodeInfo pwcNodeInfo = createNodeInfo(pwcNodeRef);
    objectId.setValue(pwcNodeInfo.getObjectId());

    if (contentCopied != null)
    {
        contentCopied.setValue(connector.getFileFolderService().getReader(pwcNodeRef) != null);
    }
}
 
Example #26
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
        ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkHolderId("Object Id", objectId);
    checkId("Target Folder Id", targetFolderId);

    try {
        getWrappedService().moveObject(repositoryId, objectId, targetFolderId, sourceFolderId, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #27
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
        ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkHolderId("Object Id", objectId);

    try {
        getWrappedService().deleteContentStream(repositoryId, objectId, changeToken, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #28
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
        Holder<Boolean> contentCopied) {
    checkRepositoryId(repositoryId);
    checkHolderId("Object Id", objectId);

    try {
        getWrappedService().checkOut(repositoryId, objectId, extension, contentCopied);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #29
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public FailedToDeleteData deleteTree(
        String repositoryId, String folderId, Boolean allVersions,
        UnfileObject unfileObjects, final Boolean continueOnFailure, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    if (!allVersions)
    {
        throw new CmisInvalidArgumentException("Only allVersions=true supported!");
    }

    if (unfileObjects == UnfileObject.UNFILE)
    {
        throw new CmisInvalidArgumentException("Unfiling not supported!");
    }

    final NodeRef folderNodeRef = getOrCreateFolderInfo(folderId, "Folder").getNodeRef();
    final FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();

    try
    {
        connector.deleteNode(folderNodeRef, true);
    }
    catch (Exception e)
    {
        List<String> ids = new ArrayList<String>();
        ids.add(folderId);
        result.setIds(ids);
    }

    return result;
}
 
Example #30
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public ObjectData getObject(
        String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
        IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
        Boolean includeAcl, ExtensionsData extension)
{
	long start = System.currentTimeMillis();
	
    checkRepositoryId(repositoryId);

    // what kind of object is it?
    CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");

    // create a CMIS object
    ObjectData object = connector.createCMISObject(
            info, filter, includeAllowableActions, includeRelationships,
            renditionFilter, includePolicyIds, includeAcl);

	boolean isObjectInfoRequired = getContext().isObjectInfoRequired();
    if (isObjectInfoRequired)
    {
        getObjectInfo(repositoryId, info.getObjectId(), includeRelationships);
    }

    logGetObjectCall("getObject", start, objectId, filter, includeAllowableActions, includeRelationships,
            renditionFilter, includePolicyIds, includeAcl, isObjectInfoRequired, extension);

    return object;
}