*
* AND
* (only non-deleted entities)
* e.revision_type != DEL
*/
AuditEntitiesConfiguration verEntCfg = verCfg.getAuditEntCfg();
String revisionPropertyPath = verEntCfg.getRevisionNumberPath();
String originalIdPropertyName = verEntCfg.getOriginalIdPropName();
MiddleIdData referencedIdData = new MiddleIdData(
verEntCfg, verCfg.getEntCfg().get( entityName ).getIdMappingData(),
null, entityName, verCfg.getEntCfg().isVersioned( entityName )
);
// (selecting e entities at revision :revision)
// --> based on auditStrategy (see above)
verCfg.getAuditStrategy().addEntityAtRevisionRestriction(
verCfg.getGlobalCfg(),
qb,
qb.getRootParameters(),
revisionPropertyPath,
verEntCfg.getRevisionEndFieldName(),
true,
referencedIdData,
revisionPropertyPath,
originalIdPropertyName,
REFERENCED_ENTITY_ALIAS,
REFERENCED_ENTITY_ALIAS_DEF_AUD_STR,
true
);
if ( !includeDeletions ) {
// e.revision_type != DEL
qb.getRootParameters().addWhereWithParam( verEntCfg.getRevisionTypePropName(), "<>", RevisionType.DEL );
}
// all specified conditions
for ( AuditCriterion criterion : criterions ) {
criterion.addToQuery( verCfg, versionsReader, entityName, qb, qb.getRootParameters() );