@Test public void testTabOrder() { final int expectedTabCount = 3; Person ford = jpaPersonMapper.findByAccountId("fordp"); TabGroup tabGroup = ford.getStartTabGroup(); List<Tab> tabs = tabGroup.getTabs(); Tab t2 = tabs.get(1); tabs.remove(t2); tabs.add(t2); jpaPersonMapper.flush(); getEntityManager().clear(); ford = jpaPersonMapper.findByAccountId("fordp"); tabGroup = ford.getStartTabGroup(); tabs = tabGroup.getTabs(); assertEquals("Ford Prefect should have 3 (non-deleted) tabs in the DBUnit fixture", expectedTabCount, tabs .size()); assertEquals("Ford Tab 1", tabs.get(0).getTabName()); assertEquals("Ford Tab 3", tabs.get(1).getTabName()); assertEquals("Ford Tab 2", tabs.get(2).getTabName()); }
@SuppressWarnings("unchecked") public Person findByAccountId(final String accountId) { Query q = getEntityManager().createQuery("from Person where accountId = :accountId").setParameter("accountId", accountId.toLowerCase()); List results = q.getResultList(); return (results.size() == 0) ? null : (Person) results.get(0); }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { @SuppressWarnings("unchecked") public Person findByAccountId(final String accountId) { Query q = getEntityManager().createQuery("from Person where accountId = :accountId").setParameter("accountId", accountId.toLowerCase()); List results = q.getResultList(); return (results.size() == 0) ? null : (Person) results.get(0); } }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { @SuppressWarnings("unchecked") public Person findByAccountId(final String accountId) { Query q = getEntityManager().createQuery("from Person where accountId = :accountId").setParameter("accountId", accountId.toLowerCase()); List results = q.getResultList(); return (results.size() == 0) ? null : (Person) results.get(0); } PersonMapper(final QueryOptimizer inQueryOptimizer); }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { @SuppressWarnings("unchecked") public Person findByAccountId(final String accountId) { Query q = getEntityManager().createQuery("from Person where accountId = :accountId").setParameter("accountId", accountId.toLowerCase()); List results = q.getResultList(); return (results.size() == 0) ? null : (Person) results.get(0); } PersonMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") Person findByAccountId(final String accountId); @SuppressWarnings("unchecked") Person findByOpenSocialId(final String openSocialId); void addFollower(final long followerId, final long followingId); void removeFollower(final long followerId, final long followingId); PagedSet<Person> getFollowers(final String accountId, 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 followingAccountId); @SuppressWarnings("unchecked") List<Person> findPeopleByPrefix(final String prefix); @SuppressWarnings("unchecked") List<Person> findPeopleByOpenSocialIds(final List<String> openSocialIds); @SuppressWarnings("unchecked") List<Person> findPeopleFollowedUsingFollowerOpenSocialIds(final List<String> openSocialIds); }
PersonMapper extends DomainEntityMapper<Person> implements FollowMapper { @SuppressWarnings("unchecked") public Person findByAccountId(final String accountId) { Query q = getEntityManager().createQuery("from Person where accountId = :accountId").setParameter("accountId", accountId.toLowerCase()); List results = q.getResultList(); return (results.size() == 0) ? null : (Person) results.get(0); } PersonMapper(final QueryOptimizer inQueryOptimizer); @SuppressWarnings("unchecked") Person findByAccountId(final String accountId); @SuppressWarnings("unchecked") Person findByOpenSocialId(final String openSocialId); void addFollower(final long followerId, final long followingId); void removeFollower(final long followerId, final long followingId); PagedSet<Person> getFollowers(final String accountId, 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 followingAccountId); @SuppressWarnings("unchecked") List<Person> findPeopleByPrefix(final String prefix); @SuppressWarnings("unchecked") List<Person> findPeopleByOpenSocialIds(final List<String> openSocialIds); @SuppressWarnings("unchecked") List<Person> findPeopleFollowedUsingFollowerOpenSocialIds(final List<String> openSocialIds);  }