try
{
if (systemGroups.contains(groupname))
{
throw new GroupException("[" + groupname + "] is a system group and cannot be removed");
}
conn = Torque.getConnection();
Group group = this.getGroup(groupname);
Criteria criteria = new Criteria();
criteria.add(TurbineGroupPeer.GROUP_NAME, groupname);
if(cascadeDelete)
{
//CASCADE TURBINE_USER_GROUP_ROLE
Criteria criteria1 = new Criteria();
criteria1.add(TurbineUserGroupRolePeer.GROUP_ID, group.getId());
TurbineUserGroupRolePeer.doDelete(criteria1, conn);
}
TurbineGroupPeer.doDelete(criteria, conn);
PsmlManager.removeGroupDocuments(group);
conn.commit();
}
catch(Exception e)
{
try
{
conn.rollback();
}
catch (java.sql.SQLException sqle)
{
logger.error("SQLException", sqle);
}
String message = "Failed to remove group '" + groupname + "'";
logger.error( message, e );
throw new GroupException( message, e );
}
finally
{
try
{