1 16 package web.security.impl; 17 18 import java.io.Serializable ; 19 20 import web.security.Operation; 21 import web.security.Privilege; 22 import web.security.Range; 23 import web.security.Resource; 24 25 26 30 public class PrivilegeImpl implements Privilege, Serializable { 31 32 Resource resource; 33 Operation operation; 34 Range range; 35 36 public PrivilegeImpl() { 37 } 38 39 public PrivilegeImpl(Resource resource,Operation operation,Range range) { 40 this.resource = resource; 41 this.operation = operation; 42 this.range = range; 43 } 44 45 48 public boolean equals(Privilege pvg) { 49 if(pvg==this) 50 return true; 51 if(resource==null || operation==null || range==null) 52 return false; 53 if(pvg==null||pvg.getResource()==null||pvg.getOperation()==null||pvg.getRange()==null) 54 return false; 55 boolean bResource = resource.equals(pvg.getResource()); 56 boolean bOperation= operation.equals(pvg.getOperation()); 57 boolean bRange = range.equals(pvg.getRange()); 58 return bResource && bOperation && bRange; 59 } 60 61 64 public Resource getResource() { 65 return resource; 66 } 67 68 71 public Operation getOperation() { 72 return operation; 73 } 74 75 78 public Range getRange() { 79 return range; 80 } 81 82 public void setOperation(Operation operation) { 83 this.operation = operation; 84 } 85 public void setRange(Range range) { 86 this.range = range; 87 } 88 public void setResource(Resource resource) { 89 this.resource = resource; 90 } 91 92 } 93 | Popular Tags |