AnsweredAssumed Answered

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

Question asked by c0ry on Mar 12, 2014
Latest reply on Nov 4, 2014 by katnam21
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>

Outcomes