Package org.eclipse.viatra.transformation.evm.transactions.specific.job

## 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
    --- | --- | ---
    `class` | `CommandExecutingJob.JobExecutionHelper` | Helper class for constructing the job execution from individual commands.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `COMMAND_EXECUTING_JOB_HELPER` |
    `static java.lang.String` | `EDITING_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 a `CommandExecutingJob.JobExecutionHelper` for 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 void` | `execute​(Activation<? extends EventAtom> activation, Context context)` | Executes the action on the activation using the supplied context.
    `protected abstract void` | `executeCommands​(CommandExecutingJob.JobExecutionHelper executionHelper)` | Use the passed editing domain to instantiate and append commands to the supplied `CommandExecutingJob.JobExecutionHelper`.
    `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 the `EditingDomain`.
    `protected void` | `handleError​(Activation<? extends EventAtom> activation, java.lang.Exception exception, Context context)` | Called if the `Job.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 void` | `handleExecutableCommandError​(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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 a `CommandExecutingJob.JobExecutionHelper` for 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: `Job`
      Executes the action on the activation using the supplied context.
      Specified by:
        `execute` in class `Job<EventAtom>`

    - #### handleError

          protected void handleError​(Activation<? extends EventAtom> activation,
                                     java.lang.Exception exception,
                                     Context context)

      Description copied from class: `Job`
      Called if the `Job.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:
        `handleError` in class `Job<EventAtom>`

    - #### executeCommands

          protected abstract void executeCommands​(CommandExecutingJob.JobExecutionHelper executionHelper)

      Use the passed editing domain to instantiate and append commands to the supplied `CommandExecutingJob.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 the `EditingDomain`. 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