Class ReadAccessHelperImpl

java.lang.Object
dev.dsf.fhir.authorization.read.ReadAccessHelperImpl
All Implemented Interfaces:
ReadAccessHelper

public class ReadAccessHelperImpl extends Object implements ReadAccessHelper
  • Constructor Details

    • ReadAccessHelperImpl

      public ReadAccessHelperImpl()
  • Method Details

    • addLocal

      public <R extends org.hl7.fhir.r4.model.Resource> R addLocal(R resource)
      Description copied from interface: ReadAccessHelper
      Adds LOCAL tag. Removes ALL tag if present.
      Specified by:
      addLocal in interface ReadAccessHelper
      Type Parameters:
      R - the resource type
      Parameters:
      resource - may be null
      Returns:
      null if given resource is null
      See Also:
    • addOrganization

      public <R extends org.hl7.fhir.r4.model.Resource> R addOrganization(R resource, String organizationIdentifier)
      Description copied from interface: ReadAccessHelper
      Adds ORGANIZATION tag for the given organization. Adds LOCAL tag if not present, removes ALL tag if present.
      Specified by:
      addOrganization in interface ReadAccessHelper
      Type Parameters:
      R - the resource type
      Parameters:
      resource - may be null
      organizationIdentifier - not null
      Returns:
      null if given resource is null
      See Also:
    • addOrganization

      public <R extends org.hl7.fhir.r4.model.Resource> R addOrganization(R resource, org.hl7.fhir.r4.model.Organization organization)
      Description copied from interface: ReadAccessHelper
      Adds ORGANIZATION tag for the given organization. Adds LOCAL tag if not present, removes ALL tag if present.
      Specified by:
      addOrganization in interface ReadAccessHelper
      Type Parameters:
      R - the resource type
      Parameters:
      resource - may be null
      organization - not null
      Returns:
      null if given resource is null
      See Also:
    • addRole

      public <R extends org.hl7.fhir.r4.model.Resource> R addRole(R resource, String consortiumIdentifier, String roleSystem, String roleCode)
      Description copied from interface: ReadAccessHelper
      Adds ROLE tag for the given affiliation. Adds LOCAL tag if not present, removes ALL tag if present.
      Specified by:
      addRole in interface ReadAccessHelper
      Type Parameters:
      R - the resource type
      Parameters:
      resource - may be null
      consortiumIdentifier - not null
      roleSystem - not null
      roleCode - not null
      Returns:
      null if given resource is null
      See Also:
    • addRole

      public <R extends org.hl7.fhir.r4.model.Resource> R addRole(R resource, org.hl7.fhir.r4.model.OrganizationAffiliation affiliation)
      Description copied from interface: ReadAccessHelper
      Adds ROLE tag for the given affiliation. Adds LOCAL tag if not present, removes ALL tag if present.
      Specified by:
      addRole in interface ReadAccessHelper
      Type Parameters:
      R - the resource type
      Parameters:
      resource - may be null
      affiliation - not null
      Returns:
      null if given resource is null
      See Also:
    • addAll

      public <R extends org.hl7.fhir.r4.model.Resource> R addAll(R resource)
      Description copied from interface: ReadAccessHelper
      Adds All tag. Removes LOCAL, ORGANIZATION and ROLE tags if present.
      Specified by:
      addAll in interface ReadAccessHelper
      Type Parameters:
      R - the resource type
      Parameters:
      resource - may be null
      Returns:
      null if given resource is null
      See Also:
    • hasLocal

      public boolean hasLocal(org.hl7.fhir.r4.model.Resource resource)
      Specified by:
      hasLocal in interface ReadAccessHelper
    • hasOrganization

      public boolean hasOrganization(org.hl7.fhir.r4.model.Resource resource, String organizationIdentifier)
      Specified by:
      hasOrganization in interface ReadAccessHelper
    • hasOrganization

      public boolean hasOrganization(org.hl7.fhir.r4.model.Resource resource, org.hl7.fhir.r4.model.Organization organization)
      Specified by:
      hasOrganization in interface ReadAccessHelper
    • hasAnyOrganization

      public boolean hasAnyOrganization(org.hl7.fhir.r4.model.Resource resource)
      Specified by:
      hasAnyOrganization in interface ReadAccessHelper
    • hasRole

      public boolean hasRole(org.hl7.fhir.r4.model.Resource resource, String consortiumIdentifier, String roleSystem, String roleCode)
      Specified by:
      hasRole in interface ReadAccessHelper
    • hasRole

      public boolean hasRole(org.hl7.fhir.r4.model.Resource resource, List<org.hl7.fhir.r4.model.OrganizationAffiliation> affiliations)
      Specified by:
      hasRole in interface ReadAccessHelper
    • hasRole

      public boolean hasRole(org.hl7.fhir.r4.model.Resource resource, org.hl7.fhir.r4.model.OrganizationAffiliation affiliation)
      Specified by:
      hasRole in interface ReadAccessHelper
    • hasAnyRole

      public boolean hasAnyRole(org.hl7.fhir.r4.model.Resource resource)
      Specified by:
      hasAnyRole in interface ReadAccessHelper
    • hasAll

      public boolean hasAll(org.hl7.fhir.r4.model.Resource resource)
      Specified by:
      hasAll in interface ReadAccessHelper
    • isValid

      public boolean isValid(org.hl7.fhir.r4.model.Resource resource)
      Description copied from interface: ReadAccessHelper
      Resource with access tags valid if:
      1 LOCAL tag and n {ORGANIZATION, ROLE} tags (n >= 0)
      or
      1 ALL tag

      All tags {LOCAL, ORGANIZATION, ROLE, ALL} valid

      Does not check if referenced organizations or roles exist
      Specified by:
      isValid in interface ReadAccessHelper
      Parameters:
      resource - may be null
      Returns:
      false if given resource is null or resource not valid
    • isValid

      public boolean isValid(org.hl7.fhir.r4.model.Resource resource, Predicate<org.hl7.fhir.r4.model.Identifier> organizationWithIdentifierExists, Predicate<org.hl7.fhir.r4.model.Coding> roleExists)
      Description copied from interface: ReadAccessHelper
      Resource with access tags valid if:
      1 LOCAL tag and n {ORGANIZATION, ROLE} tags (n >= 0)
      or
      1 ALL tag

      All tags {LOCAL, ORGANIZATION, ROLE, ALL} valid
      Specified by:
      isValid in interface ReadAccessHelper
      Parameters:
      resource - may be null
      organizationWithIdentifierExists - not null
      roleExists - not null
      Returns:
      false if given resource is null or resource not valid