Class FreshRequesterProvisioningTargetNativeSync

java.lang.Object
edu.internet2.middleware.grouper.app.provisioning.GrouperProvisioningTargetNativeSync
edu.internet2.middleware.grouper.app.freshServiceRequester.FreshRequesterProvisioningTargetNativeSync

public class FreshRequesterProvisioningTargetNativeSync extends GrouperProvisioningTargetNativeSync
FreshServiceRequester-specific GrouperProvisioningTargetNativeSync: builds native target reporting beans for sync-back to the generic grouper_prov_group / grouper_prov_user tables.

Both groups and users are captured from the raw Freshservice JSON (JSON Pointer paths, like SCIM / Adobe / Google / Duo), hooked at the API-commands seam (FreshRequesterApiCommands.retrieveRequesterGroups/retrieveRequesterGroup and the retrieveRequesterUsers/retrieveRequesterUserById/retrieveRequesterUserByEmail/ retrieveRequesterUserByAttribute read methods) where the full per-object JSON node is in scope. This avoids losing any Freshservice field that the FreshRequesterGroup / FreshRequesterUser typed beans do not model; operators can capture any JSON field via nativeAttributesGroups / nativeAttributesEntities with a name and optional JSON-Pointer path.

The captured node is the inner object of the Freshservice envelope -- the read methods unwrap {"requester_group": {...}} / {"requester": {...}} / the elements of {"requester_groups":[...]} / {"requesters":[...]} -- so the default JSON pointers below are relative to that inner object (e.g. /name, /primary_email, and the target-id at /id), exactly the shape FreshRequesterGroup.fromJson / FreshRequesterUser.fromJson parse.

Memberships are still group-centric: derived from the per-group member listing as typed FreshRequesterUser beans during DAO translation (captureMembershipsForGroup(java.lang.String, java.util.List<edu.internet2.middleware.grouper.app.freshServiceRequester.FreshRequesterUser>)) -- the same situation as Adobe -- so only the group/user object capture is JSON-based; membership capture is unchanged.

  • Constructor Details

    • FreshRequesterProvisioningTargetNativeSync

      public FreshRequesterProvisioningTargetNativeSync()
  • Method Details

    • getDefaultNativeAttributeConfigsEntities

      protected List<GrouperProvisioningNativeAttributeConfig> getDefaultNativeAttributeConfigsEntities()
      Description copied from class: GrouperProvisioningTargetNativeSync
      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.
      Overrides:
      getDefaultNativeAttributeConfigsEntities in class GrouperProvisioningTargetNativeSync
    • getDefaultNativeAttributeConfigsGroups

      protected List<GrouperProvisioningNativeAttributeConfig> getDefaultNativeAttributeConfigsGroups()
      Description copied from class: GrouperProvisioningTargetNativeSync
      Per-protocol sensible-default attribute list for groups. See GrouperProvisioningTargetNativeSync.getDefaultNativeAttributeConfigsEntities().
      Overrides:
      getDefaultNativeAttributeConfigsGroups in class GrouperProvisioningTargetNativeSync
    • buildNativeGroupFromJson

      public GrouperProvisioningTargetNativeGroup buildNativeGroupFromJson(com.fasterxml.jackson.databind.JsonNode groupNode)
      Build a native group bean from the raw Freshservice requester-group JSON (inner of the requester_group/requester_groups envelope). targetId is read from /id -- the same field FreshRequesterGroup.fromJson(com.fasterxml.jackson.databind.JsonNode) used for the bean id; the attributes map is populated for each entry in GrouperProvisioningTargetNativeSync.effectiveNativeAttributeConfigsGroups() (operator-configured or default) by JSON Pointer. Returns null when the JSON is missing or has no id.
    • buildNativeUserFromJson

      public GrouperProvisioningTargetNativeUser buildNativeUserFromJson(com.fasterxml.jackson.databind.JsonNode userNode)
      Build a native user bean from the raw Freshservice requester JSON (inner of the requester/requesters envelope). targetId is read from /id -- the same field FreshRequesterUser.fromJson(com.fasterxml.jackson.databind.JsonNode) used for the bean id; the attributes map is populated for each entry in GrouperProvisioningTargetNativeSync.effectiveNativeAttributeConfigsEntities() (operator-configured or default) by JSON Pointer. Returns null when the JSON is missing or has no id.
    • captureGroupJson

      public void captureGroupJson(com.fasterxml.jackson.databind.JsonNode groupNode)
      Build + record a FreshRequester group from its raw JSON. No-op when sync-back is off or id-less.
    • captureUserJson

      public void captureUserJson(com.fasterxml.jackson.databind.JsonNode userNode)
      Build + record a FreshRequester user from its raw JSON. No-op when sync-back is off or id-less.
    • captureMembershipsForGroup

      public void captureMembershipsForGroup(String targetGroupId, List<FreshRequesterUser> members)
      Translate a list of FreshRequester users known to be members of targetGroupId into native membership beans, and record them. No-op when sync-back is off or input is empty.

      Unchanged by the move to raw-JSON object capture: Freshservice memberships are group-centric (the per-group member listing returns the member users), so they are still derived from the typed FreshRequesterUser beans the DAO already has in hand -- the same situation as Adobe's user-groups derivation.

    • captureGroupJsonFromCurrentProvisioner

      public static void captureGroupJsonFromCurrentProvisioner(com.fasterxml.jackson.databind.JsonNode groupNode)
      Capture a FreshRequester group (from its raw inner JSON) against the current provisioner's sync. No-op if there's no current provisioner or the active provisioner isn't a FreshRequester one. Called from the commands read seams (retrieveRequesterGroups/retrieveRequesterGroup) where the per-group JSON node is in scope.
    • captureUserJsonFromCurrentProvisioner

      public static void captureUserJsonFromCurrentProvisioner(com.fasterxml.jackson.databind.JsonNode userNode)
      Capture a FreshRequester user (from its raw inner JSON) against the current provisioner's sync. No-op if there's no current provisioner or the active provisioner isn't a FreshRequester one. Called from the commands read seams (retrieveRequesterUsers/retrieveRequesterUserById/ retrieveRequesterUserByEmail/retrieveRequesterUserByAttribute).
    • captureMembershipsForGroupForCurrentProvisioner

      public static void captureMembershipsForGroupForCurrentProvisioner(String targetGroupId, List<FreshRequesterUser> members)
      Capture memberships for the given target group id against the current provisioner's sync. Group-centric (see captureMembershipsForGroup(java.lang.String, java.util.List<edu.internet2.middleware.grouper.app.freshServiceRequester.FreshRequesterUser>)); unchanged by the JSON object-capture move.
    • captureMembershipInsertFromCurrentProvisioner

      public static void captureMembershipInsertFromCurrentProvisioner(String groupTargetId, String userTargetId)
      Write-track a successful FreshRequester membership add (addGroupMembership) against the current provisioner: record (groupTargetId, userTargetId) in the native membership map so the end-of-run flush keeps grouper_prov_mship current (GRP-7048 "memberships from sync-back cache" relies on this). Unlike groups/users, memberships are tracked purely from our own successful write here -- never re-read -- so this must be called only on the DAO success path. No-op out of cycle, for a non-FreshRequester provisioner, or when membership sync-back is off (the underlying recordTargetNativeMembershipInsert is guarded).
    • captureMembershipDeleteFromCurrentProvisioner

      public static void captureMembershipDeleteFromCurrentProvisioner(String groupTargetId, String userTargetId)
      Write-track a successful FreshRequester membership remove (removeGroupMembership) against the current provisioner: drop (groupTargetId, userTargetId) from the native membership map so the end-of-run flush deletes its grouper_prov_mship row. Must be called only on the DAO success path. No-op out of cycle, for a non-FreshRequester provisioner, or when membership sync-back is off (the underlying recordTargetNativeMembershipDelete is guarded).