1 10 package org.mmbase.security; 11 12 19 public final class Operation { 20 21 public final static int READ_INT = 0; 22 23 24 public final static int WRITE_INT = 1; 25 26 27 public final static int CREATE_INT = 2; 28 29 30 public final static int CHANGE_RELATION_INT = 3; 31 32 33 public final static int DELETE_INT = 4; 34 35 39 public final static int CHANGE_CONTEXT_INT = 6; 40 41 44 public final static int CHANGECONTEXT_INT = CHANGE_CONTEXT_INT; 45 46 47 48 public final static Operation READ = new Operation(READ_INT, "read"); 49 50 51 public final static Operation WRITE = new Operation(WRITE_INT, "write"); 52 53 57 public final static Operation CREATE = new Operation(CREATE_INT, "create"); 58 59 63 public final static Operation CHANGE_RELATION = new Operation(CHANGE_RELATION_INT, "change relation"); 64 65 66 public final static Operation DELETE = new Operation(DELETE_INT, "delete"); 67 68 72 public final static Operation CHANGE_CONTEXT = new Operation(CHANGE_CONTEXT_INT, "change context"); 73 74 75 79 public final static Operation CHANGECONTEXT = CHANGE_CONTEXT; 80 81 84 private Operation(int level, String description) { 85 this.level = level; 86 this.description = description; 87 } 88 89 94 public int getInt(){ 95 return level; 96 } 97 98 101 public String toString(){ 102 return description; 103 } 104 105 106 private int level; 107 108 109 private String description; 110 111 112 public static Operation getOperation(String operationString) { 113 if(READ.toString().equals(operationString)) return READ; 114 if(WRITE.toString().equals(operationString)) return WRITE; 115 if(CREATE.toString().equals(operationString)) return CREATE; 116 if(CHANGE_RELATION.toString().equals(operationString)) return CHANGE_RELATION; 117 if(DELETE.toString().equals(operationString)) return DELETE; 118 if(CHANGE_CONTEXT.toString().equals(operationString)) return CHANGE_CONTEXT; 119 throw new org.mmbase.security.SecurityException("Could not find a operation for the operation with name:" + operationString); 120 } 121 } 122 | Popular Tags |