I need to share and unshare the content in alfresco using OpenCMIS, i read the documentation here for Apache Chemistry but i don't find this API functionality to share and unshare Documents.
So how can i do it programmatically?
I need to share and unshare the content in alfresco using OpenCMIS, i read the documentation here for Apache Chemistry but i don't find this API functionality to share and unshare Documents.
So how can i do it programmatically?
我将您的要求解释如下:您想使用 Alfresco Share 的“快速分享”——Alfresco Community 4.2 和 Alfresco Cloud 中提供的功能。
Alfresco Share 使用以下内部 API (REST/Webscript) 来触发快速共享:
POST /api/internal/shared/share/{store_protocol}/{store_id}/{node_id}
它将生成的快速共享 ID 作为 json 返回:
{
"sharedId": "IHR65hlGT9yOTKwqPYMbRw"
}
WebScript 是作为 Java 支持的 WebScript 实现的。控制器是
org.alfresco.repo.web.scripts.quickshare.ShareContentPost
使用以下服务:
org.alfresco.repo.quickshare.QuickShareServiceImpl
正如您在此处看到的,此服务生成一个 UUID(链接 id)并将值设置为属性 qshare:sharedId(Aspect qshare:shared):
UUID uuid = UUIDGenerator.getInstance().generateRandomBasedUUID();
sharedId = Base64.encodeBase64URLSafeString(uuid.toByteArray()); // => 22 chars (eg. q3bEKPeDQvmJYgt4hJxOjw)
Map<QName,Serializable> props = new HashMap<QName,Serializable>(2);
props.put(QuickShareModel.PROP_QSHARE_SHAREDID, sharedId);
props.put(QuickShareModel.PROP_QSHARE_SHAREDBY, AuthenticationUtil.getRunAsUser());
nodeService.addAspect(nodeRef, QuickShareModel.ASPECT_QSHARE, props);
您应该可以通过 CMIS 执行此操作,但此服务还通过 AttributeService 设置属性(存储每个租户的所有共享 ID):
attributeService.setAttribute(tenantNodeRef, ATTR_KEY_SHAREDIDS_ROOT, sharedId)
我不确定这是出于什么目的以及是否必须满足您的要求。