Search in sources :

Example 6 with NoSuchFooException

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

the class FooPersistenceImpl method findByUUID_G.

/**
 * Returns the foo where uuid = ? and groupId = ? or throws a {@link NoSuchFooException} if it could not be found.
 *
 * @param uuid the uuid
 * @param groupId the group ID
 * @return the matching foo
 * @throws NoSuchFooException if a matching foo could not be found
 */
@Override
public Foo findByUUID_G(String uuid, long groupId) throws NoSuchFooException {
    Foo foo = fetchByUUID_G(uuid, groupId);
    if (foo == 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(StringPool.CLOSE_CURLY_BRACE);
        if (_log.isDebugEnabled()) {
            _log.debug(msg.toString());
        }
        throw new NoSuchFooException(msg.toString());
    }
    return foo;
}
Also used : NoSuchFooException(com.liferay.blade.samples.servicebuilder.exception.NoSuchFooException) Foo(com.liferay.blade.samples.servicebuilder.model.Foo) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 7 with NoSuchFooException

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

the class FooPersistenceImpl method findByUuid_C_Last.

/**
 * Returns the last foo in the ordered set where uuid = ? and companyId = ?.
 *
 * @param uuid the uuid
 * @param companyId the company ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching foo
 * @throws NoSuchFooException if a matching foo could not be found
 */
@Override
public Foo findByUuid_C_Last(String uuid, long companyId, OrderByComparator<Foo> orderByComparator) throws NoSuchFooException {
    Foo foo = fetchByUuid_C_Last(uuid, companyId, orderByComparator);
    if (foo != null) {
        return foo;
    }
    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(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchFooException(msg.toString());
}
Also used : NoSuchFooException(com.liferay.blade.samples.servicebuilder.exception.NoSuchFooException) Foo(com.liferay.blade.samples.servicebuilder.model.Foo) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 8 with NoSuchFooException

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

the class FooPersistenceImpl method findByField2_PrevAndNext.

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

Example 9 with NoSuchFooException

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

the class FooPersistenceImpl method findByUuid_Last.

/**
 * Returns the last foo 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 foo
 * @throws NoSuchFooException if a matching foo could not be found
 */
@Override
public Foo findByUuid_Last(String uuid, OrderByComparator<Foo> orderByComparator) throws NoSuchFooException {
    Foo foo = fetchByUuid_Last(uuid, orderByComparator);
    if (foo != null) {
        return foo;
    }
    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 NoSuchFooException(msg.toString());
}
Also used : NoSuchFooException(com.liferay.blade.samples.servicebuilder.exception.NoSuchFooException) Foo(com.liferay.blade.samples.servicebuilder.model.Foo) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 10 with NoSuchFooException

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

the class FooPersistenceImpl method findByField2_First.

/**
 * Returns the first foo in the ordered set where field2 = &#63;.
 *
 * @param field2 the field2
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching foo
 * @throws NoSuchFooException if a matching foo could not be found
 */
@Override
public Foo findByField2_First(boolean field2, OrderByComparator<Foo> orderByComparator) throws NoSuchFooException {
    Foo foo = fetchByField2_First(field2, orderByComparator);
    if (foo != null) {
        return foo;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("field2=");
    msg.append(field2);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchFooException(msg.toString());
}
Also used : NoSuchFooException(com.liferay.blade.samples.servicebuilder.exception.NoSuchFooException) Foo(com.liferay.blade.samples.servicebuilder.model.Foo) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Aggregations

NoSuchFooException (com.liferay.blade.samples.servicebuilder.exception.NoSuchFooException)11 Foo (com.liferay.blade.samples.servicebuilder.model.Foo)11 StringBundler (com.liferay.portal.kernel.util.StringBundler)7 FooImpl (com.liferay.blade.samples.servicebuilder.model.impl.FooImpl)4 Session (com.liferay.portal.kernel.dao.orm.Session)4