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

net.anotheria.anosite.gen.asfeature.data.BrandFeatureDocument Maven / Gradle / Ivy

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

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

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

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

	BrandFeatureDocument(BrandFeatureBuilder builder){
		super("");
		setName(builder.name);
		setEnabled(builder.enabled);
		setActiveInProduction(builder.activeInProduction);
		setObsolete(builder.obsolete);
		setDescription(builder.description);
		setGuards(builder.guards);
		setBrands(builder.brands);
		setAccessOperation(builder.accessOperation);
	}

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

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

	public boolean getEnabled(){
		return getBoolean(PROP_ENABLED);
	}

	public void setEnabled(boolean value){
		setBoolean(PROP_ENABLED, value);
	}

	public boolean getActiveInProduction(){
		return getBoolean(PROP_ACTIVE_IN_PRODUCTION);
	}

	public void setActiveInProduction(boolean value){
		setBoolean(PROP_ACTIVE_IN_PRODUCTION, value);
	}

	public boolean getObsolete(){
		return getBoolean(PROP_OBSOLETE);
	}

	public void setObsolete(boolean value){
		setBoolean(PROP_OBSOLETE, value);
	}

	public String getDescription(){
		return getString(PROP_DESCRIPTION);
	}

	public void setDescription(String value){
		setString(PROP_DESCRIPTION, value);
	}

	public List getGuards(){
		return copyToStringList(getList(PROP_GUARDS));
	}

	public void setGuards(List value){
		setList(PROP_GUARDS, copyFromStringList(value));
	}

	public List getBrands(){
		return copyToStringList(getList(PROP_BRANDS));
	}

	public void setBrands(List value){
		setList(PROP_BRANDS, copyFromStringList(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 = "BrandFeature ";
		ret += "["+getId()+"] ";
		ret += "name: "+getName();
		ret += ", ";
		ret += "enabled: "+getEnabled();
		ret += ", ";
		ret += "activeInProduction: "+getActiveInProduction();
		ret += ", ";
		ret += "obsolete: "+getObsolete();
		ret += ", ";
		ret += "description: "+getDescription();
		ret += ", ";
		ret += "guards: "+getGuards();
		ret += ", ";
		ret += "brands: "+getBrands();
		return ret;
	}

	public int getGuardsSize(){
		return getList(PROP_GUARDS).size();
	}

	public void addGuardsElement(String guard){
		getListPropertyAnyCase(PROP_GUARDS).add(new StringProperty("" + guard, guard));
	} //method

	public void removeGuardsElement(int index){
		getListProperty(PROP_GUARDS).remove(index);
	} //method

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

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

	public int getBrandsSize(){
		return getList(PROP_BRANDS).size();
	}

	public void addBrandsElement(String brand){
		getListPropertyAnyCase(PROP_BRANDS).add(new StringProperty("" + brand, brand));
	} //method

	public void removeBrandsElement(int index){
		getListProperty(PROP_BRANDS).remove(index);
	} //method

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

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


	public int compareTo(BrandFeature comparable){
		return compareTo(comparable, BrandFeatureSortType.SORT_BY_DEFAULT);
	}

	public int compareTo(IComparable anotherComparable, int method){
		BrandFeatureDocument anotherDoc = (BrandFeatureDocument) anotherComparable;
		switch(method){
			case BrandFeatureSortType.SORT_BY_ID:
				return BasicComparable.compareString(getId(), anotherDoc.getId());
			case BrandFeatureSortType.SORT_BY_NAME:
				return BasicComparable.compareString(getName(), anotherDoc.getName());
			case BrandFeatureSortType.SORT_BY_ENABLED:
				return BasicComparable.compareBoolean(getEnabled(), anotherDoc.getEnabled());
			case BrandFeatureSortType.SORT_BY_ACTIVEINPRODUCTION:
				return BasicComparable.compareBoolean(getActiveInProduction(), anotherDoc.getActiveInProduction());
			case BrandFeatureSortType.SORT_BY_OBSOLETE:
				return BasicComparable.compareBoolean(getObsolete(), anotherDoc.getObsolete());
			case BrandFeatureSortType.SORT_BY_DESCRIPTION:
				return BasicComparable.compareString(getDescription(), anotherDoc.getDescription());
			case BrandFeatureSortType.SORT_BY_ACCESSOPERATION:
				return BasicComparable.compareString(getAccessOperation(), anotherDoc.getAccessOperation());
			default:
				throw new RuntimeException("Sort method "+method+" is not supported.");
		}
	}

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

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

	public String getFootprint(){
		StringBuilder footprint = new StringBuilder();
		footprint.append(getName());
		footprint.append(getEnabled());
		footprint.append(getActiveInProduction());
		footprint.append(getObsolete());
		footprint.append(getDescription());
		footprint.append(getGuards());
		footprint.append(getBrands());
		footprint.append(getAccessOperation());
		return MD5Util.getMD5Hash(footprint);
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy