1 package org.kuali.ole.deliver.util;
2
3 import org.apache.commons.lang.StringUtils;
4 import org.kuali.ole.OLEConstants;
5
6 import java.util.ArrayList;
7 import java.util.List;
8
9
10
11
12 public class ErrorMessage {
13 private String errorCode;
14 private String errorMessage = null;
15 private List<String> permissions = null;
16
17 public void setErrorMessage(String errorMessage) {
18 if (null != errorMessage) {
19 StringBuilder stringBuilder = new StringBuilder();
20 if (null != this.errorMessage && !StringUtils.isBlank(this.errorMessage)) {
21 stringBuilder.append(this
22 .errorMessage).append
23 (OLEConstants.BREAK);
24 }
25 stringBuilder.append(errorMessage);
26 this.errorMessage = stringBuilder.toString();
27 }else{
28 this.errorMessage = errorMessage;
29 }
30 }
31
32 public String getErrorMessage() {
33 return errorMessage;
34 }
35
36 public void addOverridePermissions(String permissionName) {
37 if(null == permissions){
38 permissions = new ArrayList<>();
39 }
40 if(!permissions.contains(permissionName)){
41 permissions.add(permissionName);
42 }
43 }
44
45 public void clearPermissions(){
46 this.permissions = null;
47 }
48
49 public void clearErrorMessage(){
50 this.errorMessage = null;
51 }
52
53 public List<String> getPermissions() {
54 return permissions;
55 }
56
57 public String getErrorCode() {
58 return errorCode;
59 }
60
61 public void setErrorCode(String errorCode) {
62 this.errorCode = errorCode;
63 }
64 }