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

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

There is a newer version: 1.3.0
Show newest version

/* File:        org.molgenis.omx/model/Sample.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;

/**
 * Sample: .
 * @author MOLGENIS generator
 */
@javax.persistence.Entity
@javax.persistence.Table(name = "Sample"
)

@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 Sample 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 = "Sample";
    
	// fieldname constants
	public final static String INDIVIDUAL = "Individual";
	public final static String TISSUE = "Tissue";
	public final static String ID = "id";
	
	// member variables (including setters.getters for interface)
	public String getEntityName()
	{
		return ENTITY_NAME;
	}
	

	//The individual from which this sample was taken.[type=xref]

    @javax.persistence.ManyToOne(fetch=javax.persistence.FetchType.EAGER /*cascade={javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}*/)
    @javax.persistence.JoinColumn(name="Individual")  
	
				

	private org.molgenis.omx.observ.target.Individual individual = null;

	//The tissue from which this sample was taken.[type=xref]

    @javax.persistence.ManyToOne(fetch=javax.persistence.FetchType.EAGER /*cascade={javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.PERSIST, javax.persistence.CascadeType.REFRESH}*/)
    @javax.persistence.JoinColumn(name="Tissue")  
	
				

	private org.molgenis.omx.observ.target.OntologyTerm tissue = null;

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

	

	//constructors
	public Sample()
	{
		//set the type for a new instance
		set__Type(this.getClass().getSimpleName());
	}
	
	//getters and setters
	/**
	 * Get the The individual from which this sample was taken..
	 * @return individual.
	 */
	public org.molgenis.omx.observ.target.Individual getIndividual()
	{
		return this.individual;
	}	
	
	/**
	 * Set the The individual from which this sample was taken..
	 * @param individual
	 */
	public void setIndividual( org.molgenis.omx.observ.target.Individual individual)
	{
		
		this.individual = individual;
	}

	

	/**
	 * Get the The tissue from which this sample was taken..
	 * @return tissue.
	 */
	public org.molgenis.omx.observ.target.OntologyTerm getTissue()
	{
		return this.tissue;
	}	
	
	/**
	 * Set the The tissue from which this sample was taken..
	 * @param tissue
	 */
	public void setTissue( org.molgenis.omx.observ.target.OntologyTerm tissue)
	{
		
		this.tissue = tissue;
	}

	

	

	


	/**
	 * 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("individual"))
			return getIndividual();
		if (name.equals("tissue"))
			return getTissue();
		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("sample_id") != null) this.setId(entity.getInt("sample_id"));
		else if( entity.getInt("Sample_id") != null) this.setId(entity.getInt("Sample_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("sample_identifier") != null) this.setIdentifier(entity.getString("sample_identifier"));
		else if( entity.getString("Sample_Identifier") != null) this.setIdentifier(entity.getString("Sample_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("sample_name") != null) this.setName(entity.getString("sample_name"));
		else if( entity.getString("Sample_Name") != null) this.setName(entity.getString("Sample_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("sample___type") != null) this.set__Type(entity.getString("sample___type"));
		else if( entity.getString("Sample___Type") != null) this.set__Type(entity.getString("Sample___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("sample_description") != null) this.setDescription(entity.getString("sample_description"));
		else if( entity.getString("Sample_description") != null) this.setDescription(entity.getString("Sample_description"));
		//set Individual
		// query formal name, else lowercase name
		if( entity.getEntity("Individual", org.molgenis.omx.observ.target.Individual.class) != null) { 
			this.setIndividual(entity.getEntity("Individual", org.molgenis.omx.observ.target.Individual.class));				
		}
		else if( entity.getEntity("individual", org.molgenis.omx.observ.target.Individual.class) != null) { 
			this.setIndividual(entity.getEntity("individual", org.molgenis.omx.observ.target.Individual.class));				
		}
		else if( entity.getEntity("Sample_Individual", org.molgenis.omx.observ.target.Individual.class) != null) { 
			this.setIndividual(entity.getEntity("Sample_Individual", org.molgenis.omx.observ.target.Individual.class));				
		}
		else if( entity.getEntity("sample_individual", org.molgenis.omx.observ.target.Individual.class) != null) { 
			this.setIndividual(entity.getEntity("Sample_Individual", org.molgenis.omx.observ.target.Individual.class));				
		}
		//set Tissue
		// query formal name, else lowercase name
		if( entity.getEntity("Tissue", org.molgenis.omx.observ.target.OntologyTerm.class) != null) { 
			this.setTissue(entity.getEntity("Tissue", org.molgenis.omx.observ.target.OntologyTerm.class));				
		}
		else if( entity.getEntity("tissue", org.molgenis.omx.observ.target.OntologyTerm.class) != null) { 
			this.setTissue(entity.getEntity("tissue", org.molgenis.omx.observ.target.OntologyTerm.class));				
		}
		else if( entity.getEntity("Sample_Tissue", org.molgenis.omx.observ.target.OntologyTerm.class) != null) { 
			this.setTissue(entity.getEntity("Sample_Tissue", org.molgenis.omx.observ.target.OntologyTerm.class));				
		}
		else if( entity.getEntity("sample_tissue", org.molgenis.omx.observ.target.OntologyTerm.class) != null) { 
			this.setTissue(entity.getEntity("Sample_Tissue", org.molgenis.omx.observ.target.OntologyTerm.class));				
		}
	}
	
	@Override
	public String toString()
	{
		return this.toString(false);
	}
	
	public String toString(boolean verbose)
	{
		StringBuilder sb = new StringBuilder("Sample(");
		sb.append("id='" + getId()+"' ");	
		sb.append("identifier='" + getIdentifier()+"' ");	
		sb.append("name='" + getName()+"' ");	
		sb.append("__Type='" + get__Type()+"' ");	
		sb.append("description='" + getDescription()+"' ");	
		sb.append("individual='" + getIndividual()+"' ");	
		sb.append("tissue='" + getTissue()+"'");	
		sb.append(");");
		return sb.toString();
	}

	@Override
	public Integer getIdValue()
	{
		return getId();
	}		
	

	@Override
	public Iterable getAttributeNames()
	{
		Set attributeNames = new LinkedHashSet();
		for (AttributeMetaData attr : new SampleMetaData().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("Individual".equalsIgnoreCase(attributeName)) {
			org.molgenis.omx.observ.target.Individual e = new org.molgenis.omx.observ.target.Individual();
			e.set((Entity)value);
			this.setIndividual(e); 
			return;
		}
		if("Tissue".equalsIgnoreCase(attributeName)) {
			org.molgenis.omx.observ.target.OntologyTerm e = new org.molgenis.omx.observ.target.OntologyTerm();
			e.set((Entity)value);
			this.setTissue(e); 
			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 SampleMetaData();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy