Commit add17d4c authored by RANNOU's avatar RANNOU 👽
Browse files

[enh] Service/Dao: add a strategies predocumentation service (#490)

parent b09531db
......@@ -127,6 +127,9 @@ public class StrategyPredocDaoImpl extends HibernateDaoSupport implements Strate
builder.in(root.get(Strategy.Fields.STATUS).get(Status.Fields.ID)).value(ImmutableList.of(StatusEnum.ENABLE.getId(), StatusEnum.TEMPORARY.getId()))
));
// Get last created strategies first
query.orderBy(builder.desc(root.get(Strategy.Fields.CREATION_DATE)));
return getEntityManager()
.createQuery(query)
.setParameter(programIdParam, programId)
......@@ -156,6 +159,9 @@ public class StrategyPredocDaoImpl extends HibernateDaoSupport implements Strate
builder.in(strategyDepartmentInnerJoin.get(StrategyDepartment.Fields.DEPARTMENT).get(Strategy.Fields.STATUS).get(Status.Fields.ID)).value(ImmutableList.of(StatusEnum.ENABLE.getId(), StatusEnum.TEMPORARY.getId()))
));
// Get last created strategies first
query.orderBy(builder.desc(root.get(Strategy.Fields.CREATION_DATE)));
return getEntityManager()
.createQuery(query)
.setParameter(programIdParam, programId)
......@@ -194,6 +200,9 @@ public class StrategyPredocDaoImpl extends HibernateDaoSupport implements Strate
locationPredicate
));
// Get last created strategies first
query.orderBy(builder.desc(root.get(Strategy.Fields.CREATION_DATE)));
return getEntityManager()
.createQuery(query)
.setParameter(programIdParam, programId)
......@@ -228,6 +237,9 @@ public class StrategyPredocDaoImpl extends HibernateDaoSupport implements Strate
builder.isTrue(taxonNameInnerJoin.get(TaxonName.Fields.IS_REFERENT))
));
// Get last created strategies first
query.orderBy(builder.desc(root.get(Strategy.Fields.CREATION_DATE)));
return getEntityManager()
.createQuery(query)
.setParameter(programIdParam, programId)
......@@ -272,10 +284,12 @@ public class StrategyPredocDaoImpl extends HibernateDaoSupport implements Strate
);
}
query.distinct(true)
.select(pmfmStrategyInnerJoin.get(field).get(IEntity.Fields.ID))
query.select(pmfmStrategyInnerJoin.get(field).get(IEntity.Fields.ID))
.where(predicate);
// Get last created strategies first
query.orderBy(builder.desc(root.get(Strategy.Fields.CREATION_DATE)));
TypedQuery<Integer> typedQuery = getEntityManager().createQuery(query);
if (referenceTaxonId != null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment