Class InterfolioUser

java.lang.Object
edu.internet2.middleware.grouper.app.interfolio.InterfolioUser

public class InterfolioUser extends Object
Model object for an Interfolio user, used to back the mock service. Interfolio identifies a person by two ids: the stable cross-product "pid" (returned by the IAM create and the byc users/search), and a byc-internal "id". The provisioner keys on the pid. The user also carries the immutable institution_user_id (UID/PennKey), saml_id (pennkey@upenn.edu), user_type, name and email, plus two booleans tracking whether the user is subscribed to the RPT and FS products (toggled by the byc subscribe/unsubscribe endpoints).
  • Constructor Details

    • InterfolioUser

      public InterfolioUser()
  • Method Details

    • getPid

      public String getPid()
    • setPid

      public void setPid(String pid)
    • getBycId

      public String getBycId()
    • setBycId

      public void setBycId(String bycId)
    • getInstitutionUserId

      public String getInstitutionUserId()
    • setInstitutionUserId

      public void setInstitutionUserId(String institutionUserId)
    • getSamlId

      public String getSamlId()
    • setSamlId

      public void setSamlId(String samlId)
    • getUserType

      public String getUserType()
    • setUserType

      public void setUserType(String userType)
    • getFirstName

      public String getFirstName()
    • setFirstName

      public void setFirstName(String firstName)
    • getLastName

      public String getLastName()
    • setLastName

      public void setLastName(String lastName)
    • getEmail

      public String getEmail()
    • setEmail

      public void setEmail(String email)
    • getRpt

      public String getRpt()
    • setRpt

      public void setRpt(String rpt)
    • getFs

      public String getFs()
    • setFs

      public void setFs(String fs)
    • isSubscribedRpt

      public boolean isSubscribedRpt()
    • setSubscribedRpt

      public void setSubscribedRpt(boolean subscribed)
    • isSubscribedFs

      public boolean isSubscribedFs()
    • setSubscribedFs

      public void setSubscribedFs(boolean subscribed)
    • assignAttributesFromIamJson

      public void assignAttributesFromIamJson(com.fasterxml.jackson.databind.JsonNode jsonNode)
      Populate the user's account attributes from a JSON body (the IAM create/update body).
      Parameters:
      jsonNode - parsed request body
    • toIamUserJson

      public com.fasterxml.jackson.databind.node.ObjectNode toIamUserJson()
      The IAM create/update response shape: { pid, first_name, last_name, email, institution_user_id, user_type }. Note saml_id is intentionally not echoed (matches the real API).
      Returns:
      the IAM user JSON
    • toSearchResultJson

      public com.fasterxml.jackson.databind.node.ObjectNode toSearchResultJson()
      The byc users/search result shape for one user. Includes id and pid, name, email, and the (empty) role/unit/title arrays the real endpoint returns; does NOT include institution_user_id or saml_id (matches the real API).
      Returns:
      the search-result JSON
    • matchesSearchTerm

      public boolean matchesSearchTerm(String searchTerm)
      Does this user match the given byc search term? A blank term matches everyone (the real endpoint returns the whole roster when no term is passed); otherwise match (case-insensitive substring) against email, institution_user_id, first or last name.
      Parameters:
      searchTerm - the term, possibly blank/null
      Returns:
      true if the user matches
    • toProvisioningEntity

      public ProvisioningEntity toProvisioningEntity()
      Convert to a Grouper provisioning entity. The id is the pid; the account attributes become target entity attributes. Note: when built from a byc users/search result, institution_user_id / saml_id / user_type are not populated (that endpoint omits them).
      Returns:
      the provisioning entity
    • fromProvisioningEntity

      public static InterfolioUser fromProvisioningEntity(ProvisioningEntity targetEntity)
      Build from a Grouper provisioning entity (the target entity attributes).
      Parameters:
      targetEntity - the provisioning entity
      Returns:
      the Interfolio user
    • createTableInterfolioUser

      public static void createTableInterfolioUser(DdlVersionBean ddlVersionBean, Database database)
      DDL for the mock table.
      Parameters:
      ddlVersionBean - ddl version bean
      database - database
    • toString

      public String toString()
      Overrides:
      toString in class Object