// Path: src/main/java/org/holmes/OperationMode.java
// public enum OperationMode {
// 
// 	/**
// 	 * In GREEDY mode, HolmesEngine will evaluate all rules, collecting the
// 	 * violations, before throwing an exception.
// 	 */
// 	GREEDY {
// 
// 		@Override
// 		public ResultCollector getResultCollector() {
// 
// 			return new GreedyResultCollector();
// 		}
// 	},
// 
// 	/**
// 	 * In EAGER mode, HolmesEngine will evaluate all rules and stop at the first
// 	 * violation occurred, throwing an exception immediately.
// 	 */
// 	EAGER {
// 
// 		@Override
// 		public ResultCollector getResultCollector() {
// 
// 			return new EagerResultCollector();
// 		}
// 	},
// 
// 	/**
// 	 * In SILENT mode, HolmesEngine will evaluate all rules, collecting the
// 	 * violations. No ValidationException is thrown.
// 	 */
// 	SILENT {
// 
// 		@Override
// 		public ResultCollector getResultCollector() {
// 
// 			return new SilentResultCollector();
// 		}
// 	};
// 
// 	public abstract ResultCollector getResultCollector();
// 
// }
// 
// Path: src/main/java/org/holmes/ResultCollector.java
// public interface ResultCollector {
// 
// 	void onRuleViolation(RuleViolationException e, ValidationResult result) throws ValidationException;
// 
// 	void finish(ValidationResult result) throws ValidationException;
// }
// 
// Path: src/main/java/org/holmes/ValidationResult.java
// public class ValidationResult {
// 
// 	private final Set<String> violationsDescriptors;
// 	
// 	private final MessageResolver messageResolver;
// 
// 	private ValidationResult(MessageResolver messageResolver) {
// 
// 		violationsDescriptors = new LinkedHashSet<String>();
// 		this.messageResolver = messageResolver;
// 	}
// 	
// 	static ValidationResult init(MessageResolver messageResolver) {
// 		
// 		return new ValidationResult(messageResolver);
// 	}
// 
// 	public void addViolationDescriptor(String violationDescriptor, Object... arguments) {
// 
// 		if (violationDescriptor != null) {
// 			violationsDescriptors.add(messageResolver.resolveMessage(violationDescriptor, arguments));
// 		}
// 	}
// 
// 	public boolean hasViolations() {
// 
// 		return !violationsDescriptors.isEmpty();
// 	}
// 
// 	public Set<String> getViolationsDescriptors() {
// 
// 		return Collections.unmodifiableSet(violationsDescriptors);
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		
// 		return violationsDescriptors.toString();
// 	}
// 	
// }
// 
// Path: src/main/java/org/holmes/exception/RuleViolationException.java
// public class RuleViolationException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -6285497347762856549L;
// 
// 	private final Object[] violationDescriptorArguments;
// 
// 	public RuleViolationException(String violationDescriptor, Object... violationDescriptorArguments) {
// 
// 		super(violationDescriptor);
// 		this.violationDescriptorArguments = violationDescriptorArguments;
// 	}
// 
// 	public String getViolationDescriptor() {
// 
// 		return getMessage();
// 	}
// 
// 	public Object[] getViolationDescriptorArguments() {
// 
// 		return violationDescriptorArguments;
// 	}
// }
// 
// Path: src/main/java/org/holmes/exception/ValidationException.java
// public class ValidationException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 3422556211439163240L;
// 
// 	private final Set<String> violationsDescriptors;
// 
// 	public ValidationException(Collection<String> violationsDescriptors) {
// 
// 		this.violationsDescriptors = new LinkedHashSet<String>(violationsDescriptors);
// 	}
// 
// 	public Set<String> getViolationsDescriptors() {
// 
// 		return Collections.unmodifiableSet(violationsDescriptors);
// 	}
// 	
// 	@Override
// 	public String getMessage() {
// 		
// 		return this.toString();
// 	}
// 
// 	@Override
// 	public String toString() {
// 
// 		return violationsDescriptors.toString();
// 	}
// }


import org.holmes.OperationMode;
import org.holmes.ResultCollector;
import org.holmes.ValidationResult;
import org.holmes.exception.RuleViolationException;
import org.holmes.exception.ValidationException;
package org.holmes.collector;


/**
 * A {@link ResultCollector} related to the GREEDY {@link OperationMode}.
 * 
 * @author diegossilveira
 */
public class GreedyResultCollector implements ResultCollector {

