@Override public Boolean execute(Environment environment) throws Exception { final Class<?> replayCommandClass = Class.forName("org.ow2.bonita.facade.runtime.command.ReplayCommand"); @SuppressWarnings("unchecked") final Constructor<Command<Boolean>> replayCommandConstructor = (Constructor<Command<Boolean>>) replayCommandClass.getConstructor(ActivityInstanceUUID.class); final Command<Boolean> replayCommand = (Command<Boolean>) replayCommandConstructor.newInstance(activityInstanceUUID); return replayCommand.execute(environment); } }
@Override public Boolean execute(Environment environment) throws Exception { final Class<?> commandClass = Class.forName("org.ow2.bonita.facade.runtime.command.SkipExecutingActivityCommand"); @SuppressWarnings("unchecked") final Constructor<Command<Boolean>> commandConstructor = (Constructor<Command<Boolean>>) commandClass.getConstructor(ActivityInstanceUUID.class); final Command<Boolean> command = (Command<Boolean>) commandConstructor.newInstance(activityInstanceUUID); return command.execute(environment); } }
@Override public Boolean execute(Environment environment) throws Exception { final Class<?> commandClass = Class.forName("org.ow2.bonita.facade.runtime.command.SkipExecutingActivityCommand"); @SuppressWarnings("unchecked") final Constructor<Command<Boolean>> commandConstructor = (Constructor<Command<Boolean>>) commandClass.getConstructor(ActivityInstanceUUID.class); final Command<Boolean> command = (Command<Boolean>) commandConstructor.newInstance(activityInstanceUUID); return command.execute(environment); } }
@Override public Boolean execute(Environment environment) throws Exception { final Class<?> replayCommandClass = Class.forName("org.ow2.bonita.facade.runtime.command.ReplayCommand"); @SuppressWarnings("unchecked") final Constructor<Command<Boolean>> replayCommandConstructor = (Constructor<Command<Boolean>>) replayCommandClass.getConstructor(ActivityInstanceUUID.class); final Command<Boolean> replayCommand = (Command<Boolean>) replayCommandConstructor.newInstance(activityInstanceUUID); return replayCommand.execute(environment); } }
@Override public Void execute(final Environment environment) throws Exception { final Class<?> commandClass = Class.forName("org.ow2.bonita.facade.runtime.command.ServerWebExecuteTask"); @SuppressWarnings("unchecked") final Constructor<Command<Void>> commandConstructor = (Constructor<Command<Void>>) commandClass.getConstructor(ActivityInstanceUUID.class, Map.class, Map.class, Map.class, Set.class, List.class, Map.class); final Command<Void> command = commandConstructor.newInstance(taskUUID, processVariables, activityVariables, undefinedVariables, attachments, scriptsToExecute, scriptContext); command.execute(environment); return null; }
@Override public Void execute(final Environment environment) throws Exception { final Class<?> commandClass = Class.forName("org.ow2.bonita.facade.runtime.command.ServerWebExecuteTask"); @SuppressWarnings("unchecked") final Constructor<Command<Void>> commandConstructor = (Constructor<Command<Void>>) commandClass.getConstructor(ActivityInstanceUUID.class, Map.class, Map.class, Map.class, Set.class, List.class, Map.class); final Command<Void> command = commandConstructor.newInstance(taskUUID, processVariables, activityVariables, undefinedVariables, attachments, scriptsToExecute, scriptContext); command.execute(environment); return null; }
public T execute(Environment environment) throws Exception { return getCommand().execute(environment); }
public T execute(Environment environment) throws Exception { return getCommand().execute(environment); }
@Override public Void execute(final Environment environment) throws Exception { for (final ProcessDefinitionUUID processUUID : processUUIDs) { deleteAttachments(processUUID); } if (deleteAttachments) { try { final Class<?> serverCommandClass = Class.forName("org.ow2.bonita.util.ServerWebDeleteDocumentsOfProcessesCommand"); final Command<?> serverCommand = (Command<?>) serverCommandClass.getConstructor(Collection.class).newInstance(processUUIDs); serverCommand.execute(null); } catch (final Exception e) { LOGGER.log(Level.SEVERE, "Unable to delete folder of the process definition on document server", e); } } return null; }
@Override public Void execute(final Environment environment) throws Exception { for (final ProcessDefinitionUUID processUUID : processUUIDs) { deleteAttachments(processUUID); } if (deleteAttachments) { try { final Class<?> serverCommandClass = Class.forName("org.ow2.bonita.util.ServerWebDeleteDocumentsOfProcessesCommand"); final Command<?> serverCommand = (Command<?>) serverCommandClass.getConstructor(Collection.class).newInstance(processUUIDs); serverCommand.execute(null); } catch (final Exception e) { LOGGER.log(Level.SEVERE, "Unable to delete folder of the process definition on document server", e); } } return null; }
public <T> T execute(Command<T> command) { Environment environment = Environment.getCurrent(); try { return command.execute(environment); } catch (RuntimeException e) { if (LOG.isLoggable(Level.SEVERE)) { LOG.severe("exception while executing command " + command + ": " + e.getMessage()); } throw e; } catch (Exception e) { if (LOG.isLoggable(Level.SEVERE)) { LOG.severe("exception while executing command " + command + ": " + e.getMessage()); } String message = ExceptionManager.getInstance().getFullMessage("bp_DCS_1 ", command); throw new BonitaRuntimeException(message, e, DefaultCommandService.class.getName()); } } }
@Override @SuppressWarnings("unchecked") public T execute(final Environment environment) throws Exception { try { final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Executing a command in remote mode. Looking for Class: " + this.className + ". Current ClassLoader: " + currentClassLoader); } Class.forName(this.className, true, currentClassLoader); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Executing a command in remote mode. Class: " + this.className + " found."); } final Command<T> command = (Command<T>) Misc.deserialize(this.serializedCommand); // execute command if (LOG.isLoggable(Level.FINE)) { LOG.fine("Executing a command in remote mode. Executing deserialized command: " + command); } return command.execute(environment); } catch (final ClassNotFoundException e) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Executing a command in remote mode. Class: " + this.className + " not found."); } final String message = ExceptionManager.getInstance().getFullMessage("baa_SC_1", this.className); throw new BonitaRuntimeException(message, e); } }
@Override @SuppressWarnings("unchecked") public T execute(final Environment environment) throws Exception { try { final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Executing a command in remote mode. Looking for Class: " + this.className + ". Current ClassLoader: " + currentClassLoader); } Class.forName(this.className, true, currentClassLoader); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Executing a command in remote mode. Class: " + this.className + " found."); } final Command<T> command = (Command<T>) Misc.deserialize(this.serializedCommand); // execute command if (LOG.isLoggable(Level.FINE)) { LOG.fine("Executing a command in remote mode. Executing deserialized command: " + command); } return command.execute(environment); } catch (final ClassNotFoundException e) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Executing a command in remote mode. Class: " + this.className + " not found."); } final String message = ExceptionManager.getInstance().getFullMessage("baa_SC_1", this.className); throw new BonitaRuntimeException(message, e); } }
return command.execute(Environment.getCurrent()); } finally { Thread.currentThread().setContextClassLoader(contextClassLoader);