@Test public void testInputUserIsGroupCoordinator() { final long personId = 99L; final long groupId = 1L; Person p = jpaPersonMapper.findById(personId); DomainGroup g = jpaGroupMapper.findById(groupId); if (!jpaGroupMapper.isInputUserGroupCoordinator(personId, groupId)) { g.addCoordinator(p); } boolean result = jpaGroupMapper.isInputUserGroupCoordinator(personId, groupId); assertEquals(true, result); }
public boolean isInputUserGroupCoordinator(final long followerId, final long followingId) { String groupCoordinatorQuery = "SELECT p.id FROM Person p, DomainGroup g WHERE p member of g.coordinators" + " AND g.id = :groupId"; List<Long> groupCoordinatorResult = getEntityManager().createQuery(groupCoordinatorQuery) .setParameter("groupId", followingId).getResultList(); if (groupCoordinatorResult.contains(new Long(followerId))) { return true; } return false; }
DomainGroupMapper extends DomainEntityMapper<DomainGroup> implements FollowMapper, CompositeEntityMapper { public boolean isInputUserGroupCoordinator(final long followerId, final long followingId) { String groupCoordinatorQuery = "SELECT p.id FROM Person p, DomainGroup g WHERE p member of g.coordinators" + " AND g.id = :groupId"; List<Long> groupCoordinatorResult = getEntityManager().createQuery(groupCoordinatorQuery) .setParameter("groupId", followingId).getResultList(); if (groupCoordinatorResult.contains(new Long(followerId))) { return true; } return false; } }
DomainGroupMapper extends DomainEntityMapper<DomainGroup> implements FollowMapper, CompositeEntityMapper { public boolean isInputUserGroupCoordinator(final long followerId, final long followingId) { String groupCoordinatorQuery = "SELECT p.id FROM Person p, DomainGroup g WHERE p member of g.coordinators" + " AND g.id = :groupId"; List<Long> groupCoordinatorResult = getEntityManager().createQuery(groupCoordinatorQuery) .setParameter("groupId", followingId).getResultList(); if (groupCoordinatorResult.contains(new Long(followerId))) { return true; } return false; } DomainGroupMapper(final QueryOptimizer inQueryOptimizer); }
DomainGroupMapper extends DomainEntityMapper<DomainGroup> implements FollowMapper, CompositeEntityMapper { public boolean isInputUserGroupCoordinator(final long followerId, final long followingId) { String groupCoordinatorQuery = "SELECT p.id FROM Person p, DomainGroup g WHERE p member of g.coordinators" + " AND g.id = :groupId"; List<Long> groupCoordinatorResult = getEntityManager().createQuery(groupCoordinatorQuery) .setParameter("groupId", followingId).getResultList(); if (groupCoordinatorResult.contains(new Long(followerId))) { return true; } return false; } DomainGroupMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") DomainGroup findByShortName(final String groupShortName); void addFollower(final long followerId, final long followingId); PagedSet<Person> getFollowers(final String shortName, final int start, final int end); PagedSet<Followable> getFollowing(final String accountId, final int start, final int end); @SuppressWarnings("unchecked") boolean isFollowing(final String followerAccountId, final String shortName); void removeFollower(final long followerId, final long followingId); void removeGroupCoordinator(final long followerId, final long followingId); @SuppressWarnings("unchecked") Long[] getFollowerAndCoordinatorPersonIds(final DomainGroup domainGroup); void deleteById(final long id); boolean isInputUserGroupCoordinator(final long followerId, final long followingId); boolean isGroupPrivate(final long followingId); int getGroupCoordinatorCount(final long followingId); }
DomainGroupMapper extends DomainEntityMapper<DomainGroup> implements FollowMapper, CompositeEntityMapper { public boolean isInputUserGroupCoordinator(final long followerId, final long followingId) { String groupCoordinatorQuery = "SELECT p.id FROM Person p, DomainGroup g WHERE p member of g.coordinators" + " AND g.id = :groupId"; List<Long> groupCoordinatorResult = getEntityManager().createQuery(groupCoordinatorQuery) .setParameter("groupId", followingId).getResultList(); if (groupCoordinatorResult.contains(new Long(followerId))) { return true; } return false; } DomainGroupMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") DomainGroup findByShortName(final String groupShortName); void addFollower(final long followerId, final long followingId); PagedSet<Person> getFollowers(final String shortName, final int start, final int end); PagedSet<Followable> getFollowing(final String accountId, final int start, final int end); @SuppressWarnings("unchecked") boolean isFollowing(final String followerAccountId, final String shortName); void removeFollower(final long followerId, final long followingId); void removeGroupCoordinator(final long followerId, final long followingId); @SuppressWarnings("unchecked") Long[] getFollowerAndCoordinatorPersonIds(final DomainGroup domainGroup); void deleteById(final long id); boolean isInputUserGroupCoordinator(final long followerId, final long followingId); boolean isGroupPrivate(final long followingId); int getGroupCoordinatorCount(final long followingId);  }