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

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

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

import com.jpattern.core.command.ACommand;
import com.jpattern.core.command.ICommandResult;


/**
 * 
 * @author Francesco Cina'
 *
 * 23 Apr 2011
 */
public class ManagedChainStrategy implements IChainStrategy {

	@Override
	public void globalExecEnd(ACommand aCommand, ICommandResult result) {
		if (result.isValid()) {
			result.removeAllCommands();
		} else {
			aCommand.doGlobalRollback(result);
		}
	}

	@Override
	public void localExecEnd(ACommand aCommand, ICommandResult localResult, ICommandResult globalResult) {
		if (!localResult.isValid()) {
			globalResult.getErrorMessages().addAll(localResult.getErrorMessages());
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy