cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone a good way to resolve the unknown associations that must be removed before deleting a user group?

SOLVED
Visitor

Has anyone a good way to resolve the unknown associations that must be removed before deleting a user group?

These messages are a bane to me when removing legacy users or user groups, I had a similar issue with removing contacts when they were tied to unknown devices, but found i could easily retrieve that information with a custom object to get all contacts for all devices, but for user groups associated to Actions (or triggers? Does this mean Rules?) I have yet to find a slick solution:

 

Capture.PNG

 

I have had a look at mentor.axeda.com to see if i have grab all my Actions/Rules in one go, but there doesn't seem to be any properties for their user group associations, i also had a look at the user group classes but also did not see what i was looking for,

 

Any idea's on an easy way to resolve these would be gratefully received!

 

Many Thanks,

Alan

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Has anyone a good way to resolve the unknown associations that must be removed before deleting a user group?

Sorry, here are the imports:

import com.axeda.drm.sdk.action.Action

import com.axeda.drm.sdk.action.ActionFinder

import com.axeda.drm.sdk.user.UserGroup

4 REPLIES 4

Re: Has anyone a good way to resolve the unknown associations that must be removed before deleting a user group?

Howdy Alan,

I have poured over the API docs, and I am afraid that there is not enough Action support in there to solve your problem.

The UserGroup that you assigned these Actions to is easy enough to find, but there is limited support for finding Actions. Now, it will be possible to do this with a little bit of coding. I threw together some pseudo-code here:

ActionFinder finder = new ActionFinder()

List<Action> actions =  finder.findAll()

def userGroups = new ArrayList<UserGroup>()

actions.each() { action ->

    // these are the Lists of UserGroups you care about:

    userGroups.addAll(action.userGroupsForEdit)

    userGroups.addAll(action.userGroupsForExecute)  

}

// remove the dupes

userGroups = userGroups.unique()

// iterate and look for your UserGroup

userGroups.each() { ug ->

    if (ug.name == "group you want to delete") {

        // remove this group from the Actions

    }

}

Re: Has anyone a good way to resolve the unknown associations that must be removed before deleting a user group?

Hi Kevin,

Thanks so much for this, I must be missing an import unfortunately as i can't resolve the class, from mentor.axeda.com I made some educated guesses as to which class might contain the elusive ActionFinder, but have had to come back ask which would be correct? Our platform is 6.6,

unable to resolve class Act­ion­Fin­der
@ line 13, column 14.

Code snippet (I planned to iterate through them all, to validate all the associations):

import java.util.*;

import groovy.xml.MarkupBuilder

import org.custommonkey.xmlunit.*

import com.axeda.services.v2.*;

def writer

def xml

try

{

ActionFinder finder = new ActionFinder();

List<Action> actions =  finder.findAll()

writer = new StringWriter()

xml = new MarkupBuilder(writer)

xml.root()

   {

   for (ac in actions)

        {

.....

Re: Has anyone a good way to resolve the unknown associations that must be removed before deleting a user group?

Sorry, here are the imports:

import com.axeda.drm.sdk.action.Action

import com.axeda.drm.sdk.action.ActionFinder

import com.axeda.drm.sdk.user.UserGroup

Re: Has anyone a good way to resolve the unknown associations that must be removed before deleting a user group?

Amazing!

This morning I was starting to consider manually checking all Actions, what a time saver!

Many Thanks,

Alan