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

org.molgenis.omx.xgap.Polymorphism Maven / Gradle / Ivy

There is a newer version: 1.3.0
Show newest version

/* File:        org.molgenis.omx/model/Polymorphism.java
 * Generator:   org.molgenis.generators.DataTypeGen 4.0.0-testing
 *
 * THIS FILE HAS BEEN GENERATED, PLEASE DO NOT EDIT!
 */
 

package org.molgenis.omx.xgap;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import org.molgenis.data.AttributeMetaData;
import org.molgenis.data.support.MapEntity;
import org.molgenis.data.Entity;

/**
 * Polymorphism: The difference of a single base discovered between two sequenced individuals..
 * @author MOLGENIS generator
 */
@javax.persistence.Entity
@javax.persistence.Table(name = "Polymorphism"
)

@javax.xml.bind.annotation.XmlAccessorType(javax.xml.bind.annotation.XmlAccessType.FIELD)
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value={"EI_EXPOSE_REP", "EI_EXPOSE_REP2"}, justification="Exposing internal representation is accepted")
public class Polymorphism extends org.molgenis.omx.observ.ObservationTarget implements org.molgenis.data.Entity
{
    /** default serial version ID */
    private static final long serialVersionUID = 1L;
    
    public final static String ENTITY_NAME = "Polymorphism";
    
	// fieldname constants
	public final static String BASE = "Base";
	public final static String VALUE = "Value";
	public final static String ID = "id";
	
	// member variables (including setters.getters for interface)
	public String getEntityName()
	{
		return ENTITY_NAME;
	}
	

	//The affected DNA base. Note that you can select the reference base here.[type=enum]

	@javax.persistence.Column(name="Base", nullable=false)
	@javax.xml.bind.annotation.XmlElement(name="base")
	
				

	@javax.validation.constraints.NotNull
	private String base =  null;
	@javax.persistence.Transient
	private String base_label = null;
	@javax.persistence.Transient
	private static final java.util.List base_options;
	
	static {
		base_options = new java.util.ArrayList();
		base_options.add(new org.molgenis.util.ValueLabel("Reference","Reference"));
		base_options.add(new org.molgenis.util.ValueLabel("A","A"));
		base_options.add(new org.molgenis.util.ValueLabel("T","T"));
		base_options.add(new org.molgenis.util.ValueLabel("C","C"));
		base_options.add(new org.molgenis.util.ValueLabel("G","G"));
	}

	//The strain/genotype for which this polymorphism was discovered. E.g. 'N2' or 'CB4856'.[type=string]

	@javax.persistence.Column(name="Value", length=255)
	@javax.xml.bind.annotation.XmlElement(name="value")
	
				

	private String value =  null;

	//automatically generated internal id, only for internal use.[type=int]

	

	//constructors
	public Polymorphism()
	{
		//set the type for a new instance
		set__Type(this.getClass().getSimpleName());
	}
	
	//getters and setters
	/**
	 * Get the The affected DNA base. Note that you can select the reference base here..
	 * @return base.
	 */
	public String getBase()
	{
		return this.base;
	}	
	
	/**
	 * Set the The affected DNA base. Note that you can select the reference base here..
	 * @param base
	 */
	public void setBase( String base)
	{
		
		this.base = base;
	}

	
	/**
	 * Get tha label for enum Base.
	 */
	public String getBaseLabel()
	{
		return this.base_label;
	}
	/**
	 * Base is enum. This method returns all available enum options.
	 */
	public java.util.List getBaseOptions()
	{
		return base_options;
	}	
	

	/**
	 * Get the The strain/genotype for which this polymorphism was discovered. E.g. 'N2' or 'CB4856'..
	 * @return value.
	 */
	public String getValue()
	{
		return this.value;
	}	
	
	/**
	 * Set the The strain/genotype for which this polymorphism was discovered. E.g. 'N2' or 'CB4856'..
	 * @param value
	 */
	public void setValue( String value)
	{
		
		this.value = value;
	}

	

	

	


