public void createPublication( Publication publication ) throws ImexCentralException { Publication existingP = null; for ( Publication p : allPublications ) { for (Identifier i : p.getIdentifier()){ if( !publication.getIdentifier().isEmpty() && publication.getIdentifier().iterator().next().getAc().equals( i.getAc() ) ) { existingP = p; break; } } } if (existingP == null){ allPublications.add(publication); } else { allPublications.remove(existingP); allPublications.add(publication); } }
public Publication getPublicationById( String identifier ) throws ImexCentralException { for ( Publication p : allPublications ) { for (Identifier i : p.getIdentifier()){ if( identifier.equals( i.getAc() ) ) { return p; } } if (p.getImexAccession() != null && p.getImexAccession().equalsIgnoreCase(identifier)){ return p; } } return null; }
public Publication getPublicationByPubmedId( String identifier ) throws ImexCentralException { for ( Publication p : allPublications ) { for (Identifier i : p.getIdentifier()){ if( "pmid".equalsIgnoreCase(i.getNs()) && identifier.equals( i.getAc() ) ) { return p; } } if (p.getImexAccession() != null && p.getImexAccession().equalsIgnoreCase(identifier)){ return p; } } return null; }
private void copyIdentifiersFromDelegate() { List<Identifier> imexIdentifiers = this.delegate.getIdentifier(); for (Identifier identifier : imexIdentifiers){ if (identifier.getNs() == null || identifier.getAc() == null){ // nothing to do } else if (identifier.getNs().equals("pmid")){ super.getIdentifiers().add(XrefUtils.createPubmedIdentity(identifier.getAc())); } else if (identifier.getNs().equals("imex") && !identifier.getAc().equals("N/A")){ super.getXrefs().add(XrefUtils.createXrefWithQualifier(Xref.IMEX, Xref.IMEX_MI, identifier.getAc(), Xref.IMEX_PRIMARY, Xref.IMEX_PRIMARY_MI)); } else if (identifier.getNs().equals("doi")){ super.getIdentifiers().add(XrefUtils.createDoiIdentity(identifier.getAc())); } else if (identifier.getNs().equals("jint")){ super.getIdentifiers().add(XrefUtils.createIdentityXref("jint", identifier.getAc())); } } if (super.getImexId() == null && this.delegate.getImexAccession() != null && !this.delegate.getImexAccession().equals("N/A")){ super.getXrefs().add(XrefUtils.createXrefWithQualifier(Xref.IMEX, Xref.IMEX_MI, this.delegate.getImexAccession(), Xref.IMEX_PRIMARY, Xref.IMEX_PRIMARY_MI)); } }
id.setAc(id.getAc()); updated = true;