X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Ffts%2Fservice%2Fthreedbeacons%2FTDB_FTSData.java;fp=src%2Fjalview%2Ffts%2Fservice%2Fthreedbeacons%2FTDB_FTSData.java;h=3045d3dc6181f974046de5ea0f77cd40acde74ac;hb=5e20c0116864d77705d951e35c41a13197791156;hp=0000000000000000000000000000000000000000;hpb=1bad3c3f74b2e204e0d7ba93a745f5ec775c8a3e;p=jalview.git diff --git a/src/jalview/fts/service/threedbeacons/TDB_FTSData.java b/src/jalview/fts/service/threedbeacons/TDB_FTSData.java new file mode 100644 index 0000000..3045d3d --- /dev/null +++ b/src/jalview/fts/service/threedbeacons/TDB_FTSData.java @@ -0,0 +1,158 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ +package jalview.fts.service.threedbeacons; + +import java.util.Map; +import java.util.Objects; + +import jalview.fts.api.FTSData; + +/** + * TDB result bean - holds filtered fields for GUI and essential metadata fields + * for back end + * + * @author jprocter + * + */ +public class TDB_FTSData implements FTSData +{ + String primaryKey; + + Object[] summaryRowData; + + /* + * fields in the JSON object + */ + public static String Uniprot_Id = "id"; + + public static String Uniprot_Start = "uniprot_start"; + + public static String Uniprot_End = "uniprot_end"; + + public static String Provider = "provider"; + + public static String Model_id = "model_identifier"; + + public static String Model_Category = "model_category"; + + public static String Model_Type = "model_type"; + + public static String Model_Title = "model_title"; + + public static String Resolution = "resolution"; + + public static String Confidence = "confidence_avg_local_score"; + + public static String Confidence_Score_Type = "confidence_type"; + + public static String Confidence_Score_Version = "confidence_version"; + + public static String Coverage = "coverage"; + + public static String Sequence_Identity = "sequence_identity"; + + public static String Created_Date = "created"; + + public static String UniProt_Accession = "uniprot_accession"; + + public static String Url = "model_url"; + + public static String Page_URL = "model_page_url"; + + public static String Ensemble_Sample_Url = "ensembl_sample_url"; + + /** + * original response from server + */ + Map tdb_entry; + + public TDB_FTSData(String primaryKey, + Map tdbJsonStructure, Object[] summaryData) + { + this.primaryKey = primaryKey; + tdb_entry = tdbJsonStructure; + this.summaryRowData = summaryData; + } + + public Object getField(String key) + { + return tdb_entry.get(key); + } + + @Override + public Object[] getSummaryData() + { + return summaryRowData; + } + + @Override + public Object getPrimaryKey() + { + return primaryKey; + } + + /** + * Returns a string representation of this object; + */ + @Override + public String toString() + { + StringBuilder summaryFieldValues = new StringBuilder(); + for (Object summaryField : summaryRowData) + { + summaryFieldValues + .append(summaryField == null ? " " : summaryField.toString()) + .append("\t"); + } + return summaryFieldValues.toString(); + } + + /** + * Returns hash code value for this object + */ + @Override + public int hashCode() + { + return Objects.hash(primaryKey, this.toString()); + } + + @Override + public boolean equals(Object that) + { + return this.toString().equals(that.toString()); + } + + public String getProvider() + { + return (String) getField(Provider); + } + + public String getModelViewUrl() + { + return (String) getField(Page_URL); + } + + public String getModelId() + { + return (String) getField(Model_id); + } + +}