Uploaded image for project: 'MidPoint'
  1. MidPoint
  2. MID-4964

Shadows query is not filtering by name

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Reviewed
    • Affects Version/s: 3.7.2
    • Fix Version/s: 3.9
    • Component/s: Model, Prism
    • Labels:
      None
    • Environment:

      Mac OS 10.12.6 / Running standalone mode / DB PostgreSQL

    • Subscription:
      Active subscription
    • Git Revision:
      git-v3.7.2

      Description

      Running a query over the shadows on a specific resource it does not filter by name even when it is specified. It return all shadows found in the resource.

      I am running this code inside a Mapping Expression inside the Object Template:

      {{import javax.xml.namespace.QName;
      import com.evolveum.midpoint.prism.query.builder.QueryBuilder;
      import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
      import com.evolveum.midpoint.schema.constants.SchemaConstants;
      import com.evolveum.midpoint.prism.PrismPropertyDefinitionImpl;
      import com.evolveum.midpoint.util.DOMUtil;

      log.debug("Name received: " + name);

      propDef = new PrismPropertyDefinitionImpl(SchemaConstants.ICFS_NAME, DOMUtil.XSD_STRING, midpoint.getPrismContext());
      attrName = new QName("http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3", "name");
      objectClass = new QName("http://midpoint.evolveum.com/xml/ns/public/resource/instance-3", "AccountObjectClass");

      userInMPQuery = QueryBuilder.queryFor(ShadowType.class, midpoint.getPrismContext())
      .item(ShadowType.F_OBJECT_CLASS).eq(objectClass).and()
      .item(ShadowType.F_RESOURCE_REF).ref("702ecc89-deba-4542-9618-5b9c8ba94abe").and()
      .itemWithDef(propDef, ShadowType.F_ATTRIBUTES, propDef.getName()).eq(name.toString())
      .build();

      log.debug("Query: " + userInMPQuery);

      userInMidpoint = midpoint.searchObjects(ShadowType.class, userInMPQuery);
      log.debug("Results: " + userInMidpoint);}}

      Data sent to the log file:

      DEBUG (com.evolveum.midpoint.expression): Name received: fzamora

      DEBUG (com.evolveum.midpoint.expression): Query: Q{AND(EQUAL: attributes/name,PPV(String:fzamora),EQUAL: objectClass,PPV(QName:

      {...resource/instance-3}

      AccountObjectClass),REF: resourceRef,PRV(oid=702ecc89-deba-4542-9618-5b9c8ba94abe, targetType=null)),null paging

      DEBUG (com.evolveum.midpoint.expression): Results: [shadow:6d375576-8c8b-4610-b0c4-750120a857f5(nosorio), shadow:27f3cf8f-eea1-4571-b0af-e21dbd253919(plozana), shadow:e60f1178-eee5-400f-9b76-bcf4beba32fd(mmarchese), shadow:f6703526-fedc-4817-a735-55571a360712(fzamora), shadow:3f3e5051-7837-4183-9b5f-c7c849b9d14b(imichco), shadow:83718b60-4d02-48c7-9304-c1e69e254c45(aortis), shadow:d024034a-dc4e-4dbc-909f-adab858c3943(mbesozzi), shadow:e52731a1-54cf-4c63-9e1d-8fccbdc94606(admin), shadow:46f69bbc-95ea-4ea0-a896-edac89ef883c(nrossi), shadow:06005fdd-55bb-4316-a397-39d8fbc4896c(ealonso)]

        Attachments

          Activity

            People

            Assignee:
            nrossi Nicolás Rossi
            Reporter:
            nrossi Nicolás Rossi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: