EntitlementCurator extends AbstractHibernateCurator<Entitlement> { @Transactional public int markEntitlementsDirty(Iterable<String> entitlementIds) { int count = 0; if (entitlementIds != null && entitlementIds.iterator().hasNext()) { String hql = "UPDATE Entitlement SET dirty = true WHERE id IN (:entIds)"; Query query = this.getEntityManager().createQuery(hql); for (List<String> block : this.partition(entitlementIds)) { count += query.setParameter("entIds", block).executeUpdate(); } } return count; } @Inject  EntitlementCurator(OwnerProductCurator ownerProductCurator, ProductCurator productCurator,
        ConsumerTypeCurator consumerTypeCurator, CandlepinQueryFactory cpQueryFactory); @Transactional Set<Entitlement> bulkUpdate(Set<Entitlement> entitlements); List<Entitlement> listByConsumer(Consumer consumer); List<Entitlement> listByConsumer(Consumer consumer, EntitlementFilterBuilder filters); List<Entitlement> listByConsumerAndPoolId(Consumer consumer, String poolId); Page<List<Entitlement>> listByConsumer(Consumer consumer, String productId,
        EntitlementFilterBuilder filters, PageRequest pageRequest); Page<List<Entitlement>> listByOwner(Owner owner, String productId,
        EntitlementFilterBuilder filters, PageRequest pageRequest); Page<List<Entitlement>> listAll(EntitlementFilterBuilder filters, PageRequest pageRequest); CandlepinQuery<Entitlement> listByOwner(Owner owner); CandlepinQuery<Entitlement> listByEnvironment(Environment environment); CandlepinQuery<Entitlement> listByEnvironment(String environmentId); CandlepinQuery<Entitlement> listByConsumerAndDate(Consumer consumer, Date activeOn); List<Entitlement> listDirty(Consumer consumer); Set<String> listEntitledProductIds(Consumer consumer, Pool pool); int markDependentEntitlementsDirty(Iterable<String> entitlementIds); Set<String> filterDistributorEntitlementIds(Iterable<String> entsIdsToFilter); @Transactional int markEntitlementsDirty(Iterable<String> entitlementIds); @Deprecated Map<Consumer, List<Entitlement>> getDistinctConsumers(List<Entitlement> entsToRevoke); @Transactional void delete(Entitlement entity); void batchDelete(Collection<Entitlement> entitlements); int batchDeleteByIds(Collection<String> entitlementIds); void unlinkEntitlements(Collection<Entitlement> entitlements); @Transactional Entitlement findByCertificateSerial(Long serial); @Transactional Entitlement replicate(Entitlement ent); @SuppressWarnings("unchecked") CandlepinQuery<Entitlement> findByStackId(Consumer consumer, String stackId); @SuppressWarnings("unchecked") CandlepinQuery<Entitlement> findByStackIds(Consumer consumer, Collection stackIds); @SuppressWarnings("unchecked") CandlepinQuery<Entitlement> findByPoolAttribute(Consumer consumer, String attributeName,
        String value); CandlepinQuery<Entitlement> findByPoolAttribute(String attributeName, String value); Entitlement findUpstreamEntitlementForStack(Consumer consumer, String stackId); Collection<String> getDependentEntitlementIdsForPools(Consumer consumer,
        Iterable<String> poolIds);  }
@Test public void testMarkEntitlementsDirty() { Entitlement ent1 = this.setupListProvidingEntitlement(); Entitlement ent2 = this.setupListProvidingEntitlement(); Entitlement ent3 = this.setupListProvidingEntitlement(); assertFalse(ent1.isDirty()); assertFalse(ent2.isDirty()); assertFalse(ent3.isDirty()); this.entitlementCurator.markEntitlementsDirty(Arrays.asList(ent1.getId(), ent2.getId())); this.entitlementCurator.refresh(ent1); this.entitlementCurator.refresh(ent2); this.entitlementCurator.refresh(ent3); assertTrue(ent1.isDirty()); assertTrue(ent2.isDirty()); assertFalse(ent3.isDirty()); }