cancel
Showing results for 
Search instead for 
Did you mean: 

deleteIdentityLink does not delete the IdentityLink

reggieoki
Champ in-the-making
Champ in-the-making
The TaskEnity method "deleteIdentityLiink" does not remove existing IdentityLinks.

I want to clear out any existing IdentityLink then add my Candidate Groups.  But when I use the "deleteIdentityLink" method to clear out all IdentityLink, then retrieving the list of Candidates, they are still there.

The ACT_RU_IDENTITYLINK table indicates that the specified IdentityLinks were not removed.

Below is a snippet of code.  Any suggestions?

    java.util.Set<IdentityLink> Candidates = task.getCandidates();

    for (IdentityLink temp: Candidates) {
      task.deleteIdentityLink(temp.getUserId(), temp.getGroupId(), temp.getType());
    }

    Candidates = task.getCandidates();

    task.addCandidateGroup("testGroup1");
    task.addCandidateGroup("testGroup2");

    Candidates = task.getCandidates();
3 REPLIES 3

reggieoki
Champ in-the-making
Champ in-the-making
Additional information, the Activiti version is 5.6 and the database is H2.

Thanks for any assistance.

reggieoki
Champ in-the-making
Champ in-the-making
Further debug information,

When attemting to delete the canidates deleteIdentityLink is called from TaskEntity.
Code from TaskEntity:
public void deleteIdentityLink(String userId, String groupId, String type) {
    List<IdentityLinkEntity> identityLinks = Context
      .getCommandContext()
      .getIdentityLinkManager()
      .findIdentityLinkByTaskUserGroupAndType(id, userId, groupId, type);
   
    for (IdentityLinkEntity identityLink: identityLinks) {
      Context
        .getCommandContext()
        .getDbSqlSession()
        .delete(IdentityLinkEntity.class, identityLink.getId());
    }
  }

In the above code identityLinks is an emty set. Which is weird since when getIdentityLinks from TaskEntity is called there are results. Both should be querying the database.

Any Thoughts?

jbarrez
Star Contributor
Star Contributor
You should use the API methods on the public service API:

see deleteUserIdentityLink and deleteGroupIdentityLink
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.