Search in sources :

Example 1 with NoSuchFooException

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

the class FooPersistenceImpl method findByField2_Last.

/**
 * Returns the last foo in the ordered set where field2 = ?.
 *
 * @param field2 the field2
 * @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 findByField2_Last(boolean field2, OrderByComparator<Foo> orderByComparator) throws NoSuchFooException {
    Foo foo = fetchByField2_Last(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("}");
    throw new NoSuchFooException(msg.toString());
}
Also used : NoSuchFooException(com.liferay.blade.basic.exception.NoSuchFooException) Foo(com.liferay.blade.basic.model.Foo) StringBundler(com.liferay.petra.string.StringBundler)

Example 2 with NoSuchFooException

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

the class FooPersistenceImpl method findByUuid_C_First.

/**
 * Returns the first foo 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 foo
 * @throws NoSuchFooException if a matching foo could not be found
 */
@Override
public Foo findByUuid_C_First(String uuid, long companyId, OrderByComparator<Foo> orderByComparator) throws NoSuchFooException {
    Foo foo = fetchByUuid_C_First(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("}");
    throw new NoSuchFooException(msg.toString());
}
Also used : NoSuchFooException(com.liferay.blade.basic.exception.NoSuchFooException) Foo(com.liferay.blade.basic.model.Foo) StringBundler(com.liferay.petra.string.StringBundler)

Example 3 with NoSuchFooException

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

the class FooPersistenceImpl method findByUUID_G.

/**
 * Returns the foo where uuid = &#63; and groupId = &#63; or throws a <code>NoSuchFooException</code> 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("}");
        if (_log.isDebugEnabled()) {
            _log.debug(msg.toString());
        }
        throw new NoSuchFooException(msg.toString());
    }
    return foo;
}
Also used : NoSuchFooException(com.liferay.blade.basic.exception.NoSuchFooException) Foo(com.liferay.blade.basic.model.Foo) StringBundler(com.liferay.petra.string.StringBundler)

Example 4 with NoSuchFooException

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

the class FooPersistenceImpl method remove.

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

Example 5 with NoSuchFooException

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

the class FooPersistenceImpl method findByUuid_First.

/**
 * Returns the first 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 first matching foo
 * @throws NoSuchFooException if a matching foo could not be found
 */
@Override
public Foo findByUuid_First(String uuid, OrderByComparator<Foo> orderByComparator) throws NoSuchFooException {
    Foo foo = fetchByUuid_First(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("}");
    throw new NoSuchFooException(msg.toString());
}
Also used : NoSuchFooException(com.liferay.blade.basic.exception.NoSuchFooException) Foo(com.liferay.blade.basic.model.Foo) StringBundler(com.liferay.petra.string.StringBundler)

Aggregations

NoSuchFooException (com.liferay.blade.basic.exception.NoSuchFooException)11 Foo (com.liferay.blade.basic.model.Foo)11 StringBundler (com.liferay.petra.string.StringBundler)7 FooImpl (com.liferay.blade.basic.model.impl.FooImpl)4 Session (com.liferay.portal.kernel.dao.orm.Session)4