use of org.hibernate.envers.AuditReader in project wildfly by wildfly.
the class SLSBAudit method verifyRevisionType.
public List<Object> verifyRevisionType(int id) {
AuditReader reader = AuditReaderFactory.get(em);
List<Object> custHistory = new ArrayList<Object>();
List<Number> revList = reader.getRevisions(Customer.class, id);
for (Number revisionNumber : revList) {
AuditQuery query = reader.createQuery().forEntitiesAtRevision(Customer.class, revisionNumber);
query.add(AuditEntity.revisionType().eq(RevisionType.MOD));
if (query.getResultList() != null && query.getResultList().size() > 0) {
custHistory.add(query.getResultList());
}
}
return custHistory;
}
use of org.hibernate.envers.AuditReader in project wildfly by wildfly.
the class SLSBAuditInheritance method retrieveSoccerPlayerbyId.
public SoccerPlayer retrieveSoccerPlayerbyId(int id) {
AuditReader reader = AuditReaderFactory.get(em);
SoccerPlayer val = reader.find(SoccerPlayer.class, id, 1);
return val;
}
use of org.hibernate.envers.AuditReader in project wildfly by wildfly.
the class SLSBAuditMO method retrieveOldPhoneListSizeFromCustomer.
public int retrieveOldPhoneListSizeFromCustomer(int id) {
AuditReader reader = AuditReaderFactory.get(em);
List<Number> revList = reader.getRevisions(CustomerMO.class, id);
CustomerMO cust_rev = reader.find(CustomerMO.class, id, revList.get(revList.size() - 1));
return cust_rev.getPhones().size();
}
use of org.hibernate.envers.AuditReader in project wildfly by wildfly.
the class SLSBOrg method retrieveOldOrgbyEntityName.
public Organization retrieveOldOrgbyEntityName(String name, int id) {
AuditReader reader = AuditReaderFactory.get(em);
Organization org1_rev = reader.find(Organization.class, name, id, 3);
return org1_rev;
}
use of org.hibernate.envers.AuditReader in project wildfly by wildfly.
the class SLSBOrg method retrieveDeletedOrgbyId.
public Organization retrieveDeletedOrgbyId(int id) {
AuditReader reader = AuditReaderFactory.get(em);
List<Number> revList = reader.getRevisions(Organization.class, id);
/*for (Number revisionNumber : revList) {
System.out.println("Available revisionNumber for o1:" + revisionNumber);
}*/
List<Object> custHistory = new ArrayList<Object>();
AuditQuery query = reader.createQuery().forRevisionsOfEntity(Organization.class, true, true);
query.add(AuditEntity.revisionType().eq(RevisionType.DEL));
Organization rev = (Organization) (((List<Object>) (query.getResultList())).toArray()[0]);
return rev;
}
Aggregations