Class DefaultProfileKit

java.lang.Object
colesico.framework.profile.DefaultProfileKit
All Implemented Interfaces:
ProfileKit

public class DefaultProfileKit extends Object implements ProfileKit
Profile kit default implementation. Extend this class to customize the profile read/write control. (For example to enrich the profile from the database)
  • Field Details

    • threadScope

      protected final colesico.framework.ioc.scope.ThreadScope threadScope
    • dataPortProv

      protected final javax.inject.Provider<DataPort> dataPortProv
  • Constructor Details

    • DefaultProfileKit

      public DefaultProfileKit(colesico.framework.ioc.scope.ThreadScope threadScope, javax.inject.Provider<DataPort> dataPortProv)
  • Method Details

    • isInputControlRequired

      protected boolean isInputControlRequired(Profile profile)
    • controlInputProfile

      protected DefaultProfileKit.InputControlResult controlInputProfile(Profile profile)
      Controls the profile read from the data port. Override this method to get more specific control. This method is used to fine grained control of profile: check validity, enrich with extra data, e.t.c.
      Returns:
      Valid profile or null
    • isOutputControlRequired

      protected boolean isOutputControlRequired(Profile profile)
    • controlOutputProfile

      protected Profile controlOutputProfile(Profile profile)
      Controls the profile before write to the data port. Override this method to get more specific control.
    • getProfile

      public final <P extends Profile> P getProfile()
      Description copied from interface: ProfileKit
      Returns the valid profile associated with the current process if the profile is present. If it is impossible to determine current user profile method returns common profile CommonProfileCreator Method must retrieve the profile from any source (eg from the data port) then validate, enrich (if needed) and cache it for a subsequent quick return within the current thread. Can throws an exception in case the profile is inconsistent.
      Specified by:
      getProfile in interface ProfileKit
    • setProfile

      public final void setProfile(Profile profile)
      Description copied from interface: ProfileKit
      Associate the profile with the current process. The method can store the principal to any source (eg write it to the data port to store it on remote client) in order to return it on subsequent requests.
      Specified by:
      setProfile in interface ProfileKit