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

Unable to sort by '_id' when querying Scripted Connectors

    Details

    • Target Version/s:
    • Story Points:
      2
    • Sprint:
      2019.10 - IDM

      Description

      When executing a querying against a Scripted ICF connector and specifying the _id attribute as a _sortKey, OpenIDM's ICF Provisioner service does not translate _id into Uid.NAME before setting the sort key within the connector OperationOptions.

      Our OOTB scripted connector sample contain code to translate between native ICF attributes (__UID__ and __NAME__) and the attributes use on the target system. As a result of the OpenIDM ICF Provisioner not translating _id into the ICF __UID__ attribute the existing code within our samples fails to perform the necessary conversion to the attribute name in used by the external system.

      This can be reproduced by executing the following request using the scripted-sql-with-mysql sample:

      curl 
      --header "X-OpenIDM-Username: openidm-admin" \
      --header "X-OpenIDM-Password: openidm-admin" \
      --request GET \
      "http://localhost:8080/openidm/system/hrdb/account?_queryFilter=true&_pageSize=2&_sortKeys=timestamp,_id
      

      To resolve the issue, ObjectClassResourceProvider.getSanitizedSortKeys() should convert ResourceResponse.FIELD_CONTENT_ID to Uid.NAME. For example:

      private List<SortKey> getSanitizedSortKeys(List<org.forgerock.json.resource.SortKey> sortKeys)
              throws BadRequestException {
          List<SortKey> sanitizedSortKeys = new ArrayList<>(sortKeys.size());
          for (org.forgerock.json.resource.SortKey s: sortKeys) {
              // Validate the sortKey against the schema
              final String attrName = objectClassInfoHelper.getAttributeName(s.getField());
              if (attrName != null) {
                  sanitizedSortKeys.add(new SortKey(attrName, s.isAscendingOrder()));
              } else if (s.getField().leaf().equals(ResourceResponse.FIELD_CONTENT_ID)) {
                  sanitizedSortKeys.add(new SortKey(Uid.NAME, s.isAscendingOrder()));
              } else {
                  throw new BadRequestException("Unsupported _sortKey: " + s.getField().leaf());
              }
          }
          return sanitizedSortKeys;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              jbranch Jon Branch
              Reporter:
              cgdrake Chris Drake
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: