Search in sources :

Example 1 with NoSuchBazException

use of com.liferay.blade.workflow.basic.exception.NoSuchBazException in project liferay-blade-samples by liferay.

the class BazPersistenceImpl method remove.

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

Example 2 with NoSuchBazException

use of com.liferay.blade.workflow.basic.exception.NoSuchBazException in project liferay-blade-samples by liferay.

the class BazPersistenceImpl method findByUuid_PrevAndNext.

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

Example 3 with NoSuchBazException

use of com.liferay.blade.workflow.basic.exception.NoSuchBazException in project liferay-blade-samples by liferay.

the class BazPersistenceImpl method findByUuid_C_First.

/**
 * Returns the first baz in the ordered set where uuid = &#63; and companyId = &#63;.
 *
 * @param uuid the uuid
 * @param companyId the company ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching baz
 * @throws NoSuchBazException if a matching baz could not be found
 */
@Override
public Baz findByUuid_C_First(String uuid, long companyId, OrderByComparator<Baz> orderByComparator) throws NoSuchBazException {
    Baz baz = fetchByUuid_C_First(uuid, companyId, orderByComparator);
    if (baz != null) {
        return baz;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("uuid=");
    msg.append(uuid);
    msg.append(", companyId=");
    msg.append(companyId);
    msg.append("}");
    throw new NoSuchBazException(msg.toString());
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz) StringBundler(com.liferay.petra.string.StringBundler) NoSuchBazException(com.liferay.blade.workflow.basic.exception.NoSuchBazException)

Example 4 with NoSuchBazException

use of com.liferay.blade.workflow.basic.exception.NoSuchBazException in project liferay-blade-samples by liferay.

the class BazPersistenceImpl method findByUuid_Last.

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

Example 5 with NoSuchBazException

use of com.liferay.blade.workflow.basic.exception.NoSuchBazException in project liferay-blade-samples by liferay.

the class BazPersistenceImpl method findByUUID_G.

/**
 * Returns the baz where uuid = &#63; and groupId = &#63; or throws a <code>NoSuchBazException</code> if it could not be found.
 *
 * @param uuid the uuid
 * @param groupId the group ID
 * @return the matching baz
 * @throws NoSuchBazException if a matching baz could not be found
 */
@Override
public Baz findByUUID_G(String uuid, long groupId) throws NoSuchBazException {
    Baz baz = fetchByUUID_G(uuid, groupId);
    if (baz == null) {
        StringBundler msg = new StringBundler(6);
        msg.append(_NO_SUCH_ENTITY_WITH_KEY);
        msg.append("uuid=");
        msg.append(uuid);
        msg.append(", groupId=");
        msg.append(groupId);
        msg.append("}");
        if (_log.isDebugEnabled()) {
            _log.debug(msg.toString());
        }
        throw new NoSuchBazException(msg.toString());
    }
    return baz;
}
Also used : Baz(com.liferay.blade.workflow.basic.model.Baz) StringBundler(com.liferay.petra.string.StringBundler) NoSuchBazException(com.liferay.blade.workflow.basic.exception.NoSuchBazException)

Aggregations

NoSuchBazException (com.liferay.blade.workflow.basic.exception.NoSuchBazException)8 Baz (com.liferay.blade.workflow.basic.model.Baz)8 StringBundler (com.liferay.petra.string.StringBundler)5 BazImpl (com.liferay.blade.workflow.basic.model.impl.BazImpl)3 Session (com.liferay.portal.kernel.dao.orm.Session)3