private List<Xref> getXrefs(Map<String, String> sourceMap, int variationId) throws IOException, SQLException { List<String[]> variationSynonyms = variationSynonymFile.getVariationRelatedLines(variationId); List<Xref> xrefs = null; if (variationSynonyms != null && variationSynonyms.size() > 0) { String[] arr; for (String[] variationSynonymFields : variationSynonyms) { // TODO: use constans to identify the fields if (sourceMap.get(variationSynonymFields[3]) != null) { arr = sourceMap.get(variationSynonymFields[3]).split(","); if (xrefs == null) { xrefs = new ArrayList<>(); } xrefs.add(new Xref(variationSynonymFields[4], arr[0])); } } } return xrefs; }
@Override public Xref build() { try { Xref record = new Xref(); record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]); record.source = fieldSetFlags()[1] ? this.source : (java.lang.String) defaultValue(fields()[1]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } }
va.setId(id); xrefs.add(new Xref(id, source));