// If this group is related to a collection, then un-link it.
int collectionId = getCollectionId(groupDeleted.getName());
Role role = getCollectionRole(groupDeleted.getName());
if (collectionId != -1 && role != Role.none)
{
Collection collection = Collection.find(context, collectionId);
if (collection != null)
{
if (role == Role.Administrators)
{
collection.removeAdministrators();
collection.update();
}
else if (role == Role.Submitters)
{
collection.removeSubmitters();
collection.update();
}
else if (role == Role.WorkflowStep1)
{
collection.setWorkflowGroup(1, null);
collection.update();
}
else if (role == Role.WorkflowStep2)
{
collection.setWorkflowGroup(2, null);
collection.update();
}
else if (role == Role.WorkflowStep3)
{
collection.setWorkflowGroup(3, null);
collection.update();
}
else if (role == Role.DefaultRead)
{
// Nothing special needs to happen.
}