Search in sources :

Example 6 with NoSuchRosterMemberException

use of com.liferay.roster.exception.NoSuchRosterMemberException in project liferay-ide by liferay.

the class RosterMemberPersistenceImpl method findByUuid_PrevAndNext.

/**
 * Returns the roster members before and after the current roster member in the ordered set where uuid = ?.
 *
 * @param rosterMemberId the primary key of the current roster member
 * @param uuid the uuid
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next roster member
 * @throws NoSuchRosterMemberException if a roster member with the primary key could not be found
 */
@Override
public RosterMember[] findByUuid_PrevAndNext(long rosterMemberId, String uuid, OrderByComparator<RosterMember> orderByComparator) throws NoSuchRosterMemberException {
    RosterMember rosterMember = findByPrimaryKey(rosterMemberId);
    Session session = null;
    try {
        session = openSession();
        RosterMember[] array = new RosterMemberImpl[3];
        array[0] = getByUuid_PrevAndNext(session, rosterMember, uuid, orderByComparator, true);
        array[1] = rosterMember;
        array[2] = getByUuid_PrevAndNext(session, rosterMember, uuid, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : RosterMember(com.liferay.roster.model.RosterMember) RosterMemberImpl(com.liferay.roster.model.impl.RosterMemberImpl) NoSuchRosterMemberException(com.liferay.roster.exception.NoSuchRosterMemberException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 7 with NoSuchRosterMemberException

use of com.liferay.roster.exception.NoSuchRosterMemberException in project liferay-ide by liferay.

the class RosterMemberPersistenceImpl method remove.

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

Aggregations

NoSuchRosterMemberException (com.liferay.roster.exception.NoSuchRosterMemberException)7 RosterMember (com.liferay.roster.model.RosterMember)7 StringBundler (com.liferay.portal.kernel.util.StringBundler)4 Session (com.liferay.portal.kernel.dao.orm.Session)3 RosterMemberImpl (com.liferay.roster.model.impl.RosterMemberImpl)3