Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-6054

Better lock format to store user and timestamp; always enforce single locker

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.2
    • Fix Version/s: 5.4.2-RC1, 5.4.2
    • Component/s: Core, Core VCS
    • Impact type:
      API added, Content model Change
    • Upgrade notes:
      Hide

      New APIs:
      CoreSession.setLock(docRef)
      CoreSession.getLockInfo(docRef)
      CoreSession.removeLock(docRef)
      DocumentModel.setLock()
      DocumentModel.getLockInfo()
      DocumentModel.removeLock()
      NXQL.ECM_LOCK_OWNER = "ecm:lockOwner"
      NXQL.ECM_LOCK_CREATED = "ecm:lockCreated"
      CoreSession.IMPORT_LOCK_OWNER = "ecm:lockOwner"
      CoreSession.IMPORT_LOCK_CREATED = "ecm:lockCreated"
      LockActions.LOCK_CREATED = "document.lock.created"

      Deprecated APIs (use those above instead):
      CoreSession.getLock(docRef)
      CoreSession.setLock(docRef, key)
      CoreSession.unlock(docRef)
      DocumentModel.getLock()
      DocumentModel.setLock(key)
      DocumentModel.unlock()
      NXQL.ECM_LOCK = "ecm:lock"
      CoreSession.IMPORT_LOCK = "ecm:lock"
      LockActions.LOCK_TIME = "document.lock.time"

      NXQL must now use "ecm:lockOwner" and "ecm:lockCreated" instead of "ecm:lock" (which is still here but returns the ecm:lockOwner value).

      Nuxeo Automation document JSON output now includes "lockOwner" and "lockCreated" (full ISO 7601 date).

      Import through CoreSession.importDocuments must now use CoreSession.IMPORT_LOCK_OWNER and CoreSession.IMPORT_LOCK_CREATED instead of CoreSession.IMPORT_LOCK which is deprecated.

      LockActions.getLockDetails returns a map with an additional LockActions.LOCK_CREATED field with a Calendar for the creation date. LockActions.LOCK_TIME is deprecated.

      The LockingRestlet RESTAPI (Locking) has a new "state" action returning the full created date in the form someuser/2001-01-27T11:22:33+01:00 (GET /nuxeo/restAPI/

      {repoId}

      /

      {docId}

      /Locking/state). The "status" action is deprecated.

      Show
      New APIs: CoreSession.setLock(docRef) CoreSession.getLockInfo(docRef) CoreSession.removeLock(docRef) DocumentModel.setLock() DocumentModel.getLockInfo() DocumentModel.removeLock() NXQL.ECM_LOCK_OWNER = "ecm:lockOwner" NXQL.ECM_LOCK_CREATED = "ecm:lockCreated" CoreSession.IMPORT_LOCK_OWNER = "ecm:lockOwner" CoreSession.IMPORT_LOCK_CREATED = "ecm:lockCreated" LockActions.LOCK_CREATED = "document.lock.created" Deprecated APIs (use those above instead): CoreSession.getLock(docRef) CoreSession.setLock(docRef, key) CoreSession.unlock(docRef) DocumentModel.getLock() DocumentModel.setLock(key) DocumentModel.unlock() NXQL.ECM_LOCK = "ecm:lock" CoreSession.IMPORT_LOCK = "ecm:lock" LockActions.LOCK_TIME = "document.lock.time" NXQL must now use "ecm:lockOwner" and "ecm:lockCreated" instead of "ecm:lock" (which is still here but returns the ecm:lockOwner value). Nuxeo Automation document JSON output now includes "lockOwner" and "lockCreated" (full ISO 7601 date). Import through CoreSession.importDocuments must now use CoreSession.IMPORT_LOCK_OWNER and CoreSession.IMPORT_LOCK_CREATED instead of CoreSession.IMPORT_LOCK which is deprecated. LockActions.getLockDetails returns a map with an additional LockActions.LOCK_CREATED field with a Calendar for the creation date. LockActions.LOCK_TIME is deprecated. The LockingRestlet RESTAPI (Locking) has a new "state" action returning the full created date in the form someuser/2001-01-27T11:22:33+01:00 (GET /nuxeo/restAPI/ {repoId} / {docId} /Locking/state). The "status" action is deprecated.

      Description

      Currently the lock API is
      CoreSession.setLock(DocumentRef docRef, String key)
      Where the key is of the form "jdoe" or "jdoe:Nov 29, 2010" and has to be generated by the caller.
      Conversely the getLock() API returns a String that has to be parsed if we want to extract the date.

      Problems:

      • there's many repeated places where date generation/parsing occurs,
      • it's not possible to store a precise timestamp.

      -> Change the lock API to generate the timestamp automatically, and provide an API that returns it.
      Also, store the timestamp in the database in a proper column (with database migration).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fguillaume Florent Guillaume
                Reporter:
                fguillaume Florent Guillaume
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: