org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl Java Examples

The following examples show how to use org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl. 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: LDRepository.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Adds LogicalDOC specific extensions. Here we put the current SID.
 * 
 * @param repoInfo The repository info to process
 */
private void setupExtensions(RepositoryInfoImpl repoInfo) {

	// Important: use this namespace for the extensions that must be
	// different from the CMIS
	// namespaces
	String ns = "http://www.logicaldoc.com";

	// create a list for the first level of our extension
	List<CmisExtensionElement> extElements = new ArrayList<CmisExtensionElement>();

	// add two leafs to the extension
	extElements.add(new CmisExtensionElementImpl(ns, "sid", null, this.sid));

	// set the extension list
	List<CmisExtensionElement> extensions = new ArrayList<CmisExtensionElement>();
	extensions.add(new CmisExtensionElementImpl(ns, "LogicaldocExtension", null, extElements));

	repoInfo.setExtensions(extensions);
}
 
Example #2
Source File: PublicApiAlfrescoCmisService.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
private RepositoryInfo getRepositoryInfo(final Network network)
{
	final String networkId = network.getTenantDomain();
    final String tenantDomain = (networkId.equals(TenantUtil.SYSTEM_TENANT) || networkId.equals(TenantUtil.DEFAULT_TENANT)) ? TenantService.DEFAULT_DOMAIN : networkId;

    return TenantUtil.runAsSystemTenant(new TenantRunAsWork<RepositoryInfo>()
    {
        public RepositoryInfo doWork()
        {
            RepositoryInfoImpl repoInfo = (RepositoryInfoImpl)connector.getRepositoryInfo(getContext().getCmisVersion());

            repoInfo.setId(!networkId.equals("") ? networkId : TenantUtil.SYSTEM_TENANT);
            repoInfo.setName(tenantDomain);
            repoInfo.setDescription(tenantDomain);

            return repoInfo;
        }
    }, tenantDomain);
}
 
Example #3
Source File: CmisRegistrar.java    From spring-content with Apache License 2.0 6 votes vote down vote up
BeanDefinition createCmisRepositorInfoBeanDefinition(AnnotationAttributes attributes, AnnotationMetadata annotationMetadata) {

		BeanDefinitionBuilder repoInfoBuilder = BeanDefinitionBuilder.genericBeanDefinition(RepositoryInfoImpl.class);
		repoInfoBuilder.getRawBeanDefinition().setSource(annotationMetadata);

		String id = attributes.getString("id");
		if (StringUtils.isEmpty(id)) {
			id = UUID.randomUUID().toString();
		}

		repoInfoBuilder.addPropertyValue("id", id);
		repoInfoBuilder.addPropertyValue("name", attributes.getString("name"));
		repoInfoBuilder.addPropertyValue("description", attributes.getString("description"));
		repoInfoBuilder.addPropertyValue("vendorName", attributes.getString("vendorName"));
		repoInfoBuilder.addPropertyValue("productName", attributes.getString("productName"));
		repoInfoBuilder.addPropertyValue("productVersion", attributes.getString("productVersion"));
		repoInfoBuilder.addPropertyValue("rootFolder", "@root@");

		return repoInfoBuilder.getBeanDefinition();
	}
 
Example #4
Source File: CmisUtils.java    From iaf with Apache License 2.0 6 votes vote down vote up
public static RepositoryInfo xml2repositoryInfo(Element cmisResult) {
	RepositoryInfoImpl repositoryInfo = new RepositoryInfoImpl();

	repositoryInfo.setCmisVersion(CmisVersion.fromValue(cmisResult.getAttribute("cmisVersion")));
	repositoryInfo.setCmisVersionSupported(cmisResult.getAttribute("cmisVersionSupported"));
	repositoryInfo.setDescription(cmisResult.getAttribute("description"));
	repositoryInfo.setId(cmisResult.getAttribute("id"));
	repositoryInfo.setLatestChangeLogToken(cmisResult.getAttribute("latestChangeLogToken"));
	repositoryInfo.setName(cmisResult.getAttribute("name"));
	repositoryInfo.setPrincipalAnonymous(cmisResult.getAttribute("principalIdAnonymous"));
	repositoryInfo.setPrincipalAnyone(cmisResult.getAttribute("principalIdAnyone"));
	repositoryInfo.setProductName(cmisResult.getAttribute("productName"));
	repositoryInfo.setProductVersion(cmisResult.getAttribute("productVersion"));
	repositoryInfo.setRootFolder(cmisResult.getAttribute("rootFolderId"));
	repositoryInfo.setThinClientUri(cmisResult.getAttribute("thinClientUri"));
	repositoryInfo.setVendorName(cmisResult.getAttribute("vendorName"));
	repositoryInfo.setChangesIncomplete(CmisUtils.parseBooleanAttr(cmisResult, "changesIncomplete"));
	repositoryInfo.setAclCapabilities(CmisUtils.xml2aclCapabilities(cmisResult));
	repositoryInfo.setCapabilities(CmisUtils.xml2capabilities(cmisResult));
	repositoryInfo.setChangesOnType(CmisUtils.xml2changesOnType(cmisResult));

	return repositoryInfo;
}
 
Example #5
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;
}