org.molgenis.omx.xgap.Transcript Maven / Gradle / Ivy
/* File: org.molgenis.omx/model/Transcript.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;
/**
* Transcript: Trait annotations specific for transcripts.
.
* @author MOLGENIS generator
*/
@javax.persistence.Entity
@javax.persistence.Table(name = "Transcript"
)
@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 Transcript 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 = "Transcript";
// fieldname constants
public final static String GENE = "Gene";
public final static String ID = "id";
// member variables (including setters.getters for interface)
public String getEntityName()
{
return ENTITY_NAME;
}
//The gene that produces this protein[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="Gene")
private org.molgenis.omx.xgap.Gene gene = null;
//automatically generated internal id, only for internal use.[type=int]
//constructors
public Transcript()
{
//set the type for a new instance
set__Type(this.getClass().getSimpleName());
}
//getters and setters
/**
* Get the The gene that produces this protein.
* @return gene.
*/
public org.molgenis.omx.xgap.Gene getGene()
{
return this.gene;
}
/**
* Set the The gene that produces this protein.
* @param gene
*/
public void setGene( org.molgenis.omx.xgap.Gene gene)
{
this.gene = gene;
}
/**
* 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("gene"))
return getGene();
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("transcript_id") != null) this.setId(entity.getInt("transcript_id"));
else if( entity.getInt("Transcript_id") != null) this.setId(entity.getInt("Transcript_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("transcript_identifier") != null) this.setIdentifier(entity.getString("transcript_identifier"));
else if( entity.getString("Transcript_Identifier") != null) this.setIdentifier(entity.getString("Transcript_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("transcript_name") != null) this.setName(entity.getString("transcript_name"));
else if( entity.getString("Transcript_Name") != null) this.setName(entity.getString("Transcript_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("transcript___type") != null) this.set__Type(entity.getString("transcript___type"));
else if( entity.getString("Transcript___Type") != null) this.set__Type(entity.getString("Transcript___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("transcript_description") != null) this.setDescription(entity.getString("transcript_description"));
else if( entity.getString("Transcript_description") != null) this.setDescription(entity.getString("Transcript_description"));
//set Gene
// query formal name, else lowercase name
if( entity.getEntity("Gene", org.molgenis.omx.xgap.Gene.class) != null) {
this.setGene(entity.getEntity("Gene", org.molgenis.omx.xgap.Gene.class));
}
else if( entity.getEntity("gene", org.molgenis.omx.xgap.Gene.class) != null) {
this.setGene(entity.getEntity("gene", org.molgenis.omx.xgap.Gene.class));
}
else if( entity.getEntity("Transcript_Gene", org.molgenis.omx.xgap.Gene.class) != null) {
this.setGene(entity.getEntity("Transcript_Gene", org.molgenis.omx.xgap.Gene.class));
}
else if( entity.getEntity("transcript_gene", org.molgenis.omx.xgap.Gene.class) != null) {
this.setGene(entity.getEntity("Transcript_Gene", org.molgenis.omx.xgap.Gene.class));
}
}
@Override
public String toString()
{
return this.toString(false);
}
public String toString(boolean verbose)
{
StringBuilder sb = new StringBuilder("Transcript(");
sb.append("id='" + getId()+"' ");
sb.append("identifier='" + getIdentifier()+"' ");
sb.append("name='" + getName()+"' ");
sb.append("__Type='" + get__Type()+"' ");
sb.append("description='" + getDescription()+"' ");
sb.append("gene='" + getGene()+"'");
sb.append(");");
return sb.toString();
}
@Override
public Integer getIdValue()
{
return getId();
}
@Override
public Iterable getAttributeNames()
{
Set attributeNames = new LinkedHashSet();
for (AttributeMetaData attr : new TranscriptMetaData().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("Gene".equalsIgnoreCase(attributeName)) {
org.molgenis.omx.xgap.Gene e = new org.molgenis.omx.xgap.Gene();
e.set((Entity)value);
this.setGene(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 TranscriptMetaData();
}
}