State history

Build 1501 on 14/Nov/2017  This topic last edited on: 25/Aug/2014, at 16:02

The object load extra ‘StateHistory’ computes and returns the complete history of all the states the object has been in – e.g.

  cmd4 get -ids 2429 -out c:\temp\obj.xml -extras StateHistory -username xxxx -password yyyy

where xxxx is the name of a GN4 user who can logon to system with sufficient permissions to perform this operation and yyyy is the password.

Note: the above connects to the default connection: should you want to specify the connection or server name, see cmd4 examples.

produces an output like this:

  <GenericAccessObj>

    <obj>

      <story . . . >

        . . .

      </story>

    </obj>

    . . .      

    <extra n="StateHistory">

      <stateHistory>

        <Action Time="2009-10-06T15:51:04.007Z" 

          UserId="1687" UserDesc="TeraDP\MiMo" 

          LoginGuid="76b5b617-8817-4eae-a09c-1e7adae4e9fd" 

          StateId="1702" />

        <Action Time="2009-11-14T23:47:42.69Z" 

          UserId="1687" UserDesc="TeraDP\MiMo" 

          LoginGuid="38fd2025-0abe-4bb3-affe-5f54095cb63a" 

          StateId="2253" />

      </stateHistory>

    </extra>

  </GenericAccessObj>

The first entry in the list corresponds to the object creation, the following ones to all the subsequent state changes in chronological order. In the example above the story has been created with the state id 1702 – i.e. in the folder with id 1702 – and then changed to the state with id 2253 – i.e. moved to the folder with id 2253.

If the requested object does not have a state attribute the system won’t return any state history.

The system does not return a state history also when the user executing the command does not have read access permission on the state attribute of the requested object.

If the user requesting the state history does not have the ‘Audit’ privilege he can’t access audit-tral entries of other users – so in this case the state history won’t contain information about other users – e.g. the same command as above execute by a user different from ‘TeraDP\MiMo’ and without the ‘Audit’ privilege returns:

  <GenericAccessObj>

    <obj>

      <story . . . >

        . . .

      </story>

    </obj>

    . . .      

    <extra n="StateHistory">

      <stateHistory>

        <Action Time="2009-10-06T15:51:04.007Z" 

          UserDesc="" 

          LoginGuid="00000000-0000-0000-0000-000000000000" 

          StateId="1702" />

        <Action Time="2009-11-14T23:47:42.69Z" 

          UserDesc="" 

          LoginGuid="00000000-0000-0000-0000-000000000000" 

          StateId="2253" />

      </stateHistory>

    </extra>

  </GenericAccessObj>

The object state history also includes the descriptive name of the state object (instead than just its id):

  <GenericAccessObj>

    <obj>

      . . .

    </obj>

    . . . 

    <extra n="StateHistory">

      <stateHistory 

        Time="2010-05-22T10:48:39.687Z" 

        UserId="1687" 

        UserDesc="TeraDP\MiMo" 

        LoginGuid="3eaef358-cf56-4e66-a4e2-c3271fba2134" 

        StateId="2908" 

        StateDesc="/system/users/MiMo/Test/Sub1/SubSub2A/SubSubSub1" />

      . . .

    </extra>

    . . .

  </GenericAccessObj>

 

There is a object load extra 'LastStateChange' that returns the description of the last state change - i.e. the last entry of the state history when the history is longer than one (the very first entry in the state history is the initial state, so it does not count as a state change). The command:

cmd4 get -ids 2429 -out c:\temp\obj.xml -extras LastStateChange -username xxxx -password yyyy

where xxxx is the name of a GN4 user who can logon to system with sufficient permissions to perform this operation and yyyy is the password.

Note: the above connects to the default connection: should you want to specify the connection or server name, see cmd4 examples.

produces this output:

  <GenericAccessObj>

    <obj>

      . . .

    </obj>

    . . . 

    <extra n="LastStateChange">

      <lastState 

        Time="2010-05-25T07:08:56.243Z" 

        UserId="1687" 

        UserDesc="TeraDP\MiMo" 

        LoginGuid="69a32973-27f0-4428-9321-358850c1b62d" 

        StateId="2363" StateDesc="/system/users/MiMo/Docs/Another" />

    </extra>

    . . .

  </GenericAccessObj>