Search in sources :

Example 1 with BarImpl

use of com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl 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 = ?.
 *
 * @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 2 with BarImpl

use of com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl 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 3 with BarImpl

use of com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl 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)

Example 4 with BarImpl

use of com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl in project liferay-blade-samples by liferay.

the class BarPersistenceImpl method create.

/**
 * Creates a new bar with the primary key. Does not add the bar to the database.
 *
 * @param barId the primary key for the new bar
 * @return the new bar
 */
@Override
public Bar create(long barId) {
    Bar bar = new BarImpl();
    bar.setNew(true);
    bar.setPrimaryKey(barId);
    String uuid = PortalUUIDUtil.generate();
    bar.setUuid(uuid);
    bar.setCompanyId(CompanyThreadLocal.getCompanyId());
    return bar;
}
Also used : Bar(com.liferay.blade.samples.servicebuilder.adq.model.Bar) BarImpl(com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl)

Aggregations

Bar (com.liferay.blade.samples.servicebuilder.adq.model.Bar)4 BarImpl (com.liferay.blade.samples.servicebuilder.adq.model.impl.BarImpl)4 NoSuchBarException (com.liferay.blade.samples.servicebuilder.adq.exception.NoSuchBarException)3 Session (com.liferay.portal.kernel.dao.orm.Session)3