你好,谢谢您的帮助
我在al新鲜to中插入和更新文档时遇到了问题,所以当我设置一个属性"cmis:creationDate或cmis:lastModificationDate“时,文档将被成功创建,但是具有Updatability=ReadOnly的属性不会设置为新值,因为它是由al新鲜to自动设置的。是否有将这些属性的可更新性设置为"ReadWrite“的解决方案?我使用的是Aalfreco5.0和openCmis 0.13 --这是我的代码:
public void createDocument(Folder folder) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date d = sdf.parse("21/12/2012");
String name = "myNewDocument.txt";
Map<String, Object> properties = new HashMap<String, Object>();
Calendar cal = new GregorianCalendar();
cal.setTime(d);
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled,P:cm:author");
properties.put(PropertyIds.NAME, name);
properties.put(PropertyIds.CREATION_DATE, cal);
properties.put(PropertyIds.LAST_MODIFICATION_DATE, cal);
properties.put("cm:title", "Title");
properties.put("cm:description", "Description");
properties.put("cm:author", "author");
properties.put("cmis:creationDate ", cal);
byte[] content = "Hello World!".getBytes();
InputStream stream = new ByteArrayInputStream(content);
ContentStream contentStream = new ContentStreamImpl(name, BigInteger.valueOf(content.length), "text/plain", stream);
Document newDoc = folder.createDocument(properties, contentStream, VersioningState.MAJOR);
}发布于 2016-02-10 13:52:49
更新只读字段需要在Alfresco方面进行工作。有一些策略可以防止方面cm:auditable的属性被更改。
在禁用了策略行为之后,您可以使用NodeService API更新Alfresco中的字段。下面是一个例子:
policyBehaviourFilter.disableBehaviour(node, ContentModel.ASPECT_AUDITABLE);
// Update CreatedDate
nodeService.setProperty(node, ContentModel.PROP_CREATED, dateTime);
//Enable policy
policyBehaviourFilter.enableBehaviour(node, ContentModel.ASPECT_AUDITABLE);您可以将其打包到自定义的webscript中,以便远程更改属性。
https://stackoverflow.com/questions/35313623
复制相似问题