3 Replies Last post: Dec 22, 2009 12:59 AM by Pavel Sher  
Seth Behunin Newbie 20 posts since
Nov 30, 2009
Currently Being Moderated

Dec 21, 2009 9:26 PM

Filtering user change events

Is there a way to determine what triggered a user change event?  For instance, I would like to be able to only do something when a specific change is made to a user and ignore all other changes.  I can't seem to find anything exposed that would allow me to do something like that.  The code below is a sample of what I have with a TODO of what I am wanting to add.

 

public class MyListener implements UserModelListener {
    private final SBuildServer myBuildServer;
 
    public MyListener(SBuildServer sBuildServer) {
 
        myBuildServer = sBuildServer;
    }
 
    public void register(){
        myBuildServer.getUserModel().addListener(this);
    }
 
    public void userAccountCreated(@NotNull User user) {
        // do nothing
    }
 
    public void userAccountChanged(User user) {
        Loggers.SERVER.info("User " + user.getName() + " changed.");
        // TODO: only do something if the e-mail address changed.
    }
 
    public void userAccountRemoved(User user) {
        // do nothing
    }
}

Pavel Sher JetBrains 2,148 posts since
Mar 6, 2008
Currently Being Moderated
Dec 22, 2009 12:44 AM in response to: Seth Behunin
Re: Filtering user change events

Unfortunately no. As a workaround, upon plugin initialization you can remember names for all of the users and when userAccountChanges event occurs compare old name and new one.

Pavel Sher JetBrains 2,148 posts since
Mar 6, 2008
Currently Being Moderated
Dec 22, 2009 12:59 AM in response to: Seth Behunin
Re: Filtering user change events

Feel free to submit feature request. I find this feature useful too.


More Like This

  • Retrieving data ...