001 package org.LiveGraph.events; 002 003 004 public class ValidationRequirementException extends RuntimeException { 005 006 public static enum FailedOperation { VALIDATE, RAISE } 007 008 private Event<? extends EventType> event; 009 private FailedOperation failedOperation; 010 011 public ValidationRequirementException(Event<? extends EventType> event, FailedOperation failedOperation) { 012 super("Cannot perform operation " 013 + (null == failedOperation ? "NULL" : failedOperation.toString()) 014 + " on an event of type " 015 + (null == event ? "NULL" : event.getType().toString()) 016 + " with a validation requirement " 017 + (null == event ? "NULL" : event.getValidationRequirement().toString()) 018 + " and a current validation status " 019 + (null == event ? "NULL" : (event.validated() ? "VALIDATED" : "NOT-VALIDATED"))); 020 this.event = event; 021 this.failedOperation = failedOperation; 022 } 023 024 public Event<? extends EventType> getEvent() { 025 return event; 026 } 027 028 public FailedOperation getFailedOperation() { 029 return failedOperation; 030 } 031 032 }