Java Code Examples for org.hibernate.envers.query.AuditQuery#getResultList()
The following examples show how to use
org.hibernate.envers.query.AuditQuery#getResultList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractHibernateAuditableDao.java From tutorials with MIT License | 6 votes |
@Override public List<T> getRevisions() { final AuditReader auditReader = AuditReaderFactory.get(getCurrentSession()); final AuditQuery query = auditReader.createQuery().forRevisionsOfEntity(clazz, true, true); final List<T> resultList = query.getResultList(); return resultList; }
Example 2
Source File: CurrentVariantRollbackService.java From mojito with Apache License 2.0 | 5 votes |
/** * Deletes the {@link com.box.l10n.mojito.entity.TMTextUnitCurrentVariant}s based on the given parameters. * These variants will be recreated later in the same state as at the rollback date. * * @param rollbackDateTime Date at which the {@link TMTextUnitCurrentVariant}s will be rollbacked to * @param tmId ID of the TM the {@link TMTextUnitCurrentVariant}s to be rolled back should belong to * @param extraParameters Extra parameters to filter what to rollback */ protected void addCurrentVariantsAsOfRollbackDate(DateTime rollbackDateTime, Long tmId, CurrentVariantRollbackParameters extraParameters) { logger.debug("Adding back TMTextUnitCurrentVariants as of {}", rollbackDateTime); AuditQuery auditQuery = buildInsertAuditQuery(rollbackDateTime, tmId, extraParameters); List<TMTextUnitCurrentVariant> tmTextUnitCurrentVariantsToAdd = (List<TMTextUnitCurrentVariant>) auditQuery.getResultList(); tmTextUnitCurrentVariantRepository.save(tmTextUnitCurrentVariantsToAdd); }
Example 3
Source File: ConfigurationManager.java From ankush with GNU Lesser General Public License v3.0 | 5 votes |
/** * Gets the configuration. * * @param clusterId * the cluster id * @return the configuration */ public List getConfiguration(Long clusterId) { try { AuditReader reader = AuditReaderFactory.get(HibernateUtils .getEntityManager()); AuditQuery query = reader.createQuery().forRevisionsOfEntity( Configuration.class, false, true); // filter results besed on cluster id. query.add(AuditEntity.property( com.impetus.ankush2.constant.Constant.Keys.CLUSTERID).eq( clusterId)); query.addOrder(AuditEntity.revisionProperty( com.impetus.ankush2.constant.Constant.Keys.TIMESTAMP) .desc()); // Getting Result list. List list = query.getResultList(); // Creating List Object. List result = new ArrayList(); for (Object object : list) { Object[] obj = (Object[]) object; Map map = new HashMap(); // Mapping Revision Entity. DefaultRevisionEntity ri = (DefaultRevisionEntity) obj[1]; map.putAll(JsonMapperUtil.mapFromObject(obj[0])); map.put(com.impetus.ankush2.constant.Constant.Keys.DATE, ri.getRevisionDate()); map.put(com.impetus.ankush2.constant.Constant.Keys.REVISIONID, ri.getId()); map.put(com.impetus.ankush2.constant.Constant.Keys.TYPE, obj[2]); result.add(map); } return result; } catch (Exception e) { LOG.error(e.getMessage(), e); } return null; }
Example 4
Source File: AbstractHibernateAuditableDao.java From tutorials with MIT License | 5 votes |
@Override public List<T> getEntitiesAtRevision(final Number revision) { final AuditReader auditReader = AuditReaderFactory.get(getCurrentSession()); final AuditQuery query = auditReader.createQuery().forEntitiesAtRevision(clazz, revision); final List<T> resultList = query.getResultList(); return resultList; }
Example 5
Source File: AbstractHibernateAuditableDao.java From tutorials with MIT License | 5 votes |
@Override public List<T> getEntitiesModifiedAtRevision(final Number revision) { final AuditReader auditReader = AuditReaderFactory.get(getCurrentSession()); final AuditQuery query = auditReader.createQuery().forEntitiesModifiedAtRevision(clazz, revision); final List<T> resultList = query.getResultList(); return resultList; }