[OPENIDM-9902] Backport OPENIDM-9217: Do not execute managed property's onRetrieve when returnByDefault is false Created: 29/Dec/17  Updated: 23/Feb/18  Resolved: 09/Feb/18

Status: Closed
Project: OpenIDM
Component/s: Module - Core mapping, synchronization, reconciliation
Affects Version/s: OpenIDM 4.5.0, OpenIDM 5.0.0, OpenIDM 6.0.0
Fix Version/s: OpenIDM 5.0.0.2

Type: Bug Priority: Major
Reporter: Mark Offutt Assignee: Mark Offutt
Resolution: Fixed Votes: 0
Labels: Sustaining
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backport
is a backport of OPENIDM-9217 Do not execute managed property's onR... Closed
Target Version/s:
Verified Version/s:
QA Assignee: Jakub Janoska
Support Ticket IDs:

 Description   

 

Defining a virtual attribute in a managed object, with an onRetrieve script, and for which returnByDefault is false, the script is always invoked regardless the property is requested or not. This is a performance bottleneck when the script has poor performances, which is wasted since the value is not returned into the response.

[ Note this is entered as a bug, but it could be arguably an RFE ]



 Comments   
Comment by Jakub Janoska [ 23/Feb/18 ]

 Verified on OpenIDM version "5.0.0.2-RC2" (revision: 608d658) jenkins-OpenIDM - 5.0.x - Release-18 sustaining/5.0.x.

Steps for verification:

  1. ./startup.sh -p samples/sample1
  2. create test.js in openidm/scripts
    • var response = openidm.read("managed/user/bjensen", null, ["mail", "givenName"]);
      response;
  1. update managed.json
    • "city" : {
        "description" : "",
        "title" : "City",
        "viewable" : true,
        "searchable" : false,
        "userEditable" : true,
        "policies" : [ ],
        "returnByDefault" : false,
        "type" : "string",
        "isVirtual" : true,
        "onRetrieve" : {
          "type" : "text/javascript",
          "globals" : { },
          "source" : "logger.info('City is retrieved');"
        }
      },
  1. reconcile
  2. curl -X POST 'http://localhost:8080/openidm/script?_action=eval' -H 'cache-control: no-cache' -H 'content-type: application/json' -H 'x-openidm-password: openidm-admin' -H 'x-openidm-username: openidm-admin' -d '{
    "type": "text/javascript",
    "file": "script/test.js"
    }' | jq .
    

    **

  3. Result: "*INFO: City is retrieved" is not added into log, when returnByDefault is false. When test.js returns also city attribute, "*INFO: City is retrieved" is added into log.
Generated at Mon Dec 17 07:03:01 GMT 2018 using JIRA 7.3.8#73019-sha1:94e8771b8094eef96c119ec22b8e8868d286fa88.