Class GrouperProvisioningTargetNativeSync

java.lang.Object
edu.internet2.middleware.grouper.app.provisioning.GrouperProvisioningTargetNativeSync
Direct Known Subclasses:
DatadogProvisioningTargetNativeSync, DropboxProvisioningTargetNativeSync, FreshRequesterProvisioningTargetNativeSync, GrouperAdobeProvisioningTargetNativeSync, GrouperAzureProvisioningTargetNativeSync, GrouperBoxProvisioningTargetNativeSync, GrouperDuoProvisioningTargetNativeSync, GrouperGoogleProvisioningTargetNativeSync, GrouperOktaProvisioningTargetNativeSync, GrouperRemedyProvisioningTargetNativeSync, GrouperScim2ProvisioningTargetNativeSync, InterfolioProvisioningTargetNativeSync, LdapProvisioningTargetNativeSync, TeamDynamixProvisioningTargetNativeSync, TrueFoundryProvisioningTargetNativeSync

public class GrouperProvisioningTargetNativeSync extends Object
Sibling of GrouperProvisioningConfiguration / GrouperProvisioningBehavior / GrouperProvisioningData that owns the runtime "generic provisioner sync back" logic. Subclasses live per protocol (e.g. LdapProvisioningTargetNativeSync, eventually GrouperScim2ProvisioningTargetNativeSync) and add the protocol-specific concerns:
  • Bean construction from the native protocol object (e.g. LdapEntry, JsonNode).
  • Widening the protocol-specific search-attribute set so the native-attribute paths configured on GrouperProvisioningConfiguration are returned by the target query.
  • Convenience capture-from-native-entry methods that pair a build with a record.

This base is concrete and usable as-is for the recording side; a default provisioner with no protocol-specific build logic gets the generic three-method recorder.

