final Query query = entityManager
.createQuery(ProjectServiceBean.QUERY_GROUP_PLAN);
query.setParameter("activityGroup", activityGroup);
query.setParameter("projectType", project.getProjectType());
ProjectTypeGroupPlan projectTypeGroupPlan = (ProjectTypeGroupPlan) query
.getSingleResult();
List<ActivityGroup> preActivityGroups = projectTypeGroupPlan
.getPreActivityGroups();
if (!sortedActivityGroups.contains(activityGroup)
&& (preActivityGroups.isEmpty() || sortedActivityGroups
.containsAll(preActivityGroups))) {