	/**
	 * Generic getter. Get the property by using the name.
	 */
	@Override
	public Object get(String name)
	{
		name = name.toLowerCase();
		if (name.equals("id"))
			return getId();
		if (name.equals("identifier"))
			return getIdentifier();
		if (name.equals("name"))
			return getName();
		if (name.equals("__type"))
			return get__Type();
		if(name.equals("__type_label"))
			return get__TypeLabel();			
		if (name.equals("description"))
			return getDescription();
		if (name.equals("base"))
			return getBase();
		if(name.equals("base_label"))
			return getBaseLabel();			
		if (name.equals("value"))
			return getValue();
		return null;
	}	
	
	@Override
	public void set(org.molgenis.data.Entity entity, boolean strict)
	{
		//set Id
		// query formal name, else lowercase name
		if(entity.getInt("id") != null) this.setId(entity.getInt("id"));
		else if(entity.getInt("id") != null) this.setId(entity.getInt("id"));
		else if(strict) this.setId(entity.getInt("id")); // setting null is not an option due to function overloading
		if( entity.getInt("polymorphism_id") != null) this.setId(entity.getInt("polymorphism_id"));
		else if( entity.getInt("Polymorphism_id") != null) this.setId(entity.getInt("Polymorphism_id"));
		//set Identifier
		// query formal name, else lowercase name
		if(entity.getString("identifier") != null) this.setIdentifier(entity.getString("identifier"));
		else if(entity.getString("Identifier") != null) this.setIdentifier(entity.getString("Identifier"));
		else if(strict) this.setIdentifier(entity.getString("identifier")); // setting null is not an option due to function overloading
		if( entity.getString("polymorphism_identifier") != null) this.setIdentifier(entity.getString("polymorphism_identifier"));
		else if( entity.getString("Polymorphism_Identifier") != null) this.setIdentifier(entity.getString("Polymorphism_Identifier"));
		//set Name
		// query formal name, else lowercase name
		if(entity.getString("name") != null) this.setName(entity.getString("name"));
		else if(entity.getString("Name") != null) this.setName(entity.getString("Name"));
		else if(strict) this.setName(entity.getString("name")); // setting null is not an option due to function overloading
		if( entity.getString("polymorphism_name") != null) this.setName(entity.getString("polymorphism_name"));
		else if( entity.getString("Polymorphism_Name") != null) this.setName(entity.getString("Polymorphism_Name"));
		//set __Type
		// query formal name, else lowercase name
		if(entity.getString("__type") != null) this.set__Type(entity.getString("__type"));
		else if(entity.getString("__Type") != null) this.set__Type(entity.getString("__Type"));
		else if(strict) this.set__Type(entity.getString("__type")); // setting null is not an option due to function overloading
		if( entity.getString("polymorphism___type") != null) this.set__Type(entity.getString("polymorphism___type"));
		else if( entity.getString("Polymorphism___Type") != null) this.set__Type(entity.getString("Polymorphism___Type"));
		//set Description
		// query formal name, else lowercase name
		if(entity.getString("description") != null) this.setDescription(entity.getString("description"));
		else if(entity.getString("description") != null) this.setDescription(entity.getString("description"));
		else if(strict) this.setDescription(entity.getString("description")); // setting null is not an option due to function overloading
		if( entity.getString("polymorphism_description") != null) this.setDescription(entity.getString("polymorphism_description"));
		else if( entity.getString("Polymorphism_description") != null) this.setDescription(entity.getString("Polymorphism_description"));
		//set Base
		// query formal name, else lowercase name
		if(entity.getString("base") != null) this.setBase(entity.getString("base"));
		else if(entity.getString("Base") != null) this.setBase(entity.getString("Base"));
		else if(strict) this.setBase(entity.getString("base")); // setting null is not an option due to function overloading
		if( entity.getString("polymorphism_base") != null) this.setBase(entity.getString("polymorphism_base"));
		else if( entity.getString("Polymorphism_Base") != null) this.setBase(entity.getString("Polymorphism_Base"));
		//set Value
		// query formal name, else lowercase name
		if(entity.getString("value") != null) this.setValue(entity.getString("value"));
		else if(entity.getString("Value") != null) this.setValue(entity.getString("Value"));
		else if(strict) this.setValue(entity.getString("value")); // setting null is not an option due to function overloading
		if( entity.getString("polymorphism_value") != null) this.setValue(entity.getString("polymorphism_value"));
		else if( entity.getString("Polymorphism_Value") != null) this.setValue(entity.getString("Polymorphism_Value"));
	}
	
