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

net.anotheria.anosite.gen.ascustomaction.data.ActionMappingDefDocument Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** ActionMappingDefDocument.java                                            ***
 *** generated by AnoSiteGenerator (ASG), Version: 3.2.2                      ***
 *** Copyright (C) 2005 - 2023 Anotheria.net, www.anotheria.net               ***
 *** All Rights Reserved.                                                     ***
 ********************************************************************************
 *** Don't edit this code, if you aren't sure                                 ***
 *** that you do exactly know what you are doing!                             ***
 *** It's better to invest time in the generator, as into the generated code. ***
 ********************************************************************************
 */

package net.anotheria.anosite.gen.ascustomaction.data;

import net.anotheria.asg.data.AbstractASGDocument;
import java.util.List;
import net.anotheria.anodoc.data.StringProperty;
import net.anotheria.util.crypt.MD5Util;
import net.anotheria.util.sorter.IComparable;
import net.anotheria.util.BasicComparable;

public class ActionMappingDefDocument extends AbstractASGDocument implements ActionMappingDef, IComparable{

	public ActionMappingDefDocument() {
		super("");
	}

	public ActionMappingDefDocument(String id){
		super(id);
	}

	public ActionMappingDefDocument(ActionMappingDefDocument toClone){
		super(toClone);
	}

	ActionMappingDefDocument(ActionMappingDefBuilder builder){
		super("");
		setName(builder.name);
		setUrl(builder.url);
		setParameters(builder.parameters);
		setCommand(builder.command);
		setLocalizationBundles(builder.localizationBundles);
		setAction(builder.action);
		setPage(builder.page);
	}

	public String getName(){
		return getString(PROP_NAME);
	}

	public void setName(String value){
		setString(PROP_NAME, value);
	}

	public String getUrl(){
		return getString(PROP_URL);
	}

	public void setUrl(String value){
		setString(PROP_URL, value);
	}

	public String getParameters(){
		return getString(PROP_PARAMETERS);
	}

	public void setParameters(String value){
		setString(PROP_PARAMETERS, value);
	}

	public int getCommand(){
		return getInt(PROP_COMMAND);
	}

	public void setCommand(int value){
		setInt(PROP_COMMAND, value);
	}

	public List getLocalizationBundles(){
		return copyToStringList(getList(PROP_LOCALIZATION_BUNDLES));
	}

	public void setLocalizationBundles(List value){
		setList(PROP_LOCALIZATION_BUNDLES, copyFromStringList(value));
	}

	public String getAction(){
		return getString(LINK_PROP_ACTION);
	}

	public void setAction(String value){
		setString(LINK_PROP_ACTION, value);
	}

	public String getPage(){
		return getString(LINK_PROP_PAGE);
	}

	public void setPage(String value){
		setString(LINK_PROP_PAGE, value);
	}


	public String toString(){
		String ret = "ActionMappingDef ";
		ret += "["+getId()+"] ";
		ret += "name: "+getName();
		ret += ", ";
		ret += "url: "+getUrl();
		ret += ", ";
		ret += "parameters: "+getParameters();
		ret += ", ";
		ret += "command: "+getCommand();
		ret += ", ";
		ret += "localizationBundles: "+getLocalizationBundles();
		return ret;
	}

	public int getLocalizationBundlesSize(){
		return getList(PROP_LOCALIZATION_BUNDLES).size();
	}

	public void addLocalizationBundlesElement(String localizationBundles){
		getListPropertyAnyCase(PROP_LOCALIZATION_BUNDLES).add(new StringProperty("" + localizationBundles, localizationBundles));
	} //method

	public void removeLocalizationBundlesElement(int index){
		getListProperty(PROP_LOCALIZATION_BUNDLES).remove(index);
	} //method

	public void swapLocalizationBundlesElement(int index1, int index2){
		String tmp1, tmp2;
		tmp1 = ((StringProperty)getList(PROP_LOCALIZATION_BUNDLES).get(index1)).getString();
		tmp2 = ((StringProperty)getList(PROP_LOCALIZATION_BUNDLES).get(index2)).getString();
		((StringProperty)getList(PROP_LOCALIZATION_BUNDLES).get(index1)).setString(tmp2);
		((StringProperty)getList(PROP_LOCALIZATION_BUNDLES).get(index2)).setString(tmp1);
	} //method

	public String getLocalizationBundlesElement(int index){
		StringProperty p = (StringProperty)getList(PROP_LOCALIZATION_BUNDLES).get(index);
		return p.getString();
	} //method


	public int compareTo(ActionMappingDef comparable){
		return compareTo(comparable, ActionMappingDefSortType.SORT_BY_DEFAULT);
	}

	public int compareTo(IComparable anotherComparable, int method){
		ActionMappingDefDocument anotherDoc = (ActionMappingDefDocument) anotherComparable;
		switch(method){
			case ActionMappingDefSortType.SORT_BY_ID:
				return BasicComparable.compareString(getId(), anotherDoc.getId());
			case ActionMappingDefSortType.SORT_BY_NAME:
				return BasicComparable.compareString(getName(), anotherDoc.getName());
			case ActionMappingDefSortType.SORT_BY_URL:
				return BasicComparable.compareString(getUrl(), anotherDoc.getUrl());
			case ActionMappingDefSortType.SORT_BY_PARAMETERS:
				return BasicComparable.compareString(getParameters(), anotherDoc.getParameters());
			case ActionMappingDefSortType.SORT_BY_COMMAND:
				return BasicComparable.compareInt(getCommand(), anotherDoc.getCommand());
			case ActionMappingDefSortType.SORT_BY_ACTION:
				return BasicComparable.compareString(getAction(), anotherDoc.getAction());
			case ActionMappingDefSortType.SORT_BY_PAGE:
				return BasicComparable.compareString(getPage(), anotherDoc.getPage());
			default:
				throw new RuntimeException("Sort method "+method+" is not supported.");
		}
	}

	public String getDefinedName(){
		return "ActionMappingDef";
	}

	public String getDefinedParentName(){
		return "ASCustomAction";
	}

	public String getFootprint(){
		StringBuilder footprint = new StringBuilder();
		footprint.append(getName());
		footprint.append(getUrl());
		footprint.append(getParameters());
		footprint.append(getCommand());
		footprint.append(getLocalizationBundles());
		footprint.append(getAction());
		footprint.append(getPage());
		return MD5Util.getMD5Hash(footprint);
	}

	public boolean equals(Object o){
		return o == this || ((o instanceof ActionMappingDefDocument) && ((ActionMappingDefDocument)o).getId().equals(getId()));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy