Search in sources :

Example 1 with FooImpl

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

the class FooPersistenceImpl method create.

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

Example 2 with FooImpl

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

the class FooPersistenceImpl method findByUuid_PrevAndNext.

/**
 * Returns the foos before and after the current foo in the ordered set where uuid = ?.
 *
 * @param fooId the primary key of the current foo
 * @param uuid the uuid
 * @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[] findByUuid_PrevAndNext(long fooId, String uuid, OrderByComparator<Foo> orderByComparator) throws NoSuchFooException {
    Foo foo = findByPrimaryKey(fooId);
    Session session = null;
    try {
        session = openSession();
        Foo[] array = new FooImpl[3];
        array[0] = getByUuid_PrevAndNext(session, foo, uuid, orderByComparator, true);
        array[1] = foo;
        array[2] = getByUuid_PrevAndNext(session, foo, uuid, 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 3 with FooImpl

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

the class FooPersistenceImpl method findByUuid_C_PrevAndNext.

/**
 * Returns the foos before and after the current foo in the ordered set where uuid = &#63; and companyId = &#63;.
 *
 * @param fooId the primary key of the current foo
 * @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 foo
 * @throws NoSuchFooException if a foo with the primary key could not be found
 */
@Override
public Foo[] findByUuid_C_PrevAndNext(long fooId, String uuid, long companyId, OrderByComparator<Foo> orderByComparator) throws NoSuchFooException {
    Foo foo = findByPrimaryKey(fooId);
    Session session = null;
    try {
        session = openSession();
        Foo[] array = new FooImpl[3];
        array[0] = getByUuid_C_PrevAndNext(session, foo, uuid, companyId, orderByComparator, true);
        array[1] = foo;
        array[2] = getByUuid_C_PrevAndNext(session, foo, uuid, companyId, 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 4 with FooImpl

use of com.liferay.blade.samples.servicebuilder.model.impl.FooImpl 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 5 with FooImpl

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

the class FooPersistenceImpl method toUnwrappedModel.

protected Foo toUnwrappedModel(Foo foo) {
    if (foo instanceof FooImpl) {
        return foo;
    }
    FooImpl fooImpl = new FooImpl();
    fooImpl.setNew(foo.isNew());
    fooImpl.setPrimaryKey(foo.getPrimaryKey());
    fooImpl.setUuid(foo.getUuid());
    fooImpl.setFooId(foo.getFooId());
    fooImpl.setGroupId(foo.getGroupId());
    fooImpl.setCompanyId(foo.getCompanyId());
    fooImpl.setUserId(foo.getUserId());
    fooImpl.setUserName(foo.getUserName());
    fooImpl.setCreateDate(foo.getCreateDate());
    fooImpl.setModifiedDate(foo.getModifiedDate());
    fooImpl.setField1(foo.getField1());
    fooImpl.setField2(foo.isField2());
    fooImpl.setField3(foo.getField3());
    fooImpl.setField4(foo.getField4());
    fooImpl.setField5(foo.getField5());
    return fooImpl;
}
Also used : FooImpl(com.liferay.blade.samples.servicebuilder.model.impl.FooImpl)

Aggregations

FooImpl (com.liferay.blade.samples.servicebuilder.model.impl.FooImpl)5 Foo (com.liferay.blade.samples.servicebuilder.model.Foo)4 NoSuchFooException (com.liferay.blade.samples.servicebuilder.exception.NoSuchFooException)3 Session (com.liferay.portal.kernel.dao.orm.Session)3