@ Override public IdentityLinkEntity involveUser ( ExecutionEntity executionEntity , String userId , String type ) { for ( IdentityLinkEntity identityLink : executionEntity . getIdentityLinks ( ) ) { if ( identityLink . isUser ( ) && identityLink . getUserId ( ) . equals ( userId ) ) { return identityLink ; } } return addIdentityLink ( executionEntity , userId , null , type ) ; }
Adds an IdentityLink for the given user id with the specified type but only if the user is not associated with the execution entity yet .