Working examples (multiple metadata approach)

Last modified 12 Mar 2021 10:22 +01:00

test050SimpleMetadataMappingUserAdd

We add the following object.

{
  "value" : {
    "changeType" : "add",
    "objectType" : "UserType",
    "objectToAdd" : {
      "@type" : "UserType",
      "oid" : "cab2344d-06c0-4881-98ee-7075bf5d1309",
      "name" : "bob",
      "subtype" : "regular",

      "givenName" : {
        "@value" : "Bob",
        "@metadata" : {
          "extension" : {
            "loa" : "low"
          }
        }
      },
      "familyName" : {
        "@value" : "Green",
        "@metadata" : {
          "extension" : {
            "loa" : "high"
          }
        }
      }
    },
    "oid" : "cab2344d-06c0-4881-98ee-7075bf5d1309"
  }
}

There is a single mapping that constructs fullName from givenName and familyName.

This is the plus set of the mapping:

{
  "@value" : "Bob Green",
  "@metadata" : {
    "@ns" : "http://midpoint.evolveum.com/xml/ns/public/common/common-3",
    "extension" : {
      "@ns" : "http://midpoint.evolveum.com/xml/ns/samples/metadata",
      "loa" : "low"
    }
  }
}

I.e. it is clear that this new value (including metadata) has to be added. So this is the resulting delta:

{
  "modificationType" : "add",
  "path" : "fullName",
  "value" : [ {
    "@value" : "Bob Green",
    "@metadata" : {
      "extension" : {
        "loa" : "low"
      }
    }
  } ]
}

After swallowing to the ADD primary delta we simply add the full name with the appropriate metadata.

test055SimpleMetadataMappingUserModify

Now we change givenName: value stays the same but LoA is increased.

Primary delta:

{
  "@type" : "ObjectDeltaType",
  "changeType" : "modify",
  "objectType" : "UserType",
  "oid" : "cab2344d-06c0-4881-98ee-7075bf5d1309",
  "itemDelta" : [ {
    "modificationType" : "replace",
    "path" : "givenName",
    "value" : [ {
      "@value" : "Bob",
      "@metadata" : {
        "extension" : {
          "loa" : "medium"
        }
      }
    } ],
    "estimatedOldValue" : [ {
      "@value" : "Bob",
      "@metadata" : {
        "extension" : {
          "loa" : "low"
        }
      }
    } ]
  } ]
}

The fullName evaluator gets the following:

{
  "plus" : [ {
    "@value" : "Bob",
    "@metadata" : {
      "extension" : {
        "loa" : "medium"
      }
    }
  } ],
  "minus" : [ {
    "@value" : "Bob",
    "@metadata" : {
      "extension" : {
        "loa" : "low"
      }
    }
  } ]
}