All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jpattern.core.command.UnconditionalCommandChainStrategy Maven / Gradle / Ivy

There is a newer version: 3.6.2
Show newest version
package com.jpattern.core.command;

import com.jpattern.shared.result.IResult;

/**
 * 
 * When this strategy is used every command is intended like a separated entity.
 * The entire chain of command is executed even if some commands end with errors.
 * Due to the independence of the commands, when this strategy is used and an error is thrown by a command
 * the chain is not rollbacked. 
 * 
 * @author Francesco Cina'
 *
 * 11/set/2011
 */
public class UnconditionalCommandChainStrategy implements ICommandChainStrategy {

	private static final long serialVersionUID = 1L;

	@Override
	public boolean executeNext(IResult result) {
		return true;
	}

	@Override
	public boolean executeRollback() {
		return false;
	}
	
	@Override
	public void doExec(ICommand command, ACommandResult commandResult, boolean catchRuntimeException, ICommandExecutor commandExecutor) {
		command.doExec(catchRuntimeException, commandResult);		
	}

	@Override
	public void doRollback(ICommand command, ACommandResult commandResult, boolean catchRuntimeException, ICommandExecutor commandExecutor) {
		command.doRollback(catchRuntimeException, commandResult);	
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy