1 package org.apache.turbine.services.security.torque; 2 3 18 19 import org.apache.torque.om.Persistent; 20 21 import org.apache.turbine.om.security.Permission; 22 import org.apache.turbine.services.security.TurbineSecurity; 23 import org.apache.turbine.util.security.TurbineSecurityException; 24 25 37 38 public class TorquePermission 39 extends TorqueObject 40 implements Permission, 41 Comparable , 42 Persistent 43 { 44 47 public TorquePermission() 48 { 49 super(); 50 } 51 52 57 public TorquePermission(String name) 58 { 59 super(name); 60 } 61 62 70 71 public TorquePermission(Persistent obj) 72 { 73 super(obj); 74 } 75 76 84 85 public Persistent getPersistentObj() 86 { 87 if (obj == null) 88 { 89 obj = PermissionPeerManager.newPersistentInstance(); 90 } 91 return obj; 92 } 93 94 99 public String getName() 100 { 101 return PermissionPeerManager.getPermissionName(getPersistentObj()); 102 } 103 104 109 public void setName(String name) 110 { 111 PermissionPeerManager.setPermissionName(getPersistentObj(), name); 112 } 113 114 119 public int getId() 120 { 121 return PermissionPeerManager.getIdAsObj(getPersistentObj()).intValue(); 122 } 123 124 129 public Integer getIdAsObj() 130 { 131 return PermissionPeerManager.getIdAsObj(getPersistentObj()); 132 } 133 134 139 public void setId(int id) 140 { 141 PermissionPeerManager.setId(getPersistentObj(), id); 142 } 143 144 152 public static Permission create(String name) 153 throws TurbineSecurityException 154 { 155 return TurbineSecurity.createPermission(name); 156 } 157 158 164 public void save() 165 throws TurbineSecurityException 166 { 167 TurbineSecurity.savePermission(this); 168 } 169 170 175 public void remove() 176 throws TurbineSecurityException 177 { 178 TurbineSecurity.removePermission(this); 179 } 180 181 187 public void rename(String name) 188 throws TurbineSecurityException 189 { 190 TurbineSecurity.renamePermission(this, name); 191 } 192 } 193 194 195 196 | Popular Tags |