Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-15989

Updated relationship properties are no longer available to property onRetrieve hooks after object onUpdate

    XMLWordPrintable

    Details

    • Target Version/s:
    • Story Points:
      3
    • Sprint:
      IDM - 2021.2
    • Support Ticket IDs:

      Description

      Steps to replicate:

      Step 1: Find attached managed.json and replace openidm/conf/managed.json.

      Attached managed.json contains 2 new managed objects: objectType1 and objectType2.  objectTypet1 has 2 properties of type relationship to objectType2.

      Step 2: Start openidm

      Step 3: Create objectType2

      curl ..
       --request PUT \
       --data '{
         "name": "TestObject2"
       }' \
       "http://localhost:8080/openidm/managed/objectType2/TestObject2" | jq .
      

      Step 4: Create objectType1

      curl ...
       --request PUT \
       --data '{
         "name": "TestObject1",
         "relationshipProperty1" : [ {"_ref":"managed/objectType2/TestObject2"}]
       }' \
       "http://localhost:8080/openidm/managed/objectType1/TestObject1" | jq .
      

      Step 5: Update TestObject1

      curl ...
       --request PATCH \
       --data '[{
      "operation" : "replace",     "field" : "/name",     "value" : "UpdatedObject1"
      }]' \
       "http://localhost:8080/openidm/managed/objectType1/TestObject1" | jq .
      

      Step 6: Query all managed/objectType1 and return relationshipPropert1 and 2

      curl -u "openidm-admin:openidm-admin" -X GET --header 'Accept: application/json' --header 'X-Requested-With: Swagger-UI' 'http://openidm.example.com:8080/openidm/managed/objectType1?_queryFilter=true&_fields=relationshipProperty1,relationshipProperty2' | jq .
      

      Reponse:

       "result": [
          {
            "_id": "TestObject1",
            "_rev": "000000003623b17d",
            "relationshipProperty2": [
              {
                "_ref": "managed/objectType2/TestObject2",
                "_refResourceCollection": "managed/objectType2",
                "_refResourceId": "TestObject2",
                "_refProperties": {
                  "_id": "3ea4f4b8-6c07-4606-8573-62e15990842d",
                  "_rev": "00000000e17f9f90"
                }
              }
            ],
            "relationshipProperty1": [
              {
                "_ref": "managed/objectType2/TestObject2",
                 "_refResourceCollection": "managed/objectType2",
                "_refResourceId": "TestObject2",
                "_refProperties": {
                  "dateRelationshipProperty": "2020-12-24T03:41:24.013Z",
                  "_id": "13457700-ce86-47e4-9119-50cc616bf653",
                  "_rev": "000000005b0dbffc"
                }
      ...
        }

      Expected: dateRelationshipProperty set for relationshipProperty1 and relationshipProperty2

      dateRelationshipProperty is set in onUpdate.

        Attachments

        1. managed.json
          59 kB
        2. managed.json
          59 kB

          Activity

            People

            Assignee:
            krismy.alfaro Krismy Alfaro
            Reporter:
            margaret.rizkalla Margaret Rizkalla
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: