Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-7602

Allow cm:auditable values to be set programmatically.


    • Type: Service Pack Request
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 3.2.1
    • Fix Version/s: 3.3.3, 3.4
    • Component/s: Repository
    • Labels:
    • Environment:
      RHEL 5, mySQL, Tomcat
      Win XP SP3, mySQL, Tomcat
    • Bug Priority:
      Category 2
    • ACT Numbers:



      Customer is trying to alter the cm:creator, cm:modifier, cm:created auditable attributes of documents during a migration process of content from an older system and during this migration process they're trying to alter the Creator/Creation Date but nothing is taking effect, the properties are always set to initial values.

      A snippet of the customer's property setting code is below:

      /*************************** Set Titled properties (creator, creation date) ************************/
      Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(1, 1.0f);
      titledProps.put(ContentModel.PROP_TITLE, "my title");
      titledProps.put(ContentModel.PROP_DESCRIPTION, "my description");
      this.nodeService.addAspect(doc, ContentModel.ASPECT_TITLED, titledProps);

      The above properties are set correctly after a commit.

      /*************************** Set Auditable properties (creator, creation date) ************************/
      Map<QName, Serializable> auditableProps = new HashMap<QName, Serializable>(1, 1.0f);
      auditableProps.put(ContentModel.PROP_CREATED, creationDate);
      auditableProps.put(ContentModel.PROP_MODIFIED, creationDate);
      auditableProps.put(ContentModel.PROP_MODIFIER, "alexis");
      auditableProps.put(ContentModel.PROP_CREATOR, "alexis");
      this.nodeService.addAspect(doc, ContentModel.ASPECT_AUDITABLE, auditableProps);

      The above properties are not set, although when queried before the transaction is committed they return the new values.

      I have been testing this using code which creates the document (sample code) and have tried the following against the noderef (nodeRef):

      Map<QName, Serializable> auditableProps = new HashMap<QName, Serializable>();

      auditableProps.put(ContentModel.PROP_MODIFIER, "alexis");
      auditableProps.put(ContentModel.PROP_CREATOR, "alexis");
      nodeService.addAspect(content, ContentModel.ASPECT_TITLED, auditableProps);

      nodeService.addAspect(content, ContentModel.ASPECT_TITLED, auditableProps);

      I have also tried to just set the property as follows (without a hashMap):
      nodeService.setProperty(content, ContentModel.PROP_CREATOR, "creator name");

      Every time the document's Creator/Modifier properties remain the same (as 'admin'). I checked the contentModel.xml and found that cm:creator and cm:modifier are <protected>true</protected> but even when I switch this to false it makes no difference.

      Suspect that this bug is related: https://issues.alfresco.com/jira/browse/ETWOTWO-1113


          Issue Links




                • Assignee:
                  closedbugs Closed Bugs (Inactive)
                  astrachan Alex Strachan
                • Votes:
                  2 Vote for this issue
                  10 Start watching this issue


                  • Created:

                    Structure Helper Panel