1
|
|
2
|
package eu.etaxonomy.cdm.database;
|
3
|
|
4
|
import java.util.EnumSet;
|
5
|
|
6
|
import org.apache.log4j.Logger;
|
7
|
import org.hibernate.HibernateException;
|
8
|
import org.springframework.security.core.Authentication;
|
9
|
|
10
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
11
|
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
|
12
|
import eu.etaxonomy.cdm.persistence.hibernate.permission.Operation;
|
13
|
|
14
|
|
15
|
/**
|
16
|
* FIXME Rename to PermissionDeniedException ???
|
17
|
*
|
18
|
* @author andreas
|
19
|
* @date Sep 4, 2012
|
20
|
*
|
21
|
*/
|
22
|
public class EvaluationFailedException extends HibernateException {
|
23
|
private static final Logger logger = Logger
|
24
|
.getLogger(EvaluationFailedException.class);
|
25
|
|
26
|
/**
|
27
|
* @param message
|
28
|
*/
|
29
|
public EvaluationFailedException(String message) {
|
30
|
super(message);
|
31
|
}
|
32
|
|
33
|
public EvaluationFailedException(Authentication authentication, CdmBase entity, Operation requiredOperation) {
|
34
|
super(requiredOperation + " not permitted for '" + authentication.getName()
|
35
|
+ "' on " + entity.getClass().getSimpleName() + "[uuid:" + entity.getUuid() + "', toString:'" + entity.toString() + "']");
|
36
|
}
|
37
|
|
38
|
public EvaluationFailedException(Authentication authentication, CdmBase entity, EnumSet<CRUD> requiredOperation) {
|
39
|
super(requiredOperation + " not permitted for '" + authentication.getName()
|
40
|
+ "' on " + entity.getClass().getSimpleName() + "[uuid:" + entity.getUuid() + "', toString:'" + entity.toString() + "']");
|
41
|
}
|
42
|
|
43
|
public EvaluationFailedException(Authentication authentication, CdmBase entity, String requiredOperation) {
|
44
|
super(requiredOperation + " not permitted for '" + authentication.getName()
|
45
|
+ "' on " + entity.getClass().getSimpleName() + "[uuid:" + entity.getUuid() + "', toString:'" + entity.toString() + "']");
|
46
|
}
|
47
|
|
48
|
/**
|
49
|
* @param cause
|
50
|
*/
|
51
|
public EvaluationFailedException(Throwable cause) {
|
52
|
super(cause);
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* @param message
|
57
|
* @param cause
|
58
|
*/
|
59
|
public EvaluationFailedException(String message, Throwable cause) {
|
60
|
super(message, cause);
|
61
|
}
|
62
|
}
|