Each recordTargetNativeXxx method is gated by the corresponding GrouperProvisioningBehavior predicate (GrouperProvisioningBehavior.isLoadGroupsToGenericGrouperTable() etc.) so callers never need to flag-check at the call site.

  • Constructor Details

    • GrouperProvisioningTargetNativeSync

      public GrouperProvisioningTargetNativeSync()
  • Method Details

    • getGrouperProvisioner

      public GrouperProvisioner getGrouperProvisioner()
      reference back up to the provisioner
    • setGrouperProvisioner

      public void setGrouperProvisioner(GrouperProvisioner grouperProvisioner1)
    • recordTargetNativeGroup

      public void recordTargetNativeGroup(GrouperProvisioningTargetNativeGroup grouperProvisioningTargetNativeGroup)
      Append a native group bean to the in-memory list that drives end-of-run sync into grouper_prov_group / _attr / _attr_value. No-op when reporting is disabled or the DAO doesn't support retrieving groups.
    • recordTargetNativeUser

      public void recordTargetNativeUser(GrouperProvisioningTargetNativeUser grouperProvisioningTargetNativeUser)
      Append a native user bean to the in-memory list that drives end-of-run sync into grouper_prov_user / _attr / _attr_value. No-op when reporting is disabled or the DAO doesn't support retrieving entities.
    • effectiveNativeAttributeConfigsEntities

      public List<GrouperProvisioningNativeAttributeConfig> effectiveNativeAttributeConfigsEntities()
      Effective list of native attribute configs to capture for entities (users). If the provisioner config has an explicit nativeAttributesEntities list, that wins; otherwise the protocol subclass's defaults from getDefaultNativeAttributeConfigsEntities() are used.
    • configuredNativeAttributeConfigsEntities

      protected List<GrouperProvisioningNativeAttributeConfig> configuredNativeAttributeConfigsEntities()
      Operator-configured nativeAttributesEntities from the provisioner, or null when there is none (or no provisioner is attached). Isolated as a seam so the normalize/auto-inject in effectiveNativeAttributeConfigsEntities() is always applied regardless of how the raw list is supplied -- production reads the provisioner; tests override this to inject a list without standing up a provisioner. Do NOT bypass the effective method itself, or the exceptions transform is skipped.
    • effectiveNativeAttributeConfigsGroups

      public List<GrouperProvisioningNativeAttributeConfig> effectiveNativeAttributeConfigsGroups()
      Effective list of native attribute configs to capture for groups. See effectiveNativeAttributeConfigsEntities() for the resolution rule.
    • configuredNativeAttributeConfigsGroups

      protected List<GrouperProvisioningNativeAttributeConfig> configuredNativeAttributeConfigsGroups()
    • getDefaultNativeAttributeConfigsEntities

      protected List<GrouperProvisioningNativeAttributeConfig> getDefaultNativeAttributeConfigsEntities()
      Per-protocol sensible-default attribute list for entities (users) when the operator hasn't configured nativeAttributesEntities. Override in protocol subclasses to return a curated list (e.g. SCIM core schema fields). Default is empty — for LDAP this means "no extra capture beyond what the regular target query returned," which is the historical behavior.
    • getDefaultNativeAttributeConfigsGroups

      protected List<GrouperProvisioningNativeAttributeConfig> getDefaultNativeAttributeConfigsGroups()
      Per-protocol sensible-default attribute list for groups. See getDefaultNativeAttributeConfigsEntities().
    • grouperToNativeNameExceptionsEntities

      protected Map<String,String> grouperToNativeNameExceptionsEntities()
      Per-protocol native<->grouper attribute NAME exceptions for entities: grouper attribute name -> native (JSON/bean) field name, EXCEPTIONS ONLY -- anything not listed is identical in both namespaces. This is the single source of truth for name differences and drives both name normalization of the effective capture list AND auto-injection of every renamed attribute, so a cache-reconstructed object has the same attribute shape (and therefore matches/compares the same) as a live read. Default empty (most targets use identical names, e.g. LDAP mail/cn). Override per protocol (e.g. Google's email -> primaryEmail).
      Returns:
      grouper name -> native name, exceptions only
    • grouperToNativeNameExceptionsGroups

      protected Map<String,String> grouperToNativeNameExceptionsGroups()
    • recordTargetNativeMemberships

      public void recordTargetNativeMemberships(List<GrouperProvisioningTargetNativeMembership> grouperProvisioningTargetNativeMemberships)
      Append native memberships to the in-memory list that drives end-of-run sync into grouper_prov_mship. No-op when reporting is disabled, or when the membership load flag is off, or when the input list is empty.
    • markSyncBackUserForRead

      public void markSyncBackUserForRead(String targetId)
      Register targetId as needing a sync-back re-read. Called from write sites that change an entity in the target without getting a response body to capture from. No-op when reporting is off for entities or when targetId is null.
    • markSyncBackGroupForRead

      public void markSyncBackGroupForRead(String targetId)
      see markSyncBackUserForRead(java.lang.String); same semantics for groups
    • clearSyncBackUserForRead

      public void clearSyncBackUserForRead(String targetId)
      Drop targetId from the user sync-back-read set. Called by recordTargetNativeUser(edu.internet2.middleware.grouper.app.provisioning.GrouperProvisioningTargetNativeUser) whenever a fresh entry lands in the canonical map — whether from a read response, a write response, or the drain.
    • clearSyncBackGroupForRead

      public void clearSyncBackGroupForRead(String targetId)
      see clearSyncBackUserForRead(java.lang.String); same semantics for groups
    • removeTargetNativeGroup

      public void removeTargetNativeGroup(String targetId)
      Remove any captured native group representation for targetId. Idempotent.
    • removeTargetNativeUser

      public void removeTargetNativeUser(String targetId)
      see removeTargetNativeGroup(java.lang.String); same semantics for users
    • markSyncBackGroupForDelete

      public void markSyncBackGroupForDelete(String targetId)
      Register targetId as deleted from the target this run. No-op when group reporting is off or targetId is null.
    • clearSyncBackGroupForDelete

      public void clearSyncBackGroupForDelete(String targetId)
      Drop targetId from the group deleted set (cheap, idempotent).
    • markSyncBackUserForDelete

      public void markSyncBackUserForDelete(String targetId)
      see markSyncBackGroupForDelete(java.lang.String); same semantics for users
    • clearSyncBackUserForDelete

      public void clearSyncBackUserForDelete(String targetId)
      see clearSyncBackGroupForDelete(java.lang.String); same semantics for users
    • recordTargetNativeGroupWrite

      public void recordTargetNativeGroupWrite(String targetId, GrouperProvisioningTargetNativeGroup grouperProvisioningTargetNativeGroup)
      Group-write sync-back hook, called from a provisioner's insert/update commands path right after the target write (create or attribute update). Runs four steps in order:
      1. mark the target id for sync-back read (the drain ensures it later),
      2. drop the id from the deleted set (a write supersedes a pending delete),
      3. remove any stale read-map representation -- for an update this is the crucial step (drops the pre-write read-pass native so the drain re-reads it; an insert normally has none),
      4. if the write returned the native object, register it like a read so no re-read is needed -- the drain then cross-checks the read map and skips this id.
      No-op when group reporting is off or targetId is null.
      Parameters:
      targetId - native target id of the written group
      grouperProvisioningTargetNativeGroup - native object from the write response, or null when the write returned no usable body (then the drain bulk-reads it)
    • recordTargetNativeUserWrite

      public void recordTargetNativeUserWrite(String targetId, GrouperProvisioningTargetNativeUser grouperProvisioningTargetNativeUser)
      Entity-write sync-back hook; the user-axis mirror of recordTargetNativeGroupWrite(String, GrouperProvisioningTargetNativeGroup) (mark to-read, clear pending delete, drop stale rep, register if returned). No-op when entity reporting is off or targetId is null.
      Parameters:
      targetId - native target id of the written entity
      grouperProvisioningTargetNativeUser - native object from the write response, or null when the write returned no usable body (then the drain bulk-reads it)
    • recordTargetNativeMembershipInsert

      public void recordTargetNativeMembershipInsert(String targetGroupId, String targetUserId)
      Record a successful membership add (SCIM PATCH op=add, or any protocol's add-member write): put MultiKey(targetGroupId, targetUserId) in the native membership map. Last-write-wins on a duplicate key (re-adding an existing member is a harmless no-op). No-op when membership reporting is off or either id is null.
    • recordTargetNativeMembershipDelete

      public void recordTargetNativeMembershipDelete(String targetGroupId, String targetUserId)
      Record a successful membership remove (SCIM PATCH op=remove, or any protocol's remove-member write): drop MultiKey(targetGroupId, targetUserId) from the native membership map so the end-of-run flush deletes its grouper_prov_mship row. Idempotent. No-op when membership reporting is off or either id is null.
    • recordTargetNativeMembershipReplace

      public void recordTargetNativeMembershipReplace(String targetGroupId, Collection<String> targetUserIds)
      Record a successful full-members replace for one group (SCIM PATCH op=replace on members): the group's membership set in the mirror becomes exactly targetUserIds. Every existing entry for the group is dropped, then one entry per id is added. A null/empty id list is valid and clears the group's memberships. No-op when membership reporting is off or targetGroupId is null.