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);
}
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()));
}
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;
}
}
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 = ?.
*
* @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());
}
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);
}
}
Aggregations