Class CommandExecutingJob<EventAtom>
- java.lang.Object
-
- org.eclipse.viatra.transformation.evm.api.Job<EventAtom>
-
- org.eclipse.viatra.transformation.evm.transactions.specific.job.CommandExecutingJob<EventAtom>
-
public abstract class CommandExecutingJob<EventAtom> extends Job<EventAtom>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCommandExecutingJob.JobExecutionHelperHelper class for constructing the job execution from individual commands.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOMMAND_EXECUTING_JOB_HELPERstatic java.lang.StringEDITING_DOMAIN
-
Constructor Summary
Constructors Constructor Description CommandExecutingJob(ActivationState enablingState, EventAtomEditingDomainProvider<EventAtom> provider)Create a new job that supports execution through commands by finding the editing domain using the given provider and giving aCommandExecutingJob.JobExecutionHelperfor providing the execution with a way to easily create commands and execute them.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidexecute(Activation<? extends EventAtom> activation, Context context)Executes the action on the activation using the supplied context.protected abstract voidexecuteCommands(CommandExecutingJob.JobExecutionHelper executionHelper)Use the passed editing domain to instantiate and append commands to the suppliedCommandExecutingJob.JobExecutionHelper.protected org.eclipse.emf.edit.domain.EditingDomainfindEditingDomain(Activation<? extends EventAtom> activation, Context context)This method is used to find a target that can be used for getting theEditingDomain.protected voidhandleError(Activation<? extends EventAtom> activation, java.lang.Exception exception, Context context)Called if theJob.execute(org.eclipse.viatra.transformation.evm.api.Activation<? extends EventAtom>, org.eclipse.viatra.transformation.evm.api.Context)method has thrown an exception to allow jobs to handle their own errors.protected abstract voidhandleExecutableCommandError(CommandExecutingJob.JobExecutionHelper executionHelper, java.lang.Exception exception)This method will be called if any error happens during the execution.-
Methods inherited from class org.eclipse.viatra.transformation.evm.api.Job
getActivationState
-
-
-
-
Field Detail
-
COMMAND_EXECUTING_JOB_HELPER
public static final java.lang.String COMMAND_EXECUTING_JOB_HELPER
- See Also:
- Constant Field Values
-
EDITING_DOMAIN
public static final java.lang.String EDITING_DOMAIN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CommandExecutingJob
public CommandExecutingJob(ActivationState enablingState, EventAtomEditingDomainProvider<EventAtom> provider)
Create a new job that supports execution through commands by finding the editing domain using the given provider and giving aCommandExecutingJob.JobExecutionHelperfor providing the execution with a way to easily create commands and execute them.- Parameters:
enablingState-provider-
-
-
Method Detail
-
execute
protected void execute(Activation<? extends EventAtom> activation, Context context)
Description copied from class:JobExecutes the action on the activation using the supplied context.
-
handleError
protected void handleError(Activation<? extends EventAtom> activation, java.lang.Exception exception, Context context)
Description copied from class:JobCalled if theJob.execute(org.eclipse.viatra.transformation.evm.api.Activation<? extends EventAtom>, org.eclipse.viatra.transformation.evm.api.Context)method has thrown an exception to allow jobs to handle their own errors.- Specified by:
handleErrorin classJob<EventAtom>
-
executeCommands
protected abstract void executeCommands(CommandExecutingJob.JobExecutionHelper executionHelper)
Use the passed editing domain to instantiate and append commands to the suppliedCommandExecutingJob.JobExecutionHelper.- Parameters:
executionHelper-
-
handleExecutableCommandError
protected abstract void handleExecutableCommandError(CommandExecutingJob.JobExecutionHelper executionHelper, java.lang.Exception exception)
This method will be called if any error happens during the execution.- Parameters:
executionHelper-exception-
-
findEditingDomain
protected org.eclipse.emf.edit.domain.EditingDomain findEditingDomain(Activation<? extends EventAtom> activation, Context context)
This method is used to find a target that can be used for getting theEditingDomain. It tries to retrieve the domain from the context, otherwise it tries to find an EObject parameter in the event atom of the activation.- Parameters:
activation-context-- Returns:
- the object to be used for finding the domain
-
-