Alfresco 露天我可以换房子吗;cmis:creationDate和cmis:lastModificationDate“;可更新性?
你好,提前谢谢你的帮助 我在alfresco中插入和更新文档时遇到问题,因此当我设置“cmis:creationDate或cmis:lastModificationDate”之类的属性时,文档已成功创建,但具有Updateability=ReadOnly的属性未设置为新值,因为它是由alfresco自动设置的。 有没有办法将这些属性的可更新性设置为“读写”? 我正在使用Aalfresco 5.0和openCmis 0.13这是我的代码:Alfresco 露天我可以换房子吗;cmis:creationDate和cmis:lastModificationDate“;可更新性?,alfresco,cmis,opencmis,cmis-workbench,Alfresco,Cmis,Opencmis,Cmis Workbench,你好,提前谢谢你的帮助 我在alfresco中插入和更新文档时遇到问题,因此当我设置“cmis:creationDate或cmis:lastModificationDate”之类的属性时,文档已成功创建,但具有Updateability=ReadOnly的属性未设置为新值,因为它是由alfresco自动设置的。 有没有办法将这些属性的可更新性设置为“读写”? 我正在使用Aalfresco 5.0和openCmis 0.13这是我的代码: public void createDocument(Fo
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);
}
public void createDocument(文件夹)引发异常{
SimpleDataFormat sdf=新的SimpleDataFormat(“日/月/年”);
日期d=sdf.parse(“2012年12月21日”);
String name=“myNewDocument.txt”;
映射属性=新的HashMap();
Calendar cal=新的Gregorianalendar();
校准设定时间(d);
propertyID.OBJECT_TYPE_ID,“cmis:document,P:cm:titled,P:cm:author”);
properties.put(PropertyIds.NAME,NAME);
properties.put(PropertyIds.CREATION\u DATE,cal);
properties.put(PropertyIds.LAST\u MODIFICATION\u DATE,cal);
出售(“cm:所有权”、“所有权”);
属性。put(“cm:说明”、“说明”);
属性。put(“cm:作者”、“作者”);
属性。put(“cmis:creationDate”,cal);
byte[]content=“Hello World!”.getBytes();
InputStream=新的ByteArrayInputStream(内容);
ContentStream ContentStream=new ContentStreamImpl(名称,biginger.valueOf(content.length),“text/plain”,stream);
Document newDoc=folder.createDocument(属性、contentStream、VersioningState.MAJOR);
}
更新只读字段需要在露天进行操作。存在防止方面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中,以允许远程更改属性。更新只读字段需要在露天进行操作。存在防止方面
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中,以允许远程更改属性。当他玩了这些道具后,是否应该重新启用该方面的行为?非常感谢您的回答,但我对alfresco非常陌生,请您提供更多关于如何在alfresco方面执行此操作的详细信息,你说的是Alfresco源代码吗?我应该修改哪些文件?这个问题有点超出了单个线程的范围。您将想看一些关于扩展露天空间的教程。这里有一些资源可以帮助您开始:&他玩了这些道具后是否应该重新启用这方面的行为?非常感谢您的回答,但我对alfresco非常陌生,您能给我更多关于如何在alfresco方面做到这一点的细节吗?您是在谈论alfresco源代码吗?我应该修改哪些文件?这个问题有点超出了单个线程的范围。您将想看一些关于扩展露天空间的教程。以下是一些帮助您入门的资源:&