Search in sources :

Example 1 with NoSuchBarException

use of com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException in project liferay-blade-samples by liferay.

the class BarPersistenceImpl method findByUuid_Last.

/**
 * Returns the last bar 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 bar
 * @throws NoSuchBarException if a matching bar could not be found
 */
@Override
public Bar findByUuid_Last(String uuid, OrderByComparator<Bar> orderByComparator) throws NoSuchBarException {
    Bar bar = fetchByUuid_Last(uuid, orderByComparator);
    if (bar != null) {
        return bar;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("uuid=");
    msg.append(uuid);
    msg.append("}");
    throw new NoSuchBarException(msg.toString());
}
Also used : Bar(com.liferay.blade.samples.servicebuilder.adq.model.Bar) NoSuchBarException(com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException) StringBundler(com.liferay.petra.string.StringBundler)

Example 2 with NoSuchBarException

use of com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException in project liferay-blade-samples by liferay.

the class BarPersistenceImpl method remove.

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

Example 3 with NoSuchBarException

use of com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException in project liferay-blade-samples by liferay.

the class BarPersistenceImpl method findByUuid_PrevAndNext.

/**
 * Returns the bars before and after the current bar in the ordered set where uuid = &#63;.
 *
 * @param barId the primary key of the current bar
 * @param uuid the uuid
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next bar
 * @throws NoSuchBarException if a bar with the primary key could not be found
 */
@Override
public Bar[] findByUuid_PrevAndNext(long barId, String uuid, OrderByComparator<Bar> orderByComparator) throws NoSuchBarException {
    uuid = Objects.toString(uuid, "");
    Bar bar = findByPrimaryKey(barId);
    Session session = null;
    try {
        session = openSession();
        Bar[] array = new BarImpl[3];
        array[0] = getByUuid_PrevAndNext(session, bar, uuid, orderByComparator, true);
        array[1] = bar;
        array[2] = getByUuid_PrevAndNext(session, bar, uuid, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : Bar(com.liferay.blade.samples.servicebuilder.adq.model.Bar) BarImpl(com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl) NoSuchBarException(com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 4 with NoSuchBarException

use of com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException in project liferay-blade-samples by liferay.

the class BarPersistenceImpl method findByUuid_C_PrevAndNext.

/**
 * Returns the bars before and after the current bar in the ordered set where uuid = &#63; and companyId = &#63;.
 *
 * @param barId the primary key of the current bar
 * @param uuid the uuid
 * @param companyId the company ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next bar
 * @throws NoSuchBarException if a bar with the primary key could not be found
 */
@Override
public Bar[] findByUuid_C_PrevAndNext(long barId, String uuid, long companyId, OrderByComparator<Bar> orderByComparator) throws NoSuchBarException {
    uuid = Objects.toString(uuid, "");
    Bar bar = findByPrimaryKey(barId);
    Session session = null;
    try {
        session = openSession();
        Bar[] array = new BarImpl[3];
        array[0] = getByUuid_C_PrevAndNext(session, bar, uuid, companyId, orderByComparator, true);
        array[1] = bar;
        array[2] = getByUuid_C_PrevAndNext(session, bar, uuid, companyId, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : Bar(com.liferay.blade.samples.servicebuilder.adq.model.Bar) BarImpl(com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl) NoSuchBarException(com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 5 with NoSuchBarException

use of com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException in project liferay-blade-samples by liferay.

the class BarPersistenceImpl method findByField2_PrevAndNext.

/**
 * Returns the bars before and after the current bar in the ordered set where field2 = &#63;.
 *
 * @param barId the primary key of the current bar
 * @param field2 the field2
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next bar
 * @throws NoSuchBarException if a bar with the primary key could not be found
 */
@Override
public Bar[] findByField2_PrevAndNext(long barId, boolean field2, OrderByComparator<Bar> orderByComparator) throws NoSuchBarException {
    Bar bar = findByPrimaryKey(barId);
    Session session = null;
    try {
        session = openSession();
        Bar[] array = new BarImpl[3];
        array[0] = getByField2_PrevAndNext(session, bar, field2, orderByComparator, true);
        array[1] = bar;
        array[2] = getByField2_PrevAndNext(session, bar, field2, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : Bar(com.liferay.blade.samples.servicebuilder.adq.model.Bar) BarImpl(com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl) NoSuchBarException(com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException) Session(com.liferay.portal.kernel.dao.orm.Session)

Aggregations

NoSuchBarException (com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException)11 Bar (com.liferay.blade.samples.servicebuilder.adq.model.Bar)11 StringBundler (com.liferay.petra.string.StringBundler)7 BarImpl (com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl)4 Session (com.liferay.portal.kernel.dao.orm.Session)4