com.jpattern.core.command.ManagedChainStrategy Maven / Gradle / Ivy
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