java.lang.Object
colesico.framework.profile.DefaultProfileKit
- All Implemented Interfaces:
ProfileKit
Profile kit default implementation.
Extend this class to customize the profile read/write control.
(For example to enrich the profile from the database)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final javax.inject.Provider<DataPort>protected final colesico.framework.ioc.scope.ThreadScope -
Constructor Summary
ConstructorsConstructorDescriptionDefaultProfileKit(colesico.framework.ioc.scope.ThreadScope threadScope, javax.inject.Provider<DataPort> dataPortProv) -
Method Summary
Modifier and TypeMethodDescriptionprotected DefaultProfileKit.InputControlResultcontrolInputProfile(Profile profile) Controls the profile read from the data port.protected ProfilecontrolOutputProfile(Profile profile) Controls the profile before write to the data port.final <P extends Profile>
PReturns the valid profile associated with the current process if the profile is present.final voidsetProfile(Profile profile) Associate the profile with the current process.
-
Field Details
-
threadScope
protected final colesico.framework.ioc.scope.ThreadScope threadScope -
dataPortProv
-
-
Constructor Details
-
DefaultProfileKit
public DefaultProfileKit(colesico.framework.ioc.scope.ThreadScope threadScope, javax.inject.Provider<DataPort> dataPortProv)
-
-
Method Details
-
controlInputProfile
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
-
controlOutputProfile
Controls the profile before write to the data port. Override this method to get more specific control. -
getProfile
Description copied from interface:ProfileKitReturns 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 profileCommonProfileCreatorMethod 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:
getProfilein interfaceProfileKit
-
setProfile
Description copied from interface:ProfileKitAssociate 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:
setProfilein interfaceProfileKit
-