Java Code Examples for org.apache.chemistry.opencmis.commons.impl.dataobjects.AclCapabilitiesDataImpl#setSupportedPermissions()

The following examples show how to use org.apache.chemistry.opencmis.commons.impl.dataobjects.AclCapabilitiesDataImpl#setSupportedPermissions() . 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: CMISConnector.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Creates the repository info object.
 */
private RepositoryInfo createRepositoryInfo(CmisVersion cmisVersion)
{
    Descriptor currentDescriptor = descriptorService.getCurrentRepositoryDescriptor();

    // get change token
    boolean auditEnabled = auditService.isAuditEnabled(CMIS_CHANGELOG_AUDIT_APPLICATION, "/"
            + CMIS_CHANGELOG_AUDIT_APPLICATION);
    String latestChangeLogToken = null;

    if (auditEnabled)
    {
        EntryIdCallback auditQueryCallback = new EntryIdCallback(false);
        AuditQueryParameters params = new AuditQueryParameters();
        params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
        params.setForward(false);
        auditService.auditQuery(auditQueryCallback, params, 1);
        String entryId = auditQueryCallback.getEntryId();
        // MNT-13529
        // add initial change log token
        latestChangeLogToken = entryId == null ? "0" : entryId;
    }

    // compile repository info
    RepositoryInfoImpl ri = new RepositoryInfoImpl();

    ri.setId(currentDescriptor.getId());
    ri.setName(currentDescriptor.getName());
    ri.setDescription(currentDescriptor.getName());
    ri.setVendorName("Alfresco");
    ri.setProductName("Alfresco " + descriptorService.getServerDescriptor().getEdition());
    ri.setProductVersion(currentDescriptor.getVersion());
    NodeRef rootNodeRef = getRootNodeRef();
    ri.setRootFolder(constructObjectId(rootNodeRef, null));
    ri.setCmisVersion(cmisVersion);

    ri.setChangesIncomplete(true);
    ri.setChangesOnType(Arrays.asList(new BaseTypeId[] { BaseTypeId.CMIS_DOCUMENT, BaseTypeId.CMIS_FOLDER }));
    ri.setLatestChangeLogToken(latestChangeLogToken);
    ri.setPrincipalAnonymous(AuthenticationUtil.getGuestUserName());
    ri.setPrincipalAnyone(PermissionService.ALL_AUTHORITIES);

    RepositoryCapabilitiesImpl repCap = new RepositoryCapabilitiesImpl();
    ri.setCapabilities(repCap);

    repCap.setAllVersionsSearchable(false);
    repCap.setCapabilityAcl(CapabilityAcl.MANAGE);
    repCap.setCapabilityChanges(auditEnabled ? CapabilityChanges.OBJECTIDSONLY : CapabilityChanges.NONE);
    repCap.setCapabilityContentStreamUpdates(CapabilityContentStreamUpdates.ANYTIME);
    repCap.setCapabilityJoin(CapabilityJoin.NONE);
    repCap.setCapabilityQuery(CapabilityQuery.BOTHCOMBINED);
    repCap.setCapabilityRendition(CapabilityRenditions.READ);
    repCap.setIsPwcSearchable(false);
    repCap.setIsPwcUpdatable(true);
    repCap.setSupportsGetDescendants(true);
    repCap.setSupportsGetFolderTree(true);
    repCap.setSupportsMultifiling(true);
    repCap.setSupportsUnfiling(false);
    repCap.setSupportsVersionSpecificFiling(false);

    AclCapabilitiesDataImpl aclCap = new AclCapabilitiesDataImpl();
    ri.setAclCapabilities(aclCap);

    aclCap.setAclPropagation(AclPropagation.PROPAGATE);
    aclCap.setSupportedPermissions(SupportedPermissions.BOTH);
    aclCap.setPermissionDefinitionData(repositoryPermissions);
    aclCap.setPermissionMappingData(permissionMappings);

    return ri;
}
 
Example 2
Source File: CmisUtils.java    From iaf with Apache License 2.0 3 votes vote down vote up
private static AclCapabilities xml2aclCapabilities(Element cmisResult) {
	AclCapabilitiesDataImpl aclCapabilities = new AclCapabilitiesDataImpl();
	
	Element aclCapabilitiesXml = XmlUtils.getFirstChildTag(cmisResult, "aclCapabilities");

	aclCapabilities.setAclPropagation(AclPropagation.valueOf(aclCapabilitiesXml.getAttribute("aclPropagation")));
	aclCapabilities.setSupportedPermissions(SupportedPermissions.valueOf(aclCapabilitiesXml.getAttribute("supportedPermissions")));

	aclCapabilities.setPermissionMappingData(CmisUtils.xml2permissionMapping(aclCapabilitiesXml));
	aclCapabilities.setPermissionDefinitionData(CmisUtils.xml2permissionDefinitionList(aclCapabilitiesXml));

	return aclCapabilities;
}