	public void onRuleViolation(RuleViolationException e, ValidationResult result) throws ValidationException {

// Path: src/main/java/org/holmes/OperationMode.java
// public enum OperationMode {
// 
// 	/**
// 	 * In GREEDY mode, HolmesEngine will evaluate all rules, collecting the
// 	 * violations, before throwing an exception.
// 	 */
// 	GREEDY {
// 
// 		@Override
// 		public ResultCollector getResultCollector() {
// 
// 			return new GreedyResultCollector();
// 		}
// 	},
// 
// 	/**
// 	 * In EAGER mode, HolmesEngine will evaluate all rules and stop at the first
// 	 * violation occurred, throwing an exception immediately.
// 	 */
// 	EAGER {
// 
// 		@Override
// 		public ResultCollector getResultCollector() {
// 
// 			return new EagerResultCollector();
// 		}
// 	},
// 
// 	/**
// 	 * In SILENT mode, HolmesEngine will evaluate all rules, collecting the
// 	 * violations. No ValidationException is thrown.
// 	 */
// 	SILENT {
// 
// 		@Override
// 		public ResultCollector getResultCollector() {
// 
// 			return new SilentResultCollector();
// 		}
// 	};
// 
// 	public abstract ResultCollector getResultCollector();
// 
// }
// 
// Path: src/main/java/org/holmes/ResultCollector.java
// public interface ResultCollector {
// 
// 	void onRuleViolation(RuleViolationException e, ValidationResult result) throws ValidationException;
// 
// 	void finish(ValidationResult result) throws ValidationException;
// }
// 
// Path: src/main/java/org/holmes/ValidationResult.java
// public class ValidationResult {
// 
// 	private final Set<String> violationsDescriptors;
// 	
// 	private final MessageResolver messageResolver;
// 
// 	private ValidationResult(MessageResolver messageResolver) {
// 
// 		violationsDescriptors = new LinkedHashSet<String>();
// 		this.messageResolver = messageResolver;
// 	}
// 	
// 	static ValidationResult init(MessageResolver messageResolver) {
// 		
// 		return new ValidationResult(messageResolver);
// 	}
// 
// 	public void addViolationDescriptor(String violationDescriptor, Object... arguments) {
// 
// 		if (violationDescriptor != null) {
// 			violationsDescriptors.add(messageResolver.resolveMessage(violationDescriptor, arguments));
// 		}
// 	}
// 
// 	public boolean hasViolations() {
// 
// 		return !violationsDescriptors.isEmpty();
// 	}
// 
// 	public Set<String> getViolationsDescriptors() {
// 
// 		return Collections.unmodifiableSet(violationsDescriptors);
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		
// 		return violationsDescriptors.toString();
// 	}
// 	
// }
// 
// Path: src/main/java/org/holmes/exception/RuleViolationException.java
// public class RuleViolationException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -6285497347762856549L;
// 
// 	private final Object[] violationDescriptorArguments;
// 
// 	public RuleViolationException(String violationDescriptor, Object... violationDescriptorArguments) {
// 
// 		super(violationDescriptor);
// 		this.violationDescriptorArguments = violationDescriptorArguments;
// 	}
// 
// 	public String getViolationDescriptor() {
// 
// 		return getMessage();
// 	}
// 
// 	public Object[] getViolationDescriptorArguments() {
// 
// 		return violationDescriptorArguments;
// 	}
// }
// 
// Path: src/main/java/org/holmes/exception/ValidationException.java
// public class ValidationException extends RuntimeException {
// 
// 	private static final long serialVersionUID = 3422556211439163240L;
// 
// 	private final Set<String> violationsDescriptors;
// 
// 	public ValidationException(Collection<String> violationsDescriptors) {
// 
// 		this.violationsDescriptors = new LinkedHashSet<String>(violationsDescriptors);
// 	}
// 
// 	public Set<String> getViolationsDescriptors() {
// 
// 		return Collections.unmodifiableSet(violationsDescriptors);
// 	}
// 	
// 	@Override
// 	public String getMessage() {
// 		
// 		return this.toString();
// 	}
// 
// 	@Override
// 	public String toString() {
// 
// 		return violationsDescriptors.toString();
// 	}
// }


// Path: src/main/java/org/holmes/collector/GreedyResultCollector.java
import org.holmes.OperationMode;
import org.holmes.ResultCollector;
import org.holmes.ValidationResult;
import org.holmes.exception.RuleViolationException;
import org.holmes.exception.ValidationException;

package org.holmes.collector;


/**
 * A {@link ResultCollector} related to the GREEDY {@link OperationMode}.
 * 
 * @author diegossilveira
 */
public class GreedyResultCollector implements ResultCollector {

	public void onRuleViolation(RuleViolationException e, ValidationResult result) throws ValidationException {

		result.addViolationDescriptor(e.getViolationDescriptor(), e.getViolationDescriptorArguments());