1 19 20 package com.sslexplorer.core; 21 22 import javax.servlet.http.HttpSession ; 23 24 import com.sslexplorer.policyframework.Permission; 25 import com.sslexplorer.policyframework.ResourceType; 26 27 44 public class GlobalWarning { 45 48 public final static int SINGLE_SESSION = 0; 49 50 53 public final static int ALL_USERS = 1; 54 55 58 public final static int SUPER_USER = 2; 59 60 64 public final static int MANAGEMENT_USERS = 3; 65 66 70 public final static int USERS_WITH_PERMISSIONS = 4; 71 72 private int type; 74 private BundleActionMessage message; 75 private ResourceType requiredResourceType; 76 private Permission[] requiredPermissions; 77 private HttpSession session; 78 79 85 public GlobalWarning(HttpSession session, BundleActionMessage message) { 86 this.type = SINGLE_SESSION; 87 this.session = session; 88 this.message = message; 89 } 90 91 99 public GlobalWarning(int type, BundleActionMessage message) throws IllegalArgumentException { 100 if(type != SUPER_USER && type != MANAGEMENT_USERS && type != ALL_USERS) { 101 throw new IllegalArgumentException ("Illegal global warning type."); 102 } 103 this.type = type; 104 this.message = message; 105 } 106 107 114 public GlobalWarning(ResourceType requiredResourceType, Permission[] requiredPermissions, BundleActionMessage message) { 115 this.type = USERS_WITH_PERMISSIONS; 116 this.requiredPermissions = requiredPermissions; 117 this.requiredResourceType = requiredResourceType; 118 this.message = message; 119 } 120 121 126 public BundleActionMessage getMessage() { 127 return message; 128 } 129 130 135 public Permission[] getRequiredPermissions() { 136 return requiredPermissions; 137 } 138 139 140 145 public ResourceType getRequiredResourceType() { 146 return requiredResourceType; 147 } 148 149 150 155 public HttpSession getSession() { 156 return session; 157 } 158 159 165 public int getType() { 166 return type; 167 } 168 169 } 170 | Popular Tags |