@Override public void onImexIdAssigned(Publication intactPublication, String imex) { String pubId = intactPublication.getPubmedId() != null ? intactPublication.getPubmedId() : intactPublication.getDoi(); if (pubId == null && !intactPublication.getIdentifiers().isEmpty()){ Xref id = intactPublication.getXrefs().iterator().next(); pubId = id.getId(); } NewAssignedImexEvent evt = new NewAssignedImexEvent(this, pubId, imex, null, null); getImexCentralManager().fireOnNewImexAssigned(evt); }
@Override public void onPublicationWhichCannotBeRegistered(Publication intactPublication) { String pubId = intactPublication.getPubmedId() != null ? intactPublication.getPubmedId() : intactPublication.getDoi(); if (pubId == null && !intactPublication.getIdentifiers().isEmpty()){ Xref id = intactPublication.getXrefs().iterator().next(); pubId = id.getId(); } // unassigned publication, cannot use the webservice to automatically assign IMEx id for now, ask the curator to manually register and assign IMEx id to this publication if (!Pattern.matches(ImexCentralManager.PUBMED_REGEXP.toString(), pubId)){ log.warn("It is not possible to register an unassigned publication. " + "The publication needs to be registered manually by a curator in IMEx central."); } // the publication is already registered, we just update status and users else { ImexErrorEvent evt = new ImexErrorEvent(this, ImexErrorType.no_record_created, pubId, null, null, null, "It is not possible to register the publication " + pubId + " in IMEx central."); getImexCentralManager().fireOnImexError(evt); } // do not update experiments and interactions getImexCentralManager().setEnableExperimentsAndInteractionsUpdate(false); }
@Override public void onMissingImexId(Publication intactPublication) { String pubId = intactPublication.getPubmedId() != null ? intactPublication.getPubmedId() : intactPublication.getDoi(); if (pubId == null && !intactPublication.getIdentifiers().isEmpty()){ Xref id = intactPublication.getXrefs().iterator().next(); pubId = id.getId(); } ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.no_IMEX_id, pubId, null, null, null, "Publication " + ((IntactPublication)intactPublication).getAc() + " does not have a valid IMEx id and is ignored."); imexCentralManager.fireOnImexError(errorEvt); // do not update experiments and interactions getImexCentralManager().setEnableExperimentsAndInteractionsUpdate(false); }
@Override public void onImexIdConflicts(Publication intactPublication, Collection<Xref> conflictingXrefs) { String pubId = intactPublication.getPubmedId() != null ? intactPublication.getPubmedId() : intactPublication.getDoi(); if (pubId == null && !intactPublication.getIdentifiers().isEmpty()){ Xref id = intactPublication.getXrefs().iterator().next(); pubId = id.getId(); } ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.publication_imex_conflict, pubId, null, null, null, "Publication " + pubId + " cannot be updated because of IMEx identifier conflicts."); getImexCentralManager().fireOnImexError(errorEvt); // do not update experiments and interactions getImexCentralManager().setEnableExperimentsAndInteractionsUpdate(false); }
@Override public void onPublicationAlreadyRegisteredInImexCentral(Publication intactPublication, String imex) { String pubId = intactPublication.getPubmedId() != null ? intactPublication.getPubmedId() : intactPublication.getDoi(); if (pubId == null && !intactPublication.getIdentifiers().isEmpty()){ Xref id = intactPublication.getXrefs().iterator().next(); pubId = id.getId(); } // we already have an IMEx id in IMEx central, it is not possible to update the intact publication because we have a conflict ImexErrorEvent evt = new ImexErrorEvent(this, ImexErrorType.publication_already_in_imex, pubId, imex, null, null, "It is not possible to assign a valid IMEx id to the publication " + pubId + " because it already registered in IMEx central with another institution"); getImexCentralManager().fireOnImexError(evt); // do not update experiments and interactions getImexCentralManager().setEnableExperimentsAndInteractionsUpdate(false); }
/*** * This method will copy properties of publication source in publication target and will override all the other properties of Target publication. * This method will ignore experiments * @param source * @param target */ public static void copyAndOverridePublicationProperties(Publication source, Publication target){ if (source != null && target != null){ target.setCurationDepth(source.getCurationDepth()); target.setJournal(source.getJournal()); target.setReleasedDate(source.getReleasedDate()); target.setTitle(source.getTitle()); target.setPublicationDate(source.getPublicationDate()); target.setSource(source.getSource()); // copy collections target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getIdentifiers().clear(); target.getIdentifiers().addAll(source.getIdentifiers()); target.getAuthors().clear(); target.getAuthors().addAll(source.getAuthors()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); } }
@Override public void onImexIdNotRecognized(Publication intactPublication, String imex) { String pubId = intactPublication.getPubmedId() != null ? intactPublication.getPubmedId() : intactPublication.getDoi(); if (pubId == null && !intactPublication.getIdentifiers().isEmpty()){ Xref id = intactPublication.getXrefs().iterator().next(); pubId = id.getId(); } ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.imex_not_recognized, pubId, imex, null, null, "Publication " + ((IntactPublication)intactPublication).getAc() + " is not matching any record in IMEx central with id " + imex); getImexCentralManager().fireOnImexError(errorEvt); // do not update experiments and interactions getImexCentralManager().setEnableExperimentsAndInteractionsUpdate(false); }
private void checkPublication(Collection<ValidatorMessage> messages, Publication p, Experiment parent) throws ValidatorException { Collection<ValidatorMessage> confMessages = this.publicationRuleWrapper.check(p); // validate with other rules if any if (!getObjectRules().isEmpty()){ messages.addAll(super.validate(p)); } // add context for (ValidatorMessage message : confMessages){ ((MiContext)message.getContext()).addAssociatedContext(RuleUtils.buildContext(parent, "experiment")); messages.add(message); } // validate identifier for (Xref ref : p.getIdentifiers()){ checkXref(messages, ref, p, "publication"); } // validate xref for (Xref ref : p.getXrefs()){ checkXref(messages, ref, p, "publication"); } // validate annotations for (Annotation a : p.getAnnotations()){ checkAnnotation(messages, a, p, "publication"); } }
String source = publication.getPubmedId() != null ? Xref.PUBMED : Xref.DOI; if (pubId == null && !publication.getIdentifiers().isEmpty()){ Xref id = publication.getXrefs().iterator().next(); source = id.getDatabase().getShortName(); pubId = id.getId();