/** * 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 * @see uk.ac.ebi.intact.model.util.InteractionShortLabelGenerator * @since 1.6 */ public static String syncShortLabelWithDb(String shortLabel) { if (isTemporaryLabel(shortLabel)) { if (log.isDebugEnabled()) log.debug("Label for interaction was temporary (" + shortLabel + "), hence not synced with the database"); return shortLabel; } return InteractionShortLabelGenerator.nextAvailableShortlabel(shortLabel); }
/** * 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 * @see uk.ac.ebi.intact.model.util.InteractionShortLabelGenerator * @since 1.6 */ public static String syncShortLabelWithDb( String shortLabel ) { if (isTemporaryLabel(shortLabel)) { if (log.isWarnEnabled()) log.warn("Label for interaction was temporary ("+shortLabel+"), hence not synced with the database"); return shortLabel; } return InteractionShortLabelGenerator.nextAvailableShortlabel( shortLabel ); }
/** * 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 * @see uk.ac.ebi.intact.model.util.InteractionShortLabelGenerator * @since 1.6 */ public static String syncShortLabelWithDb(String shortLabel) { if (isTemporaryLabel(shortLabel)) { if (log.isDebugEnabled()) log.debug("Label for interaction was temporary (" + shortLabel + "), hence not synced with the database"); return shortLabel; } return InteractionShortLabelGenerator.nextAvailableShortlabel(shortLabel); }