@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 ); }
@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 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; }