cancel
Showing results for 
Search instead for 
Did you mean: 

Can't call nodeService.setProperty() after adding Record Aspect to Node

c0ry
Champ in-the-making
Champ in-the-making
The issue that we are having is we are unable to call nodeService.setProperty() on a node after we've added the Record Aspect to the node. This is new to Records Management v 2.1.a as this works fine for Alfresco 4.2.c and Records management 2.0.1.  What has changed? Or maybe the better question is "How can we fix this?"  Currently the only way to fix this do all of our nodeService.setPropert() calls before adding the Record Aspect. I've added a snippet of the the log output for the error that is created for the following

This question is probably more for Roy Wetherall the Records Management developer. We've installed Alfresco 4.2.e and Records Management Module 2.1.a.  We have a custom action class of which I've included a snippet of code for:



<blockcode>
public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) throws ActionServiceException
    {
       
           
      String filename = "customfilename.txt";
         
            // declare RECORD aspect properties hash map and populate with values
            Map <QName,Serializable> aspectValues = new HashMap<QName,Serializable>();
            aspectValues.put(RecordsManagementModel.PROP_ORIGINATOR, "Records Technician");
            aspectValues.put(RecordsManagementModel.PROP_ORIGINATING_ORGANIZATION, "Our Organization Name");

            System.out.println("Adding Record Aspect");
            // add RECORD aspect
           
         this.nodeService.setProperty(this.uploadedNode, ContentModel.PROP_NAME, filename);

            this.nodeService.addAspect(uploadedNode, RecordsManagementModel.ASPECT_RECORD, aspectValues);

            // declare FILEPLAN aspect properties hash map and populate with values
            Map <QName,Serializable> fpAspectValues = new HashMap<QName,Serializable>();

            // Create the RM FilePlanComponent and Declare the record after being moved into RM
            fpAspectValues.put(RecordsManagementModel.PROP_ROOT_NODEREF, this.getFilePlanRootNode());

            System.out.println("Adding File Plan Aspect");
            this.nodeService.addAspect(uploadedNode, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT, fpAspectValues);
            //this.nodeService.addAspect(this.uploadedNode, FILE_PLAN_COMPONENT_ASPECT_QNAME, fpAspectValues);

            // declare DECLARED RECORD aspect properties hash map and populate with values
            Map <QName,Serializable> drAspectValues = new HashMap<QName,Serializable>();
            drAspectValues.put(RecordsManagementModel.PROP_DECLARED_AT, ISO8601DateFormat.format(new Date()));
            drAspectValues.put(RecordsManagementModel.PROP_DECLARED_BY, "admin");

            System.out.println("Adding Declared Record Aspect");
            // add DECLARED RECORD aspect
            this.nodeService.addAspect(uploadedNode, RecordsManagementModel.ASPECT_DECLARED_RECORD, drAspectValues);

            // debug print statement
            System.out.println("Our nodeService Aspects = " + this.nodeService.getAspects(this.uploadedNode));
        }
        catch(Exception e)
        {
            e.printStackTrace();
            System.out.println("e.getMessage() = " + e.getMessage());
            System.out.println("e.getCause() = " + e.getCause());

            throw new ActionServiceException("Record Action failed.");
        }
        finally
        {
        }
    }
</blockcode>
2 REPLIES 2

c0ry
Champ in-the-making
Champ in-the-making
Here is the error log for the above code snippet

java.lang.NullPointerException
   at org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleServiceImpl.getZoneName(FilePlanRoleServiceImpl.java:597)
   at org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleServiceImpl.access$900(FilePlanRoleServiceImpl.java:78)
   at org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleServiceImpl$5.doWork(FilePlanRoleServiceImpl.java:567)
   at org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleServiceImpl$5.doWork(FilePlanRoleServiceImpl.java:562)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548)
   at org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleServiceImpl.getRolesByUser(FilePlanRoleServiceImpl.java:561)
   at org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleServiceImpl.getRolesByUser(FilePlanRoleServiceImpl.java:552)
   at org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl.isPropertyEditable(RecordServiceImpl.java:1088)
   at org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl.onUpdateProperties(RecordServiceImpl.java:543)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.alfresco.repo.policy.JavaBehaviour$JavaMethodInvocationHandler.invoke(JavaBehaviour.java:174)
   at com.sun.proxy.$Proxy26.onUpdateProperties(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor280.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.alfresco.repo.policy.PolicyFactory$MultiHandler.invoke(PolicyFactory.java:335)
   at org.alfresco.repo.policy.$Proxy275.onUpdateProperties(Unknown Source)
   at org.alfresco.repo.node.AbstractNodeServiceImpl.invokeOnUpdateProperties(AbstractNodeServiceImpl.java:465)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:558)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.addAspectsAndProperties(DbNodeServiceImpl.java:455)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.setProperty(DbNodeServiceImpl.java:1620)
   at sun.reflect.GeneratedMethodAccessor428.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:104)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at com.sun.proxy.$Proxy8.setProperty(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor428.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:215)
   at com.sun.proxy.$Proxy36.setProperty(Unknown Source)
   at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:252)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.lock.mem.LockableAspectInterceptor.invoke(LockableAspectInterceptor.java:200)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:260)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at com.sun.proxy.$Proxy8.setProperty(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor428.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
   at com.sun.proxy.$Proxy8.setProperty(Unknown Source)
   at gov.oregon.olcc.alfresco.extension.CaseRecordUploadDeclaredRecordExecuter.parseUploadMetaData(Unknown Source)
   at gov.oregon.olcc.alfresco.extension.CaseRecordUploadDeclaredRecordExecuter.executeImpl(Unknown Source)
   at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:258)
   at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:838)
   at org.alfresco.repo.action.executer.CompositeActionExecuter.executeImpl(CompositeActionExecuter.java:66)
   at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:258)
   at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:838)
   at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:738)
   at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:572)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
   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:46)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:247)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:213)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at com.sun.proxy.$Proxy43.executeAction(Unknown Source)
   at org.alfresco.repo.rule.RuleServiceImpl.executeAction(RuleServiceImpl.java:1250)
   at org.alfresco.repo.rule.RuleServiceImpl.executeRule(RuleServiceImpl.java:1244)
   at org.alfresco.repo.rule.ExtendedRuleServiceImpl.executeRule(ExtendedRuleServiceImpl.java:194)
   at org.alfresco.repo.rule.RuleServiceImpl.executePendingRule(RuleServiceImpl.java:1190)
   at org.alfresco.repo.rule.RuleServiceImpl.executePendingRulesImpl(RuleServiceImpl.java:1119)
   at org.alfresco.repo.rule.RuleServiceImpl.executePendingRules(RuleServiceImpl.java:1092)
   at org.alfresco.repo.rule.RuleTransactionListener.beforeCommit(RuleTransactionListener.java:57)
   at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:737)
   at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:717)
   at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:683)
   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:393)
   at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:474)
   at org.alfresco.repo.batch.BatchProcessor$TxnCallback.run(BatchProcessor.java:756)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:722)
e.getMessage() = null
e.getCause() = null

katnam21
Champ in-the-making
Champ in-the-making
Hi,

did u get any solution . even i am trying to add mandatory meta data to records aspect and getting error like not having appropriate permissions.

any hwlp would be appreciated.

Regards,
Katnam