/** * Create a new Query ascending order segment for a Property. * * @param <T> type of the Property * @param property a Property * * @return a new Query ascending order segment for a Property. */ public static <T> OrderBy orderBy( final Property<T> property ) { return orderBy( property, OrderBy.Order.ASCENDING ); }
/** * Create a new REGULAR EXPRESSION specification for a Property using a named Variable. * * @param property a Property * @param variable a Query Variable * * @return a new REGULAR EXPRESSION specification for a Property using a named Variable. */ public static MatchesSpecification matches( Property<String> property, Variable variable ) { return new MatchesSpecification( property( property ), variable ); }
/** * Create a new GREATER THAN specification for a Property. * * @param property a Property * @param value its value * * @return a new GREATER THAN specification for a Property. */ public static <T> GtSpecification<T> gt( Property<T> property, T value ) { return new GtSpecification<>( property( property ), value ); }
@Override public Query<X509Profile> findByNamePaginated( String name, int firstResult, int maxResults ) { QueryBuilder<X509Profile> builder = qbf.newQueryBuilder( getBoxedClass() ); builder = builder.where( eq( templateFor( X509Profile.class ).name(), name ) ); Query<X509Profile> query = builder.newQuery( uowf.currentUnitOfWork() ). firstResult( firstResult ). maxResults( maxResults ); return query; }
@Override public X509 findByHexSha256( String hexSha256 ) { QueryBuilder<X509> builder = qbf.newQueryBuilder( X509.class ); builder = builder.where( eq( templateFor( X509.class ).sha256Fingerprint(), hexSha256 ) ); Query<X509> query = builder.newQuery( uowf.currentUnitOfWork() ); assert query.count() <= 1; return Collections.firstElementOrNull( query ); }
@Override public EscrowedKeyPair findByX509Identity( String x509Identity ) { QueryBuilder<EscrowedKeyPair> builder = qbf.newQueryBuilder( EscrowedKeyPair.class ); EscrowedKeyPair ekpTemplate = templateFor( EscrowedKeyPair.class ); builder = builder.where( contains( ekpTemplate.x509s(), x509Repository.findByIdentity( x509Identity ) ) ); Query<EscrowedKeyPair> query = builder.newQuery( uowf.currentUnitOfWork() ); assert query.count() <= 1; return Collections.firstElementOrNull( query ); }
/** * Create a new NULL specification for an Association. * * @param association an Association * * @return a new NULL specification for an Association. */ public static <T> AssociationNullSpecification<T> isNull( Association<T> association ) { return new AssociationNullSpecification<>( association( association ) ); }
/** * Create a new CONTAINS specification for a NamedAssociation. * * @param namedAssoc a NamedAssociation * @param value the value * * @return a new CONTAINS specification for a NamedAssociation. */ public static <T> NamedAssociationContainsSpecification<T> contains( NamedAssociation<T> namedAssoc, T value ) { return new NamedAssociationContainsSpecification<>( namedAssociation( namedAssoc ), value ); }
/** * Create a new LESS OR EQUALS specification for a Property. * * @param property a Property * @param value its value * * @return a new LESS OR EQUALS specification for a Property. */ public static <T> LeSpecification<T> le( Property<T> property, T value ) { return new LeSpecification<>( property( property ), value ); }
/** * Create a new LESSER THAN specification for a Property. * * @param property a Property * @param value its value * * @return a new LESSER THAN specification for a Property. */ public static <T> LtSpecification<T> lt( Property<T> property, T value ) { return new LtSpecification<>( property( property ), value ); }
/** * Create a new NOT EQUALS specification for a Property. * * @param property a Property * @param value its value * * @return a new NOT EQUALS specification for a Property. */ public static <T> NeSpecification<T> ne( Property<T> property, T value ) { return new NeSpecification<>( property( property ), value ); }
/** * Create a new NOT NULL specification for a Property. * * @param property a Property * * @return a new NOT NULL specification for a Property. */ public static <T> PropertyNotNullSpecification<T> isNotNull( Property<T> property ) { return new PropertyNotNullSpecification<>( property( property ) ); }
/** * Create a new CONTAINS specification for a ManyAssociation. * * @param manyAssoc a ManyAssociation * @param value the value * * @return a new CONTAINS specification for a ManyAssociation. */ public static <T> ManyAssociationContainsSpecification<T> contains( ManyAssociation<T> manyAssoc, T value ) { return new ManyAssociationContainsSpecification<>( manyAssociation( manyAssoc ), value ); }
/** * Create a new EQUALS specification for a Property. * * @param property a Property * @param value its value * * @return a new EQUALS specification for a Property. */ public static <T> EqSpecification<T> eq( Property<T> property, T value ) { return new EqSpecification<>( property( property ), value ); }
/** * Create a new GREATER OR EQUALS specification for a Property. * * @param property a Property * @param value its value * * @return a new GREATER OR EQUALS specification for a Property. */ public static <T> GeSpecification<T> ge( Property<T> property, T value ) { return new GeSpecification<>( property( property ), value ); }
/** * Create a new NULL specification for a Property. * * @param property a Property * * @return a new NULL specification for a Property. */ public static <T> PropertyNullSpecification<T> isNull( Property<T> property ) { return new PropertyNullSpecification<>( property( property ) ); }
/** * Create a new NOT NULL specification for an Association. * * @param association an Association * * @return a new NOT NULL specification for an Association. */ public static <T> AssociationNotNullSpecification<T> isNotNull( Association<T> association ) { return new AssociationNotNullSpecification<>( association( association ) ); }
/** * Create a new Query Template NamedAssociationFunction. * * @param <T> type of the NamedAssociation * @param association a NamedAssociation * * @return a new Query Template NamedAssociationFunction */ @SuppressWarnings( "unchecked" ) public static <T> NamedAssociationFunction<T> namedAssociation( NamedAssociation<T> association ) { return ( (NamedAssociationReferenceHandler<T>) Proxy.getInvocationHandler( association ) ).namedAssociation(); }
@Override public Query<CA> findByNamePaginated( String name, int firstResult, int maxResults ) { QueryBuilder<CA> builder = qbf.newQueryBuilder( getBoxedClass() ); builder = builder.where( eq( templateFor( CA.class ).name(), name ) ); Query<CA> query = builder.newQuery( uowf.currentUnitOfWork() ). firstResult( firstResult ). maxResults( maxResults ); return query; }
/** * Create a new REGULAR EXPRESSION specification for a Property. * * @param property a Property * @param regexp its value * * @return a new REGULAR EXPRESSION specification for a Property. */ public static MatchesSpecification matches( Property<String> property, String regexp ) { return new MatchesSpecification( property( property ), regexp ); }