Class SimulationActionProcessProcessor
- java.lang.Object
-
- org.silverpeas.core.process.annotation.SimulationActionProcessProcessor
-
@Bean @Named public class SimulationActionProcessProcessor extends Object
Centralizing the management of a simulation of actions performed by a caller.It can be used directly into a treatment.
It is also used by
SimulationActionProcessAnnotationInterceptor
mechanism.- Author:
- silveryocha
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SimulationActionProcessProcessor.Action
static class
SimulationActionProcessProcessor.Context
static class
SimulationActionProcessProcessor.Lister
static class
SimulationActionProcessProcessor.SourceSupplier
static class
SimulationActionProcessProcessor.TargetSupplier
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimulationActionProcessProcessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
execute(Process<T> process)
This method performs first the simulation against the defined context, and then execute the given process.SimulationActionProcessProcessor
fromMethod(Method caller)
Permits to indicate the method that calls the simulation.static SimulationActionProcessProcessor
get()
boolean
isSimulationProcessPerforming()
SimulationActionProcessProcessor
setLanguage(Supplier<String> language)
Sets manually a language which will be used to format the messages.SimulationActionProcessProcessor.SourceSupplier
withContext(Consumer<SimulationActionProcessProcessor.SourceSupplier.Sources> consumer)
-
-
-
Method Detail
-
get
public static SimulationActionProcessProcessor get()
- See Also:
andWithContext(Consumer)
-
isSimulationProcessPerforming
public boolean isSimulationProcessPerforming()
- Returns:
- true if a simulation is performing
-
withContext
public SimulationActionProcessProcessor.SourceSupplier withContext(Consumer<SimulationActionProcessProcessor.SourceSupplier.Sources> consumer)
- See Also:
andWithContext(Consumer)
-
execute
public <T> T execute(Process<T> process)
This method performs first the simulation against the defined context, and then execute the given process.If an error occurred, one of the transversal exceptions is thrown and the process is not be performed.
If the execution is performed into the context of an existing simulation process, then the given process is executed directly without performing any simulation.
-
setLanguage
public SimulationActionProcessProcessor setLanguage(Supplier<String> language)
Sets manually a language which will be used to format the messages.If not set, then the one of
User.getCurrentRequester()
is taken. If no user, thenDisplayI18NHelper.getDefaultLanguage()
is taken.- Parameters:
language
- a language.- Returns:
- itself.
-
fromMethod
public SimulationActionProcessProcessor fromMethod(Method caller)
Permits to indicate the method that calls the simulation.- Parameters:
caller
- aMethod
instance.- Returns:
- itself.
-
-