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

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

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** CustomActionDefDocument.java                                             ***
 *** generated by AnoSiteGenerator (ASG), Version: 2.6.3                      ***
 *** Copyright (C) 2005 - 2010 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 net.anotheria.util.crypt.MD5Util;
import net.anotheria.util.sorter.IComparable;
import net.anotheria.util.BasicComparable;


public class CustomActionDefDocument extends AbstractASGDocument implements CustomActionDef, IComparable{

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

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

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

	CustomActionDefDocument(CustomActionDefBuilder builder){
		super("");
		setName(builder.name);
		setClazz(builder.clazz);
		setAccessOperation(builder.accessOperation);
	}

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

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

	public String getClazz(){
		return getString(PROP_CLAZZ);
	}

	public void setClazz(String value){
		setString(PROP_CLAZZ, 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 = "CustomActionDef ";
		ret += "["+getId()+"] ";
		ret += "name: "+getName();
		ret += ", ";
		ret += "clazz: "+getClazz();
		return ret;
	}


	public int compareTo(CustomActionDef comparable){
		return compareTo(comparable, CustomActionDefSortType.SORT_BY_DEFAULT);
	}

	public int compareTo(IComparable anotherComparable, int method){
		CustomActionDefDocument anotherDoc = (CustomActionDefDocument) anotherComparable;
		switch(method){
			case CustomActionDefSortType.SORT_BY_ID:
				return BasicComparable.compareString(getId(), anotherDoc.getId());
			case CustomActionDefSortType.SORT_BY_NAME:
				return BasicComparable.compareString(getName(), anotherDoc.getName());
			case CustomActionDefSortType.SORT_BY_CLAZZ:
				return BasicComparable.compareString(getClazz(), anotherDoc.getClazz());
			case CustomActionDefSortType.SORT_BY_ACCESSOPERATION:
				return BasicComparable.compareString(getAccessOperation(), anotherDoc.getAccessOperation());
			default:
				throw new RuntimeException("Sort method "+method+" is not supported.");
		}
	}

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

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

	public String getFootprint(){
		StringBuilder footprint = new StringBuilder();
		footprint.append(getName());
		footprint.append(getClazz());
		footprint.append(getAccessOperation());
		return MD5Util.getMD5Hash(footprint);
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy