at.spardat.xma.plugins.dummy.DummyContext Maven / Gradle / Ivy
/*******************************************************************************
* 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
*******************************************************************************/
package at.spardat.xma.plugins.dummy;
import java.util.Locale;
import at.spardat.xma.security.XMAContext;
/**
* Dummy implementation of a XMAContext.
*
* @author s2877
*/
public class DummyContext implements XMAContext {
String userName;
String mandant;
Locale locale;
String environment;
private static final long serialVersionUID = 1L;
/**
* Constructor for XMAContext.
*/
public DummyContext() {
// locale = new Locale("de","AT");
locale = Locale.getDefault();
environment = local;
}
/**
* Returns the locale. Default is de_AT.
* @return the locale.
*/
public Locale getLocale() {
return locale;
}
/**
* Returns the mandant as set by {@link DummyLoginModule}.
* @return the mandant of the logged in user.
*/
public String getMandant() {
return mandant;
}
/**
* Returns the environment. Default is the local developers PC.
* @return the environment.
*/
public String getEnvironment() {
return environment;
}
/**
* Determines if the environment is developers pc.
* @return true if the environment is developers pc.
*/
public boolean isLocal() {
return local.equals(environment);
}
/**
* Returns the userName as set by {@link DummyLoginModule}.
* @return the name of the logged in user.
*/
public String getName() {
return userName;
}
/**
* Sets the locale.
* @param locale The locale to set
*/
public void setLocale(Locale locale) {
this.locale = locale;
}
/**
* Sets the mandant.
* @param mandant The mandant to set
*/
public void setMandant(String mandant) {
this.mandant = mandant;
}
/**
* Sets the environment.
* @param environment The environment to set
*/
public void setEnvironment(String environment) {
this.environment = environment;
}
/**
* Sets the userName.
* @param userName The userName to set
*/
public void setName(String userName) {
this.userName = userName;
}
/**
* Prints username, mandant, environment and locale seperated by blanks.
* @return the string representation of this DummyContext.
*/
public String toString() {
return userName + " " + mandant + " " + environment + " " + locale.toString();
}
}