public DefaultFinder(IntactContext intactContext) { config = intactContext.getConfig(); }
public DefaultFinder(IntactContext intactContext) { config = intactContext.getConfig(); }
public DefaultFinder() { config = IntactContext.getCurrentInstance().getConfig(); }
public DefaultFinder() { config = IntactContext.getCurrentInstance().getConfig(); }
/** * Update the shortlabel based on the data available in the database. */ public void synchronizeShortLabel() { if( IntactContext.currentInstanceExists() ) { if( IntactContext.getCurrentInstance().getConfig().isAutoUpdateInteractionLabel() ) { String shortLabel = getShortLabel(); String newShortLabel = InteractionUtils.syncShortLabelWithDb(shortLabel); if (!shortLabel.equals(newShortLabel)) { if (log.isDebugEnabled()) log.debug("Interaction with label '"+shortLabel+"' renamed '"+newShortLabel+"'" ); setShortLabel(newShortLabel); } } } else { log.warn( "There is no IntAct Context initialized, skipping interaction shortlabel synchronization." ); } }
/** * Update the shortlabel based on the data available in the database. */ public void synchronizeShortLabel() { if( IntactContext.currentInstanceExists() ) { if( IntactContext.getCurrentInstance().getConfig().isAutoUpdateInteractionLabel() ) { String shortLabel = getShortLabel(); String newShortLabel = InteractionUtils.syncShortLabelWithDb(shortLabel); if (!shortLabel.equals(newShortLabel)) { if (log.isDebugEnabled()) log.debug("Interaction with label '"+shortLabel+"' renamed '"+newShortLabel+"'" ); setShortLabel(newShortLabel); } } } else { log.warn( "There is no IntAct Context initialized, skipping interaction 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." ); } }
@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." ); } }
@Before public void prepareBasicTest() throws Exception { mockBuilder = new IntactMockBuilder(getIntactContext().getConfig().getDefaultInstitution()); }
/** * The ID is the concatenation of the prefix and a sequence provided by the database, separated * by a dash. * * @param sessionImplementor a hibernate session implementor * @param object the object being persisted * * @return the new generated ID * * @throws HibernateException if something goes wrong */ @Override public Serializable generate( SessionImplementor sessionImplementor, Object object ) throws HibernateException { String prefix; if (IntactContext.currentInstanceExists()) { prefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); } else { prefix = "UNK"; } String id = prefix + "-" + super.generate( sessionImplementor, object ); log.trace( "Assigning Id: " + id ); return id; }
@Before public void prepareBasicTest() throws Exception { mockBuilder = new IntactMockBuilder(getIntactContext().getConfig().getDefaultInstitution()); }
/** * The ID is the concatenation of the prefix and a sequence provided by the database, separated * by a dash. * * @param sessionImplementor a hibernate session implementor * @param object the object being persisted * * @return the new generated ID * * @throws HibernateException if something goes wrong */ @Override public Serializable generate( SessionImplementor sessionImplementor, Object object ) throws HibernateException { String prefix; if (IntactContext.currentInstanceExists()) { prefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); } else { prefix = "UNK"; } String id = prefix + "-" + super.generate( sessionImplementor, object ); log.trace( "Assigning Id: " + id ); return id; }
/** * The local identity is created using a sequence. If the sequence does not exist, a new one is created * with initial value calculated using the maximum integer for the existing local CV identifiers. * @return The next value available * @throws SequenceCreationException thrown if the sequence cannot be created. */ protected String nextLocalIdentifier() throws SequenceCreationException { final IntactContext context = IntactContext.getCurrentInstance(); String prefix = context.getConfig().getLocalCvPrefix(); Integer max = context.getDataContext().getDaoFactory() .getCvObjectDao().getLastCvIdentifierWithPrefix(prefix); if (max == null) max = 0; SequenceManager seqManager = (SequenceManager) context.getSpringContext().getBean("sequenceManager"); seqManager.createSequenceIfNotExists(IntactAuxiliaryConfigurator.CV_LOCAL_SEQ, max+1); String nextIntegerAsString = String.valueOf(seqManager.getNextValueForSequence(IntactAuxiliaryConfigurator.CV_LOCAL_SEQ)); return prefix+":" + StringUtils.leftPad(nextIntegerAsString, 4, "0"); }
/** * The local identity is created using a sequence. If the sequence does not exist, a new one is created * with initial value calculated using the maximum integer for the existing local CV identifiers. * @return The next value available * @throws SequenceCreationException thrown if the sequence cannot be created. */ protected String nextLocalIdentifier() throws SequenceCreationException { final IntactContext context = IntactContext.getCurrentInstance(); String prefix = context.getConfig().getLocalCvPrefix(); Integer max = context.getDataContext().getDaoFactory() .getCvObjectDao().getLastCvIdentifierWithPrefix(prefix); if (max == null) max = 0; SequenceManager seqManager = (SequenceManager) context.getSpringContext().getBean("sequenceManager"); seqManager.createSequenceIfNotExists(IntactAuxiliaryConfigurator.CV_LOCAL_SEQ, max+1); String nextIntegerAsString = String.valueOf(seqManager.getNextValueForSequence(IntactAuxiliaryConfigurator.CV_LOCAL_SEQ)); return prefix+":" + StringUtils.leftPad(nextIntegerAsString, 4, "0"); }
private static void addStartAndEndPercentIfNecessary( QueryTerm term ) { if ( term.hasModifier( QueryModifier.PHRASE_DELIM ) ) { return; } String acPrefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); if ( !term.startsWith( acPrefix ) && !term.hasModifier( QueryModifier.WILDCARD_START ) ) { term.addModifier( QueryModifier.WILDCARD_START ); } if ( !term.startsWith( acPrefix ) && !term.hasModifier( QueryModifier.WILDCARD_END ) ) { term.addModifier( QueryModifier.WILDCARD_END ); } }
private static void addStartAndEndPercentIfNecessary( QueryTerm term ) { if ( term.hasModifier( QueryModifier.PHRASE_DELIM ) ) { return; } String acPrefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); if ( !term.startsWith( acPrefix ) && !term.hasModifier( QueryModifier.WILDCARD_START ) ) { term.addModifier( QueryModifier.WILDCARD_START ); } if ( !term.startsWith( acPrefix ) && !term.hasModifier( QueryModifier.WILDCARD_END ) ) { term.addModifier( QueryModifier.WILDCARD_END ); } }