Class InjectableValidationContext
- java.lang.Object
-
- de.xima.fc.workflow.processor.logic.validation.InjectableValidationContext
-
- All Implemented Interfaces:
IBaseEnvironmentData,IWorkflowValidationEnvironmentData,IBaseWorkflowEnvironmentData,IWorkflowLocalBeanValidationContext,IWorkflowLocalValidationContext,IWorkflowValidationContext
@Default @ApplicationScoped public class InjectableValidationContext extends Object implements IWorkflowLocalBeanValidationContext
AIWorkflowLocalHandlerValidationContextthat can be injected via dependency injection. Can be used to access the context during bean validation. Retrieves the context in several ways depending on how bean validation was initiated.During workflow validation via
IWorkflowValidator, the current validation context is set by the workflow validator when validation starts and removed when it ends.During JSF bean validation, the context is read from the workflow provider bean via the
FacesContext.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description InjectableValidationContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> TassociateValue(Object key, Function<IWorkflowLocalValidationContext,T> supplier)Associates the given value for the duration of the workflow validation process.MandantgetClient()ElementKeygetCurrentElementKey()IEntityContextgetEntityContext()LocalegetLocale()ProjektgetProject()IWorkflowProvidergetProvider()BenutzergetUser()Deprecated.UsegetUserModel()instead.IUsergetUserModel()WorkflowVersiongetWorkflowVersion()IWorkflowElementValidationResultBuilderresultBuilder()static voidsetBeanValidationContext(Class<? extends IWorkflowValidationContext> context)static voidsetCurrentValidationContext(DefaultWorkflowValidationContext context)Sets the given context for the current thread.
-
-
-
Method Detail
-
associateValue
public <T> T associateValue(Object key, Function<IWorkflowLocalValidationContext,T> supplier)
Description copied from interface:IWorkflowLocalValidationContextAssociates the given value for the duration of the workflow validation process. Once validation is done, the values are discarded.- Specified by:
associateValuein interfaceIWorkflowLocalValidationContext- Type Parameters:
T- Type of the associate value.- Parameters:
key- Key for the association.supplier- Supplier that produces the value when not yet present.- Returns:
- The associated value.
-
getClient
public Mandant getClient()
- Specified by:
getClientin interfaceIBaseEnvironmentData- Returns:
- The
Mandantof the current context.
-
getCurrentElementKey
public ElementKey getCurrentElementKey()
- Specified by:
getCurrentElementKeyin interfaceIWorkflowLocalBeanValidationContext- Returns:
- The
ElementKeyof the current workflow node or trigger that is currently being checked in the current workflow process.nullwhen no such element key exists.
-
getEntityContext
public IEntityContext getEntityContext()
- Specified by:
getEntityContextin interfaceIBaseEnvironmentData- Returns:
- The current entity context that may be used for database interactions.
-
getLocale
public Locale getLocale()
- Specified by:
getLocalein interfaceIBaseEnvironmentData- Returns:
- The locale to use for locale-sensitive actions.
-
getProject
public Projekt getProject()
- Specified by:
getProjectin interfaceIBaseWorkflowEnvironmentData- Returns:
- The current project to which the workflow belongs.
-
getProvider
public IWorkflowProvider getProvider()
- Specified by:
getProviderin interfaceIWorkflowValidationContext- Returns:
- The provider for accessing various contextual data, such as a list of all users or user groups.
-
getUserModel
public IUser getUserModel()
- Specified by:
getUserModelin interfaceIBaseEnvironmentData- Returns:
- The user of the active context that should be used for protocol entries etc.
-
getWorkflowVersion
public WorkflowVersion getWorkflowVersion()
- Specified by:
getWorkflowVersionin interfaceIBaseWorkflowEnvironmentData- Returns:
- The current workflow version that is being validated.
-
resultBuilder
public IWorkflowElementValidationResultBuilder resultBuilder()
- Specified by:
resultBuilderin interfaceIWorkflowLocalValidationContext- Returns:
- Builder for creating the result that needs to be returned by
IElementHandler#validateLocal. This is provided for convenience, you can also create your own implementation ofIWorkflowElementValidationResult.
-
getUser
@Deprecated public Benutzer getUser()
Deprecated.UsegetUserModel()instead.- Specified by:
getUserin interfaceIBaseEnvironmentData- Returns:
- The user of the active context that should be used for protocol entries etc.
-
setBeanValidationContext
public static void setBeanValidationContext(Class<? extends IWorkflowValidationContext> context)
- Parameters:
context- The bean class to use when performing a bean validation via JSF. The validation context attempts to retrieve a bean of the given class from the current thread-local faces context.
-
setCurrentValidationContext
public static void setCurrentValidationContext(DefaultWorkflowValidationContext context)
Sets the given context for the current thread. Multiple threads may call this method with different contexts. When set, this context is used. When not set, attempts to find the bean validation context for the class set bysetBeanValidationContext(Class).- Parameters:
context- Validation context to use.
-
-