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

net.anotheria.asg.generator.Context Maven / Gradle / Ivy

The newest version!
package net.anotheria.asg.generator;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.anotheria.asg.generator.meta.MetaDocument;
import net.anotheria.asg.generator.meta.MetaModule;

/**
 * The Context is available at the generation time and contains contents of the context.xml.
 *
 * @author another
 * @version $Id: $Id
 */
public class Context {
	/**
	 * Name of the root package for the generated file.
	 */
	private String packageName;
	/**
	 * Owner of the application (used as db user name etc).
	 */
	private String owner;
	/**
	 * Configured application name.
	 */
	private String applicationName;
	/**
	 * Mapping for the cms servlet.
	 */
	private String servletMapping;
	/**
	 * Default encoding.
	 */
	private String encoding;
	/**
	 * Part of application url path between / and /, for example if you want the cms to be accessible under /xyz/cms/pagexShow the application url path is xyz. 
	 */
	private String applicationURLPath;
	
	/**
	 * If true support for multilanguage is enabled.
	 */
	private boolean multilanguageSupport;
	/**
	 * List of supported languages.
	 */
	private List languages;
	/**
	 * Default language.
	 */
	private String defaultLanguage;
	/**
	 * Additional generation options.
	 */
	private GenerationOptions options;
	/**
	 * Special context parameters.
	 */
	private Map parameters;
	
	/**
	 * Allows generation of the CMS 1.0 (struts implementation)
	 */
	private boolean cmsVersion1 = true;
	
	/**
	 * Allows generation of CMS 2.0 (ano-maf implementation)
	 */
	private boolean cmsVersion2 = false;
	
	/**
	 * 

Constructor for Context.

*/ public Context(){ parameters = new HashMap(); } /** *

Getter for the field packageName.

* * @deprecated use getPackageName(MetaModule m); * @return a {@link java.lang.String} object. */ public String getPackageName() { return packageName; } /** *

getTopPackageName.

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

getJspPackageName.

* * @param doc a {@link net.anotheria.asg.generator.meta.MetaDocument} object. * @return a {@link java.lang.String} object. */ public String getJspPackageName(MetaDocument doc){ return getJspPackageName(doc.getParentModule()); } /** *

getJspPackageName.

* * @param module a {@link net.anotheria.asg.generator.meta.MetaModule} object. * @return a {@link java.lang.String} object. */ public String getJspPackageName(MetaModule module){ return getPackageName(module)+".jsp"; } /** *

getDataPackageName.

* * @param doc a {@link net.anotheria.asg.generator.meta.MetaDocument} object. * @return a {@link java.lang.String} object. */ public String getDataPackageName(MetaDocument doc){ return getDataPackageName(doc.getParentModule()); } /** *

getDataPackageName.

* * @param module a {@link net.anotheria.asg.generator.meta.MetaModule} object. * @return a {@link java.lang.String} object. */ public String getDataPackageName(MetaModule module){ return getPackageName(module)+".data"; } /** *

getServicePackageName.

* * @param doc a {@link net.anotheria.asg.generator.meta.MetaDocument} object. * @return a {@link java.lang.String} object. */ public String getServicePackageName(MetaDocument doc){ return getServicePackageName(doc.getParentModule()); } /** *

getServicePackageName.

* * @param module a {@link net.anotheria.asg.generator.meta.MetaModule} object. * @return a {@link java.lang.String} object. */ public String getServicePackageName(MetaModule module){ return getPackageName(module)+".service"; } /** *

Getter for the field packageName.

* * @param module a {@link net.anotheria.asg.generator.meta.MetaModule} object. * @return a {@link java.lang.String} object. */ public String getPackageName(MetaModule module){ return packageName+"."+module.getName().toLowerCase(); } /** *

Getter for the field packageName.

* * @param doc a {@link net.anotheria.asg.generator.meta.MetaDocument} object. * @return a {@link java.lang.String} object. */ public String getPackageName(MetaDocument doc){ return getPackageName(doc.getParentModule()); } /** *

Setter for the field packageName.

* * @param string a {@link java.lang.String} object. */ public void setPackageName(String string) { packageName = string; } /** *

Getter for the field owner.

* * @return Returns the owner. */ public String getOwner() { return owner; } /** *

Setter for the field owner.

* * @param owner The owner to set. */ public void setOwner(String owner) { this.owner = owner; } /** *

Getter for the field applicationName.

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

Setter for the field applicationName.

* * @param string a {@link java.lang.String} object. */ public void setApplicationName(String string) { applicationName = string; } /** *

Getter for the field servletMapping.

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

Setter for the field servletMapping.

* * @param string a {@link java.lang.String} object. */ public void setServletMapping(String string) { servletMapping = string; } /** *

Getter for the field encoding.

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

Setter for the field encoding.

* * @param string a {@link java.lang.String} object. */ public void setEncoding(String string) { encoding = string; } /** *

Getter for the field defaultLanguage.

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

Setter for the field defaultLanguage.

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

Getter for the field languages.

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

Setter for the field languages.

* * @param languages a {@link java.util.List} object. */ public void setLanguages(List languages) { this.languages = languages; } /** *

areLanguagesSupported.

* * @return a boolean. */ public boolean areLanguagesSupported(){ return multilanguageSupport; } /** *

enableMultiLanguageSupport.

*/ public void enableMultiLanguageSupport(){ multilanguageSupport = true; languages = new ArrayList(); } /** *

addLanguage.

* * @param l a {@link java.lang.String} object. */ public void addLanguage(String l){ languages.add(l); } /** *

addContextParameter.

* * @param p a {@link net.anotheria.asg.generator.ContextParameter} object. */ public void addContextParameter(ContextParameter p){ parameters.put(p.getName(), p); } /** *

addContextParameter.

* * @param name a {@link java.lang.String} object. * @param value a {@link java.lang.String} object. */ public void addContextParameter(String name, String value){ addContextParameter(new ContextParameter(name, value)); } /** *

getContextParameters.

* * @return a {@link java.util.List} object. */ public List getContextParameters(){ ArrayList ret = new ArrayList(); ret.addAll(parameters.values()); return ret; } /** *

getContextParameter.

* * @param name a {@link java.lang.String} object. * @return a {@link net.anotheria.asg.generator.ContextParameter} object. */ public ContextParameter getContextParameter(String name){ return parameters.get(name); } /** *

Getter for the field applicationURLPath.

* * @return a {@link java.lang.String} object. */ public String getApplicationURLPath() { return applicationURLPath == null || applicationURLPath.length() == 0? "" : "/" + applicationURLPath; } /** *

Setter for the field applicationURLPath.

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

Getter for the field options.

* * @return a {@link net.anotheria.asg.generator.GenerationOptions} object. */ public GenerationOptions getOptions() { return options; } /** *

Setter for the field options.

* * @param options a {@link net.anotheria.asg.generator.GenerationOptions} object. */ public void setOptions(GenerationOptions options) { this.options = options; } /** *

isCmsVersion1.

* * @return a boolean. */ public boolean isCmsVersion1() { return cmsVersion1; } /** *

Setter for the field cmsVersion1.

* * @param cmsVersion1Generator a boolean. */ public void setCmsVersion1(boolean cmsVersion1Generator) { this.cmsVersion1 = cmsVersion1Generator; } /** *

isCmsVersion2.

* * @return a boolean. */ public boolean isCmsVersion2() { return cmsVersion2; } /** *

Setter for the field cmsVersion2.

* * @param cmsVersion2Generator a boolean. */ public void setCmsVersion2(boolean cmsVersion2Generator) { this.cmsVersion2 = cmsVersion2Generator; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy