From: <rv...@us...> - 2010-03-15 01:16:49
|
Revision: 581 http://treebase.svn.sourceforge.net/treebase/?rev=581&view=rev Author: rvos Date: 2010-03-15 01:16:43 +0000 (Mon, 15 Mar 2010) Log Message: ----------- Added getAnnotations() for nexml and rdf serialization. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTree.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTree.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTree.java 2010-03-15 01:15:19 UTC (rev 580) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTree.java 2010-03-15 01:16:43 UTC (rev 581) @@ -4,6 +4,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Set; import javax.persistence.AttributeOverride; @@ -25,9 +26,11 @@ import mesquite.lib.MesquiteDouble; import mesquite.lib.StringUtil; +import org.cipres.treebase.Constants; import org.cipres.treebase.TreebaseIDString; import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.AbstractPersistedObject; +import org.cipres.treebase.domain.Annotation; import org.cipres.treebase.domain.TBPersistable; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.taxon.TaxonLabel; @@ -227,6 +230,7 @@ * * @return String */ + @Override @Column(name = "Label", length = TBPersistable.COLUMN_LENGTH_STRING) public String getLabel() { return mLabel; @@ -778,4 +782,26 @@ setRootNode(null); setNewickString(null); } + + @Transient + public List<Annotation> getAnnotations() { + List<Annotation> annotations = super.getAnnotations(); + if ( null != getId() ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.tree", getId())); + } + if ( null != getKindDescription() ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:kind.tree", getKindDescription())); + } + if ( null != getTypeDescription() ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:type.tree", getTypeDescription())); + } + if ( null != getQualityDescription() ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:quality.tree", getQualityDescription())); + } + if ( null != getnTax() ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:ntax.tree", getnTax())); + } + return annotations; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |