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

The following examples show how to use org.apache.chemistry.opencmis.commons.data.Acl. 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: IbisObjectService.java    From iaf with Apache License 2.0 6 votes vote down vote up
@Override
public String createItem(String repositoryId, Properties properties,
		String folderId, List<String> policies, Acl addAces,
		Acl removeAces, ExtensionsData extension) {

	if(!eventDispatcher.contains(CmisEvent.CREATE_ITEM)) {
		return objectService.createItem(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
	}
	else {
		XmlBuilder cmisXml = new XmlBuilder("cmis");
		cmisXml.addSubElement(buildXml("repositoryId", repositoryId));
		cmisXml.addSubElement(buildXml("folderId", folderId));
		cmisXml.addSubElement(buildXml("policies", policies));

		XmlBuilder propertiesXml = new XmlBuilder("properties");
		for (Iterator<PropertyData<?>> it = properties.getPropertyList().iterator(); it.hasNext();) {
			propertiesXml.addSubElement(CmisUtils.getPropertyXml(it.next()));
		}
		cmisXml.addSubElement(propertiesXml);

		Element result = eventDispatcher.trigger(CmisEvent.CREATE_ITEM, cmisXml.toXML(), callContext);
		return XmlUtils.getChildTagAsString(result, "id");
	}
}
 
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 String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces,
        Acl removeAces, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkProperties(properties);
    checkProperty(properties, PropertyIds.OBJECT_TYPE_ID, String.class);
    // checkProperty(properties, PropertyIds.SOURCE_ID, String.class);
    // checkProperty(properties, PropertyIds.TARGET_ID, String.class);

    try {
        return getWrappedService().createRelationship(repositoryId, properties, policies, addAces, removeAces,
                extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #3
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public String createPolicy(
        String repositoryId, Properties properties, String folderId, List<String> policies,
        Acl addAces, Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get the parent folder
    getOrCreateFolderInfo(folderId, "Parent Folder");

    String objectTypeId = connector.getObjectTypeIdProperty(properties);
    connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_POLICY);

    // we should never get here - policies are not creatable!
    throw new CmisRuntimeException("Polcies cannot be created!");
}
 
Example #4
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public Acl applyAcl(
        String repositoryId, String objectId, final Acl addAces, final Acl removeAces,
        AclPropagation aclPropagation, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // We are spec compliant if we just let it through and the tck will not fail

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

    // relationships don't have ACLs
    if (info.isVariant(CMISObjectVariant.ASSOC))
    {
        throw new CmisConstraintException("Relationships are not ACL controllable!");
    }

    final NodeRef nodeRef = info.getCurrentNodeNodeRef();
    final TypeDefinitionWrapper type = info.getType();

    connector.applyACL(nodeRef, type, addAces, removeAces);

    return connector.getACL(nodeRef, false);
}
 
Example #5
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public Acl applyAcl(String repositoryId, String objectId, final Acl aces, AclPropagation aclPropagation)
{
    checkRepositoryId(repositoryId);

    // We are spec compliant if we just let it through and the tck will not fail

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

    // relationships don't have ACLs
    if (info.isVariant(CMISObjectVariant.ASSOC))
    {
        throw new CmisConstraintException("Relationships are not ACL controllable!");
    }

    final NodeRef nodeRef = info.getCurrentNodeNodeRef();
    final TypeDefinitionWrapper type = info.getType();

    connector.applyACL(nodeRef, type, aces);

    return connector.getACL(nodeRef, false);
}
 
Example #6
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

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

    // relationships don't have ACLs
    if (info.isVariant(CMISObjectVariant.ASSOC))
    {
        return new AccessControlListImpl(Collections.EMPTY_LIST);
    }

    // get the ACL
    return connector.getACL(info.getCurrentNodeNodeRef(), onlyBasicPermissions);
}
 
Example #7
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 #8
Source File: ContentCmisService.java    From spring-content with Apache License 2.0 6 votes vote down vote up
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) {

	bridge.checkIn(config,
			objectId.getValue(),
			major,
			properties,
			contentStream,
			checkinComment,
			policies,
			addAces,
			removeAces,
			extension);
}
 
Example #9
Source File: ContentCmisService.java    From spring-content with Apache License 2.0 6 votes vote down vote up
public String createDocument(String repositoryId,
		Properties properties,
		String folderId,
		ContentStream contentStream,
		VersioningState versioningState,
		List<String> policies,
		Acl addAces,
		Acl removeAces,
		ExtensionsData extension) {

	return bridge.createDocument(config,
			properties,
			folderId,
			contentStream,
			versioningState,
			policies,
			addAces,
			removeAces,
			extension);
}
 
