1 package org.apache.fulcrum.security.impl.db.entity; 2 3 56 57 import org.apache.fulcrum.security.TurbineSecurity; 58 import org.apache.fulcrum.security.entity.Permission; 59 import org.apache.fulcrum.security.entity.SecurityEntity; 60 import org.apache.fulcrum.security.util.TurbineSecurityException; 61 62 74 public class TurbinePermission 75 extends org.apache.fulcrum.security.impl.db.entity.BaseTurbinePermission 76 implements Permission, Comparable 77 { 78 79 82 public TurbinePermission() 83 { 84 } 85 86 91 public TurbinePermission(String name) 92 { 93 this.setName(name); 94 } 95 96 104 public static Permission create(String name) 105 throws TurbineSecurityException 106 { 107 return TurbineSecurity.createPermission(name); 108 } 109 110 116 public void save() 117 throws TurbineSecurityException 118 { 119 TurbineSecurity.savePermission(this); 120 } 121 122 127 public void remove() 128 throws TurbineSecurityException 129 { 130 TurbineSecurity.removePermission(this); 131 } 132 133 139 public void rename(String name) 140 throws TurbineSecurityException 141 { 142 TurbineSecurity.renamePermission(this, name); 143 } 144 145 152 public int compareTo(Object obj) 153 { 154 if (this.getClass() != obj.getClass()) 155 { 156 throw new ClassCastException (); 157 } 158 String name1 = ((SecurityEntity)obj).getName(); 159 String name2 = this.getName(); 160 return name2.compareTo(name1); 161 } 162 163 } 164 | Popular Tags |