/**
* Add event bus observers.
*/
private void addObservers()
{
EventBus eventBus = Session.getInstance().getEventBus();
eventBus.addObserver(MembershipCriteriaAddedEvent.class, new Observer<MembershipCriteriaAddedEvent>()
{
public void update(final MembershipCriteriaAddedEvent event)
{
if (event.isNew())
{
// TODO: Refactor to use new client models
processor.makeRequest("addMembershipCriteria", event.getMembershipCriteria(),
new AsyncCallback<Long>()
{
public void onFailure(final Throwable caught)
{
}
public void onSuccess(final Long persistedItemId)
{
SystemSettingsModel.getInstance().clearCache();
Session.getInstance()
.getEventBus()
.notifyObservers(
new ShowNotificationEvent(new Notification("Access List Saved")));
History.newItem(History.getToken());
MembershipCriteriaDTO result = event.getMembershipCriteria();
result.setId(persistedItemId);
Session.getInstance().getEventBus()
.notifyObservers(new MembershipCriteriaPersistedEvent(result));
}
});
}
}
});
eventBus.addObserver(MembershipCriteriaRemovedEvent.class, new Observer<MembershipCriteriaRemovedEvent>()
{
public void update(final MembershipCriteriaRemovedEvent event)
{
processor.makeRequest("removeMembershipCriteria", event.getMembershipCriteria().getId(),
new AsyncCallback<SystemSettings>()