/** * Syncs a short label with the database, checking that there are no duplicates and that the correct suffix is added. * <p/> * Concurrency note: just after getting the new short label, it is recommended to persist/update the interaction immediately * in the database - so this method should ONLY be used before saving the interaction to the database. In some * race conditions, two interactions could be created with the same id; currently there is no way to * reserve a short label * * @param shortLabel the short label to sync * @return the synced short label * @since 1.6.2 */ @Deprecated public static String syncShortLabelWithDb(String shortLabel) { return syncShortLabelWithDb(shortLabel, null); }
/** * Syncs a short label with the database, checking that there are no duplicates and that the correct suffix is added. * <p/> * Concurrency note: just after getting the new short label, it is recommended to persist/update the interaction immediately * in the database - so this method should ONLY be used before saving the interaction to the database. In some * race conditions, two interactions could be created with the same id; currently there is no way to * reserve a short label * * @param shortLabel the short label to sync * @return the synced short label * @since 1.6.2 */ @Deprecated public static String syncShortLabelWithDb(String shortLabel) { return syncShortLabelWithDb(shortLabel, null); }
protected void updateShortLabel(Experiment experiment) { String shortLabel = experiment.getShortLabel(); String newShortLabel = ExperimentUtils.syncShortLabelWithDb(shortLabel); if (!shortLabel.equals(newShortLabel)) { if (log.isDebugEnabled()) log.debug("Experiment with label '"+shortLabel+"' renamed '"+newShortLabel+"'" ); experiment.setShortLabel(newShortLabel); } }
experimentShortlabel = ExperimentUtils.syncShortLabelWithDb(experimentShortlabel, pubmedID);
@PrePersist public void synchronizeShortLabel() { if( IntactContext.currentInstanceExists() ) { if( IntactContext.getCurrentInstance().getConfig().isAutoUpdateExperimentLabel() ) { String shortLabel = getShortLabel(); String newShortLabel = shortLabel; try { newShortLabel = ExperimentUtils.syncShortLabelWithDb(shortLabel, ExperimentUtils.getPubmedId( this )); } catch (Exception e) { log.error("Exception synchronizing the label, probably due to an invalid format: "+newShortLabel, e); } if (!shortLabel.equals(newShortLabel)) { if (log.isDebugEnabled()) log.debug("Experiment with label '"+shortLabel+"' renamed '"+newShortLabel+"'" ); setShortLabel(newShortLabel); } } } else { log.warn( "There is no IntAct Context initialized, skipping experiment shortlabel synchronization." ); } }
@PrePersist public void synchronizeShortLabel() { if( IntactContext.currentInstanceExists() ) { if( IntactContext.getCurrentInstance().getConfig().isAutoUpdateExperimentLabel() ) { String shortLabel = getShortLabel(); String newShortLabel = shortLabel; try { newShortLabel = ExperimentUtils.syncShortLabelWithDb(shortLabel, ExperimentUtils.getPubmedId( this )); } catch (Exception e) { log.error("Exception synchronizing the label, probably due to an invalid format: "+newShortLabel, e); } if (!shortLabel.equals(newShortLabel)) { if (log.isDebugEnabled()) log.debug("Experiment with label '"+shortLabel+"' renamed '"+newShortLabel+"'" ); setShortLabel(newShortLabel); } } } else { log.warn( "There is no IntAct Context initialized, skipping experiment shortlabel synchronization." ); } }