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

net.anotheria.anosite.gen.aswizarddata.data.WizardDefDocument Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** WizardDefDocument.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.aswizarddata.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 WizardDefDocument extends AbstractASGDocument implements WizardDef, IComparable{

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

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

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

	WizardDefDocument(WizardDefBuilder builder){
		super("");
		setName(builder.name);
		setWizardSteps(builder.wizardSteps);
		setWizardCancelRedirectUrl(builder.wizardCancelRedirectUrl);
		setWizardFinishRedirectUrl(builder.wizardFinishRedirectUrl);
		setHandler(builder.handler);
		setAccessOperation(builder.accessOperation);
	}

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

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

	public List getWizardSteps(){
		return copyToStringList(getList(PROP_WIZARD_STEPS));
	}

	public void setWizardSteps(List value){
		setList(PROP_WIZARD_STEPS, copyFromStringList(value));
	}

	public String getWizardCancelRedirectUrl(){
		return getString(PROP_WIZARD_CANCEL_REDIRECT_URL);
	}

	public void setWizardCancelRedirectUrl(String value){
		setString(PROP_WIZARD_CANCEL_REDIRECT_URL, value);
	}

	public String getWizardFinishRedirectUrl(){
		return getString(PROP_WIZARD_FINISH_REDIRECT_URL);
	}

	public void setWizardFinishRedirectUrl(String value){
		setString(PROP_WIZARD_FINISH_REDIRECT_URL, value);
	}

	public String getHandler(){
		return getString(LINK_PROP_HANDLER);
	}

	public void setHandler(String value){
		setString(LINK_PROP_HANDLER, value);
	}

	public String getAccessOperation(){
		return getString(LINK_PROP_ACCESS_OPERATION);
	}

	public void setAccessOperation(String value){
		setString(LINK_PROP_ACCESS_OPERATION, value);
	}


	public String toString(){
		String ret = "WizardDef ";
		ret += "["+getId()+"] ";
		ret += "name: "+getName();
		ret += ", ";
		ret += "wizardSteps: "+getWizardSteps();
		ret += ", ";
		ret += "wizardCancelRedirectUrl: "+getWizardCancelRedirectUrl();
		ret += ", ";
		ret += "wizardFinishRedirectUrl: "+getWizardFinishRedirectUrl();
		return ret;
	}

	public int getWizardStepsSize(){
		return getList(PROP_WIZARD_STEPS).size();
	}

	public void addWizardStepsElement(String page){
		getListPropertyAnyCase(PROP_WIZARD_STEPS).add(new StringProperty("" + page, page));
	} //method

	public void removeWizardStepsElement(int index){
		getListProperty(PROP_WIZARD_STEPS).remove(index);
	} //method

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

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


	public int compareTo(WizardDef comparable){
		return compareTo(comparable, WizardDefSortType.SORT_BY_DEFAULT);
	}

	public int compareTo(IComparable anotherComparable, int method){
		WizardDefDocument anotherDoc = (WizardDefDocument) anotherComparable;
		switch(method){
			case WizardDefSortType.SORT_BY_ID:
				return BasicComparable.compareString(getId(), anotherDoc.getId());
			case WizardDefSortType.SORT_BY_NAME:
				return BasicComparable.compareString(getName(), anotherDoc.getName());
			case WizardDefSortType.SORT_BY_WIZARDCANCELREDIRECTURL:
				return BasicComparable.compareString(getWizardCancelRedirectUrl(), anotherDoc.getWizardCancelRedirectUrl());
			case WizardDefSortType.SORT_BY_WIZARDFINISHREDIRECTURL:
				return BasicComparable.compareString(getWizardFinishRedirectUrl(), anotherDoc.getWizardFinishRedirectUrl());
			case WizardDefSortType.SORT_BY_HANDLER:
				return BasicComparable.compareString(getHandler(), anotherDoc.getHandler());
			case WizardDefSortType.SORT_BY_ACCESSOPERATION:
				return BasicComparable.compareString(getAccessOperation(), anotherDoc.getAccessOperation());
			default:
				throw new RuntimeException("Sort method "+method+" is not supported.");
		}
	}

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

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

	public String getFootprint(){
		StringBuilder footprint = new StringBuilder();
		footprint.append(getName());
		footprint.append(getWizardSteps());
		footprint.append(getWizardCancelRedirectUrl());
		footprint.append(getWizardFinishRedirectUrl());
		footprint.append(getHandler());
		footprint.append(getAccessOperation());
		return MD5Util.getMD5Hash(footprint);
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy