cancel
Showing results for 
Search instead for 
Did you mean: 

Executing the custom command

shishirg
Champ in-the-making
Champ in-the-making
Hi,

I want to execute my custom command implementing Command interface.
But only way I can get hold of command executor is by type-casting the RuntimeService to RuntimeServiceImpl.

Is there any other way of getting command executor or executing the custom commands?

Thanks
Shishir
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
ManagementService now (as of 5.14) has a method:


/**
   * Executes a given command with the default {@link CommandConfig}.
   * @param command the command, cannot be null.
   * @return the result of command execution
   */
  <T> T executeCommand(Command<T> command);

  /**
   * Executes a given command with the specified {@link CommandConfig}.
   * @param config the command execution configuration, cannot be null.
   * @param command the command, cannot be null.
   * @return the result of command execution
   */
  <T> T executeCommand(CommandConfig config, Command<T> command);