	@Override
	public String toString()
	{
		return this.toString(false);
	}
	
	public String toString(boolean verbose)
	{
		StringBuilder sb = new StringBuilder("Polymorphism(");
		sb.append("id='" + getId()+"' ");	
		sb.append("identifier='" + getIdentifier()+"' ");	
		sb.append("name='" + getName()+"' ");	
		sb.append("__Type='" + get__Type()+"' ");	
		sb.append("description='" + getDescription()+"' ");	
		sb.append("base='" + getBase()+"' ");	
		sb.append("value='" + getValue()+"'");	
		sb.append(");");
		return sb.toString();
	}

	@Override
	public Integer getIdValue()
	{
		return getId();
	}		
	
	//2
    @javax.persistence.ManyToMany(fetch=javax.persistence.FetchType.LAZY, mappedBy="polymorphism"/*, cascade={javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}*/)
    private java.util.Collection polymorphismSNPCollection;

	@javax.xml.bind.annotation.XmlTransient
	public java.util.Collection getPolymorphismSNPCollection()
	{
		if(polymorphismSNPCollection == null) polymorphismSNPCollection = new java.util.ArrayList(); 
        return polymorphismSNPCollection;
	}


    public void setPolymorphismSNPCollection(java.util.Collection collection)
    {
		if(polymorphismSNPCollection == null) polymorphismSNPCollection = new java.util.ArrayList();
    	polymorphismSNPCollection.addAll(collection);
    }	

	@Override
	public Iterable getAttributeNames()
	{
		Set attributeNames = new LinkedHashSet();
		for (AttributeMetaData attr : new PolymorphismMetaData().getAttributes())
		{
			attributeNames.add(attr.getName());
		}

		return attributeNames;
	}
	
	@Override
	public java.util.List getLabelAttributeNames()
	{
		java.util.List result = new java.util.ArrayList();
		result.add("Identifier");
		return result;
	}

	@Override
	public void set(String attributeName, Object value)
	{
		if("id".equalsIgnoreCase(attributeName)) {
			this.setId((Integer)value); 
			return;
		}
		if("Identifier".equalsIgnoreCase(attributeName)) {
			this.setIdentifier((String)value); 
			return;
		}
		if("Name".equalsIgnoreCase(attributeName)) {
			this.setName((String)value); 
			return;
		}
		if("__Type".equalsIgnoreCase(attributeName)) {
			this.set__Type((String)value); 
			return;
		}
		if("description".equalsIgnoreCase(attributeName)) {
			this.setDescription((String)value); 
			return;
		}
		if("Base".equalsIgnoreCase(attributeName)) {
			this.setBase((String)value); 
			return;
		}
		if("Value".equalsIgnoreCase(attributeName)) {
			this.setValue((String)value); 
			return;
		}
	}

	@Override
	public boolean equals(Object obj)
	{
		if (this == obj) return true;
		if (obj == null) return false;
		if (!super.equals(obj)) return false;
		if (getClass() != obj.getClass()) return false;
		return true;
	}
	
	@Override
	public int hashCode()
	{
		int result = super.hashCode();
		return result;
	}
	
	@Override
	public org.molgenis.data.EntityMetaData getEntityMetaData()
	{
		return new PolymorphismMetaData();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy