Search in sources :

Example 6 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceImpl method findByUuid_Last.

/**
 * Returns the last roster member in the ordered set where uuid = ?.
 *
 * @param uuid the uuid
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching roster member
 * @throws NoSuchRosterMemberException if a matching roster member could not be found
 */
@Override
public RosterMember findByUuid_Last(String uuid, OrderByComparator<RosterMember> orderByComparator) throws NoSuchRosterMemberException {
    RosterMember rosterMember = fetchByUuid_Last(uuid, orderByComparator);
    if (rosterMember != null) {
        return rosterMember;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("uuid=");
    msg.append(uuid);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchRosterMemberException(msg.toString());
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) NoSuchRosterMemberException(com.liferay.roster.exception.NoSuchRosterMemberException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 7 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceTest method testFetchByPrimaryKeyMissing.

@Test
public void testFetchByPrimaryKeyMissing() throws Exception {
    long pk = RandomTestUtil.nextLong();
    RosterMember missingRosterMember = _persistence.fetchByPrimaryKey(pk);
    Assert.assertNull(missingRosterMember);
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) Test(org.junit.Test)

Example 8 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceTest method testRemove.

@Test
public void testRemove() throws Exception {
    RosterMember newRosterMember = addRosterMember();
    _persistence.remove(newRosterMember);
    RosterMember existingRosterMember = _persistence.fetchByPrimaryKey(newRosterMember.getPrimaryKey());
    Assert.assertNull(existingRosterMember);
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) Test(org.junit.Test)

Example 9 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceTest method testDynamicQueryByProjectionExisting.

@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    RosterMember newRosterMember = addRosterMember();
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RosterMember.class, _dynamicQueryClassLoader);
    dynamicQuery.setProjection(ProjectionFactoryUtil.property("rosterMemberId"));
    Object newRosterMemberId = newRosterMember.getRosterMemberId();
    dynamicQuery.add(RestrictionsFactoryUtil.in("rosterMemberId", new Object[] { newRosterMemberId }));
    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
    Assert.assertEquals(1, result.size());
    Object existingRosterMemberId = result.get(0);
    Assert.assertEquals(existingRosterMemberId, newRosterMemberId);
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) DynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Test(org.junit.Test)

Example 10 with RosterMember

use of com.liferay.roster.model.RosterMember in project liferay-ide by liferay.

the class RosterMemberPersistenceTest method testDynamicQueryByPrimaryKeyMissing.

@Test
public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RosterMember.class, _dynamicQueryClassLoader);
    dynamicQuery.add(RestrictionsFactoryUtil.eq("rosterMemberId", RandomTestUtil.nextLong()));
    List<RosterMember> result = _persistence.findWithDynamicQuery(dynamicQuery);
    Assert.assertEquals(0, result.size());
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) DynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Test(org.junit.Test)

Aggregations

RosterMember (com.liferay.roster.model.RosterMember)32 Test (org.junit.Test)13 NoSuchRosterMemberException (com.liferay.roster.exception.NoSuchRosterMemberException)12 StringBundler (com.liferay.portal.kernel.util.StringBundler)10 Session (com.liferay.portal.kernel.dao.orm.Session)8 Query (com.liferay.portal.kernel.dao.orm.Query)6 RosterMemberImpl (com.liferay.roster.model.impl.RosterMemberImpl)6 ActionableDynamicQuery (com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery)4 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)4 Serializable (java.io.Serializable)4 DynamicQuery (com.liferay.portal.kernel.dao.orm.DynamicQuery)3 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)3 HashSet (java.util.HashSet)3 IntegerWrapper (com.liferay.portal.kernel.util.IntegerWrapper)1 HashMap (java.util.HashMap)1 List (java.util.List)1