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 StringBuilder stringBuilder = new StringBuilder();
19 if (null != this.errorMessage && !StringUtils.isBlank(this.errorMessage)) {
20 stringBuilder.append(this
21 .errorMessage).append
22 (OLEConstants.BREAK);
23 }
24 stringBuilder.append(errorMessage);
25 this.errorMessage = stringBuilder.toString();
26 }
27
28 public String getErrorMessage() {
29 return errorMessage;
30 }
31
32 public void addOverridePermissions(String permissionName) {
33 if(null == permissions){
34 permissions = new ArrayList<>();
35 }
36 if(!permissions.contains(permissionName)){
37 permissions.add(permissionName);
38 }
39 }
40
41 public void clearPermissions(){
42 this.permissions = null;
43 }
44
45 public void clearErrorMessage(){
46 this.errorMessage = null;
47 }
48
49 public List<String> getPermissions() {
50 return permissions;
51 }
52
53 public String getErrorCode() {
54 return errorCode;
55 }
56
57 public void setErrorCode(String errorCode) {
58 this.errorCode = errorCode;
59 }
60 }