Example #10
Source File: ContentCmisService.java    From spring-content with Apache License 2.0 6 votes vote down vote up
public String createFolder(String repositoryId,
		Properties properties,
		String folderId,
		List<String> policies,
		Acl addAces,
		Acl removeAces,
		ExtensionsData extension) {

	return bridge.createFolder(config,
			properties,
			folderId,
			policies,
			addAces,
			removeAces,
			extension);
}
 
Example #11
Source File: IbisObjectService.java    From iaf with Apache License 2.0 6 votes vote down vote up
@Override
public String createFolder(String repositoryId, Properties properties,
		String folderId, List<String> policies, Acl addAces,
		Acl removeAces, ExtensionsData extension) {

	if(!eventDispatcher.contains(CmisEvent.CREATE_FOLDER)) {
		return objectService.createFolder(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
	}
	else {
		XmlBuilder cmisXml = new XmlBuilder("cmis");
		cmisXml.addSubElement(buildXml("repositoryId", repositoryId));
		cmisXml.addSubElement(buildXml("folderId", folderId));
		cmisXml.addSubElement(buildXml("policies", policies));

		XmlBuilder propertiesXml = new XmlBuilder("properties");
		for (Iterator<PropertyData<?>> it = properties.getPropertyList().iterator(); it.hasNext();) {
			propertiesXml.addSubElement(CmisUtils.getPropertyXml(it.next()));
		}
		cmisXml.addSubElement(propertiesXml);

		Element result = eventDispatcher.trigger(CmisEvent.CREATE_FOLDER, cmisXml.toXML(), callContext);
		return XmlUtils.getChildTagAsString(result, "id");
	}
}
 
Example #12
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public String createItem(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);

    try {
        return getWrappedService().createItem(repositoryId, properties, folderId, policies, addAces, removeAces,
                extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
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 String createPolicy(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);

    try {
        return getWrappedService().createPolicy(repositoryId, properties, folderId, policies, addAces, removeAces,
                extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #14
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 #15
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository 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) {
    checkRepositoryId(repositoryId);
    checkId("Source Id", sourceId);

    try {
        return getWrappedService().createDocumentFromSource(repositoryId, sourceId, properties, folderId,
                versioningState, policies, addAces, removeAces, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #16
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public String createDocument(String repositoryId, Properties properties, String folderId,
        ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
        Acl removeAces, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkProperties(properties);
    checkProperty(properties, PropertyIds.OBJECT_TYPE_ID, String.class);

    try {
        return getWrappedService().createDocument(repositoryId, properties, folderId, contentStream,
                versioningState, policies, addAces, removeAces, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #17
Source File: AbstractCmisServiceWrapper.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) {
    service.checkIn(repositoryId, objectId, major, properties, contentStream, checkinComment, policies, addAces,
            removeAces, extension);
}
 
Example #18
Source File: Converter.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Converts an ACL object with its ACEs
 * 
 * @param acl the acl
 * 
 * @return the CMIS ACL
 */
public static CmisAccessControlListType convert(Acl acl) {
	if (acl == null) {
		return null;
	}

	CmisAccessControlListType result = new CmisAccessControlListType();

	if (acl.getAces() != null) {
		for (Ace ace : acl.getAces()) {
			if (ace == null) {
				continue;
			}

			CmisAccessControlEntryType entry = new CmisAccessControlEntryType();

			if (ace.getPrincipal() != null) {
				CmisAccessControlPrincipalType pincipal = new CmisAccessControlPrincipalType();

				pincipal.setPrincipalId(ace.getPrincipal().getId());
				convertExtension(pincipal, ace.getPrincipal());

				entry.setPrincipal(pincipal);
			}

			entry.setDirect(ace.isDirect());
			entry.getPermission().addAll(ace.getPermissions());

			convertExtension(ace, entry);

			result.getPermission().add(entry);
		}
	}

	// handle extensions
	convertExtension(acl, result);

	return result;
}
 
Example #19
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 createDocument(String repositoryId, Properties properties, String folderId,
		ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
		Acl removeAces, ExtensionsData extension) {
	validateSession();
	return getRepository().createDocument(getCallContext(), properties, folderId, contentStream, versioningState);
}
 
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 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 #21
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Acl applyAcl(String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) {
    checkRepositoryId(repositoryId);
    checkId("Object Id", objectId);
    aclPropagation = getDefault(aclPropagation);

    try {
        return getWrappedService().applyAcl(repositoryId, objectId, aces, aclPropagation);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #22
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces,
        AclPropagation aclPropagation, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkId("Object Id", objectId);
    aclPropagation = getDefault(aclPropagation);

    try {
        return getWrappedService().applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #23
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 #24
Source File: FilterCmisService.java    From iaf with Apache License 2.0 5 votes vote down vote up
@Override
public String createDocument(String repositoryId, Properties properties, String folderId,
		ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
		Acl removeAces, ExtensionsData extension) {
	return getObjectService().createDocument(repositoryId, properties, folderId, contentStream, versioningState,
			policies, addAces, removeAces, extension);
}
 
Example #25
Source File: FilterCmisService.java    From iaf with Apache License 2.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) {
	return getObjectService().createDocumentFromSource(repositoryId, sourceId, properties, folderId,
			versioningState, policies, addAces, removeAces, extension);
}
 
Example #26
Source File: FilterCmisService.java    From iaf with Apache License 2.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) {
	getVersioningService().checkIn(repositoryId, objectId, major, properties, contentStream, checkinComment,
			policies, addAces, removeAces, extension);
}
 
Example #27
Source File: IbisObjectService.java    From iaf with Apache License 2.0 5 votes vote down vote up
@Override
public String createDocument(String repositoryId, Properties properties,
		String folderId, ContentStream contentStream,
		VersioningState versioningState, List<String> policies,
		Acl addAces, Acl removeAces, ExtensionsData extension) {

	if(!eventDispatcher.contains(CmisEvent.CREATE_DOCUMENT)) {
		return objectService.createDocument(repositoryId, properties, folderId, contentStream, versioningState, policies, addAces, removeAces, extension);
	}
	else {
		XmlBuilder cmisXml = new XmlBuilder("cmis");
		cmisXml.addSubElement(buildXml("repositoryId", repositoryId));
		cmisXml.addSubElement(buildXml("folderId", folderId));
		cmisXml.addSubElement(buildXml("versioningState", versioningState));

		XmlBuilder contentStreamXml = new XmlBuilder("contentStream");
		contentStreamXml.addAttribute("filename", contentStream.getFileName());
		contentStreamXml.addAttribute("length", contentStream.getLength());
		contentStreamXml.addAttribute("mimeType", contentStream.getMimeType());
		cmisXml.addSubElement(contentStreamXml);

		XmlBuilder propertiesXml = new XmlBuilder("properties");
		for (Iterator<PropertyData<?>> it = properties.getPropertyList().iterator(); it.hasNext();) {
			propertiesXml.addSubElement(CmisUtils.getPropertyXml(it.next()));
		}
		cmisXml.addSubElement(propertiesXml);

		IPipeLineSession context = new PipeLineSessionBase();
		context.put("ContentStream", contentStream.getStream());
		context.put(CmisUtils.CMIS_CALLCONTEXT_KEY, callContext);
		Element result = eventDispatcher.trigger(CmisEvent.CREATE_DOCUMENT, cmisXml.toXML(), context);
		return XmlUtils.getChildTagAsString(result, "id");
	}
}
 
Example #28
Source File: IbisObjectService.java    From iaf with Apache License 2.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) {
	// TODO Auto-generated method stub
	return objectService.createDocumentFromSource(repositoryId, sourceId, properties, folderId, versioningState, policies, addAces, removeAces, extension);
}
 
Example #29
Source File: IbisObjectService.java    From iaf with Apache License 2.0 5 votes vote down vote up
@Override
public String createRelationship(String repositoryId,
		Properties properties, List<String> policies, Acl addAces,
		Acl removeAces, ExtensionsData extension) {
	// TODO Auto-generated method stub
	return objectService.createRelationship(repositoryId, properties, policies, addAces, removeAces, extension);
}
 
Example #30
Source File: IbisObjectService.java    From iaf with Apache License 2.0 5 votes vote down vote up
@Override
public String createPolicy(String repositoryId, Properties properties,
		String folderId, List<String> policies, Acl addAces,
		Acl removeAces, ExtensionsData extension) {
	// TODO Auto-generated method stub
	return objectService.createPolicy(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
}