All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.anotheria.anodoc.util.context.CallContext Maven / Gradle / Ivy

package net.anotheria.anodoc.util.context;

import java.io.Serializable;
import java.util.List;

/**
 * Abstract class for CallContext which is assigned to each thread and allows multilinguality support and more.
 *
 * @author another
 * @version $Id: $Id
 */
public abstract class CallContext implements Serializable{
	
	private String currentAuthor;
	private String currentLanguage;
	private DBContext dbContext;
	private BrandConfig brandConfig;
	
	/**
	 * 

reset.

*/ public void reset(){ currentLanguage = null; dbContext = null; brandConfig = null; } /** *

Getter for the field currentLanguage.

* * @return a {@link java.lang.String} object. */ public String getCurrentLanguage() { return currentLanguage == null ? getDefaultLanguage() : currentLanguage; } /** *

Setter for the field currentLanguage.

* * @param currentLanguage a {@link java.lang.String} object. */ public void setCurrentLanguage(String currentLanguage) { this.currentLanguage = currentLanguage; } /** *

getDefaultLanguage.

* * @return a {@link java.lang.String} object. */ public abstract String getDefaultLanguage(); /** *

getSupportedLanguages.

* * @return a {@link java.util.List} object. */ public abstract List getSupportedLanguages(); /** *

Setter for the field dbContext.

* * @param aDbContent a {@link net.anotheria.anodoc.util.context.DBContext} object. */ public void setDbContext(DBContext aDbContent){ dbContext = aDbContent; } /** *

Getter for the field dbContext.

* * @return a {@link net.anotheria.anodoc.util.context.DBContext} object. */ public DBContext getDbContext(){ //this is not really thread-safe, but its better to risk to create one dummy object as to //synchronize here. Especially since the CallContext is ThreadLocal and therefore shouldn't //be accessed from many threads at once. if (dbContext==null) dbContext = new DBContext(); return dbContext; } /** *

Getter for the field currentAuthor.

* * @return a {@link java.lang.String} object. */ public String getCurrentAuthor() { return currentAuthor; } /** *

Setter for the field currentAuthor.

* * @param currentAuthor a {@link java.lang.String} object. */ public void setCurrentAuthor(String currentAuthor) { this.currentAuthor = currentAuthor; } /** *

Getter for the field brandConfig.

* * @return a {@link BrandConfig} object. */ public BrandConfig getBrandConfig() { return brandConfig; } /** *

Setter for the field brandConfig.

* * @param brandConfig a {@link BrandConfig} object. */ public void setBrandConfig(BrandConfig brandConfig) { this.brandConfig = brandConfig; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy