{
throw new PermissionException("[" + permissionName + "] is a system permission and cannot be removed");
}
conn = Torque.getConnection();
Permission permission = this.getPermission(permissionName);
Criteria criteria = new Criteria();
criteria.add(TurbinePermissionPeer.PERMISSION_NAME, permissionName);
if(cascadeDelete)
{
// CASCADE to TURBINE_ROLE_PERMISSION
Criteria critRolePerm = new Criteria();
critRolePerm.add(TurbineRolePermissionPeer.PERMISSION_ID, permission.getId());
TurbineRolePermissionPeer.doDelete(critRolePerm, conn);
}
TurbinePermissionPeer.doDelete(criteria, conn);
conn.commit();