at.spardat.xma.security.VotingEvent Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* s IT Solutions AT Spardat GmbH - initial API and implementation
*******************************************************************************/
/*
* Created on 30.10.2003
*
*
*
*/
package at.spardat.xma.security;
import java.util.EventObject;
/**
* EventObject used to anounce a user change. It is delivered to all {@link ContextChangeListener}
* registered at the {@link LoginModuleWithContextChange} of the application befor the user, the
* mandant, the environment or the locale will be changed. Which of these changes can actually happen
* depends on the LoginModule.
* If any of the listeners calls {@link #setDoit(boolean)} with parameter false, the change will not happen.
* A reason can be given with {@link #setReason(String)}
*
* @author s2877
*/
public class VotingEvent extends EventObject {
private static final long serialVersionUID = 6804979077195139775L;
private boolean doit=true;
private String reason="";
/**
* Creates the event object.
* @param source the LoginModule sending the event
*/
public VotingEvent(Object source) {
super(source);
}
/**
* Query if a change is currently allowed.
* @return true if no listener has called setDoit(false).
*/
public boolean isDoit() {
return doit;
}
/**
* Allow or disallow a change in the XMAContext
* @param b true to allow, false to disallow
*/
public void setDoit(boolean b) {
doit &= b;
}
/**
* @return The reason for the given voting.
*/
public String getReason() {
return reason;
}
/**
* Give a reason why a context change was not allowed. Only used if {@link #setDoit(boolean)} was set to false
* @param reason
*/
public void setReason(String reason) {
this.reason = reason;
}
}