/** * Checks if there is only one value, and then if this value is an accession returns true */ private static boolean isQuerySearchingOnlyOneAc( String[] values ) { if ( values.length > 1 || values.length == 0 ) { return false; } String value = values[0]; String institutionPrefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); return ( value.toUpperCase().startsWith( institutionPrefix ) && !value.endsWith( "%" ) ); }
/** * Checks if there is only one value, and then if this value is an accession returns true */ private static boolean isQuerySearchingOnlyOneAc(String[] values) { if (values.length > 1 || values.length == 0) { return false; } String value = values[0]; String institutionPrefix = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); return (value.toUpperCase().startsWith(institutionPrefix) && !value.endsWith("%")); }
/** * 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 = IntactContext.getCurrentInstance().getConfig().getAcPrefix(); String id = prefix + "-" + super.generate( sessionImplementor, object ); log.trace( "Assigning Id: " + id ); return id; }
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 ); } }