2011-11-24 54 views
0

我是新來到露天的,儘管進行了一些研究,但我沒有找到如何做這個基本的事情:更改節點屬性的值。Alfresco:手動更改節點屬性的值

它可以通過界面或webscript。它用於測試目的(如果節點屬性Y的值爲Z,則顯示消息X),因此爲了測試我需要能夠快速修改該屬性的值。

你通常如何做到這一點?

非常感謝您的幫助!

編輯:我去了由skuro建議的OpenCMIS工作臺解決方案。但是,當我修改一個屬性,我得到以下異常:

Exception thrown 

org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error 

    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:450) 

    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:552) 

    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:776) 

at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObject(ObjectServiceImpl.java:471) 

at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:393) 

at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:371) 

at org.apache.chemistry.opencmis.client.api.Session$getObject.call(Unknown Source) 

at ConsoleScript0.run(ConsoleScript0:7) 

任何想法是什麼原因造成的?

編輯2:服務器日誌(顯然noderef沒有被正確傳送):

14:07:47,391 ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: NodeRef may not be null for calls to NodeService. Check client code. 
java.lang.IllegalArgumentException: NodeRef may not be null for calls to NodeService. Check client code. 
     at org.alfresco.repo.node.MLPropertyInterceptor.getPivotNodeRef(MLPropertyInterceptor.java:319) 
     at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:161) 
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
     at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:198) 
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
     at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:198) 
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
     at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) 
     at $Proxy7.getProperty(Unknown Source) 
     at fr.jouve.alfresco.selex.service.cmr.impl.SelexServiceImpl.generatePlacard(SelexServiceImpl.java:514) 
     at fr.jouve.alfresco.selex.repo.action.executer.selex.SelexArticleCreateUpdate.executeImpl(SelexArticleCreateUpdate.java:24) 
     at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:196) 
     at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:780) 
     at org.alfresco.repo.action.executer.CompositeActionExecuter.executeImpl(CompositeActionExecuter.java:66) 
     at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:196) 
     at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:780) 
     at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:700) 
     at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:538) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
     at java.lang.reflect.Method.invoke(Method.java:597) 
     at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) 
     at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) 
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) 
     at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34) 
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
     at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44) 
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
     at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:146) 
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
     at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) 
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 
     at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) 
     at $Proxy34.executeAction(Unknown Source) 
     at org.alfresco.repo.rule.RuleServiceImpl.executeRule(RuleServiceImpl.java:1208) 
     at org.alfresco.repo.rule.RuleServiceImpl.executePendingRule(RuleServiceImpl.java:1176) 
     at org.alfresco.repo.rule.RuleServiceImpl.executePendingRulesImpl(RuleServiceImpl.java:1127) 
     at org.alfresco.repo.rule.RuleServiceImpl.executePendingRules(RuleServiceImpl.java:1100) 
     at org.alfresco.repo.rule.RuleTransactionListener.beforeCommit(RuleTransactionListener.java:57) 
     at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:747) 
     at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:727) 
     at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:687) 
     at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95) 
     at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:927) 
     at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737) 
     at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) 
     at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:394) 
     at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472) 
     at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:403) 
     at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436) 
     at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466) 
     at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304) 
     at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:351) 
     at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:188) 
     at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118) 
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
     at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58) 
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) 
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
     at java.lang.Thread.run(Thread.java:662) 
+0

哪個版本的Alfresco要連接到哪個版本? – skuro

+0

版本3.4.2 – kgautron

+0

這很奇怪,我對Alfresco v3.4.0企業運行工作臺v0.5.0,它的一切都很流暢。你有權訪問Alfresco服務器日誌嗎? – skuro

回答

3

有許多方法可以完成任務。我會在這裏向您展示我會這樣做的方式,這應該提供一定程度的靈活性。

的JavaScript + Script Command Processor

放入/Company Home/Data Dictionary/Scripts/testupdate.js以下JavaScript文件:

document.properties["my:property"] = "qwerty"; 
document.save(); 

呼叫通過調用下面的URL腳本命令處理器:

http://localhost:8080/alfresco/command/script/execute?scriptPath=/Company%20Home/Data%20Dictionary/Scripts/testupdate.js&contextPath=/Company%20Home/path/to/file.txt

確保相應地更改URL和上下文路徑查詢參數。

CMIS工作臺

下載並打開OpenCMIS workbench,連接到露天(例如http://localhost:8080/alfresco/service/cmis)。然後在菜單上點擊Console -> - Basic Template -項目打開一個groovy控制檯。填寫以下腳本(將nodeRef更新爲您想要更新的節點之一),然後單擊「Execute Groovy Script」按鈕:

import org.apache.chemistry.opencmis.commons.* 
import org.apache.chemistry.opencmis.commons.data.* 
import org.apache.chemistry.opencmis.commons.enums.* 
import org.apache.chemistry.opencmis.client.api.* 

// def cmis = new scripts.CMIS(session) 
// println session.repositoryInfo.name 
// cmis.printObjectSummary "/" 
def node = session.getObject("workspace://SpacesStore/38dee96f-e028-4bed-821f-0ed25cc2ba07"); 
def newProps = ["cmis:name" : "qwerty"] 
def oldVal = node.getProperty("cmis:name").getValue(); 
node.updateProperties(newProps); 
def newVal = node.getProperty("cmis:name").getValue(); 

println oldVal + " -> " + newVal; 
+0

謝謝,這個CMIS工具似乎非常有用。但是,當我嘗試通過屬性編輯器或使用諸如所描述的腳本等腳本來更改屬性時,我會得到非常明顯的異常,我將它添加到了我的問題中。 – kgautron

+0

如果您想使用javascript方式,您應該查看share-extras項目中的Javascript控制檯(我寫過無恥的插件):http://code.google.com/p/share-extras/wiki/ JavascriptConsole – Florian

0

爲了能夠做到這一點的露天資源管理器中,您需要添加包含屬性方面。之後,你會在Alfresco Share上找到屬性文本框。