Search in sources :

Example 11 with Club

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

the class ClubPersistenceTest method testFetchByPrimaryKeyMissing.

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

Example 12 with Club

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

the class ClubPersistenceTest method testFetchByPrimaryKeysWithOnePrimaryKey.

@Test
public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
    Club newClub = addClub();
    Set<Serializable> primaryKeys = new HashSet<Serializable>();
    primaryKeys.add(newClub.getPrimaryKey());
    Map<Serializable, Club> clubs = _persistence.fetchByPrimaryKeys(primaryKeys);
    Assert.assertEquals(1, clubs.size());
    Assert.assertEquals(newClub, clubs.get(newClub.getPrimaryKey()));
}
Also used : Serializable(java.io.Serializable) Club(com.liferay.roster.model.Club) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 13 with Club

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

the class ClubModelImpl method equals.

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof Club)) {
        return false;
    }
    Club club = (Club) obj;
    long primaryKey = club.getPrimaryKey();
    if (getPrimaryKey() == primaryKey) {
        return true;
    } else {
        return false;
    }
}
Also used : Club(com.liferay.roster.model.Club)

Example 14 with Club

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

the class ClubPersistenceImpl method findByUuid_First.

/**
 * Returns the first club in the ordered set where uuid = &#63;.
 *
 * @param uuid the uuid
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching club
 * @throws NoSuchClubException if a matching club could not be found
 */
@Override
public Club findByUuid_First(String uuid, OrderByComparator<Club> orderByComparator) throws NoSuchClubException {
    Club club = fetchByUuid_First(uuid, orderByComparator);
    if (club != null) {
        return club;
    }
    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 NoSuchClubException(msg.toString());
}
Also used : Club(com.liferay.roster.model.Club) NoSuchClubException(com.liferay.roster.exception.NoSuchClubException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 15 with Club

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

the class ClubPersistenceImpl method remove.

/**
 * Removes the club with the primary key from the database. Also notifies the appropriate model listeners.
 *
 * @param primaryKey the primary key of the club
 * @return the club that was removed
 * @throws NoSuchClubException if a club with the primary key could not be found
 */
@Override
public Club remove(Serializable primaryKey) throws NoSuchClubException {
    Session session = null;
    try {
        session = openSession();
        Club club = (Club) session.get(ClubImpl.class, primaryKey);
        if (club == null) {
            if (_log.isWarnEnabled()) {
                _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
            }
            throw new NoSuchClubException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }
        return remove(club);
    } catch (NoSuchClubException nsee) {
        throw nsee;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : Club(com.liferay.roster.model.Club) ClubImpl(com.liferay.roster.model.impl.ClubImpl) NoSuchClubException(com.liferay.roster.exception.NoSuchClubException) NoSuchClubException(com.liferay.roster.exception.NoSuchClubException) Session(com.liferay.portal.kernel.dao.orm.Session)

Aggregations

Club (com.liferay.roster.model.Club)27 Test (org.junit.Test)13 NoSuchClubException (com.liferay.roster.exception.NoSuchClubException)8 Session (com.liferay.portal.kernel.dao.orm.Session)6 StringBundler (com.liferay.portal.kernel.util.StringBundler)6 ClubImpl (com.liferay.roster.model.impl.ClubImpl)5 ActionableDynamicQuery (com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery)4 Query (com.liferay.portal.kernel.dao.orm.Query)4 Serializable (java.io.Serializable)4 DynamicQuery (com.liferay.portal.kernel.dao.orm.DynamicQuery)3 HashSet (java.util.HashSet)3 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)2 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)2 IntegerWrapper (com.liferay.portal.kernel.util.IntegerWrapper)1 HashMap (java.util.HashMap)1 List (java.util.List)1