use of com.liferay.blade.basic.model.Foo 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 = ?.
*
* @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);
}
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceImpl method findByUuid_Last.
/**
* Returns the last foo in the ordered set where uuid = ?.
*
* @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("}");
throw new NoSuchFooException(msg.toString());
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class JSPPortlet method updateFoo.
protected void updateFoo(ActionRequest actionRequest) throws Exception {
long fooId = ParamUtil.getLong(actionRequest, "fooId");
String field1 = ParamUtil.getString(actionRequest, "field1");
boolean field2 = ParamUtil.getBoolean(actionRequest, "field2");
int field3 = ParamUtil.getInteger(actionRequest, "field3");
String field5 = ParamUtil.getString(actionRequest, "field5");
int dateMonth = ParamUtil.getInteger(actionRequest, "field4Month");
int dateDay = ParamUtil.getInteger(actionRequest, "field4Day");
int dateYear = ParamUtil.getInteger(actionRequest, "field4Year");
int dateHour = ParamUtil.getInteger(actionRequest, "field4Hour");
int dateMinute = ParamUtil.getInteger(actionRequest, "field4Minute");
int dateAmPm = ParamUtil.getInteger(actionRequest, "field4AmPm");
if (dateAmPm == Calendar.PM) {
dateHour += 12;
}
Date field4 = PortalUtil.getDate(dateMonth, dateDay, dateYear, dateHour, dateMinute, PortalException.class);
if (fooId <= 0) {
Foo foo = getFooLocalService().createFoo(0);
foo.setField1(field1);
foo.setField2(field2);
foo.setField3(field3);
foo.setField4(field4);
foo.setField5(field5);
foo.isNew();
getFooLocalService().addFoo(foo);
} else {
Foo foo = getFooLocalService().fetchFoo(fooId);
foo.setFooId(fooId);
foo.setField1(field1);
foo.setField2(field2);
foo.setField3(field3);
foo.setField4(field4);
foo.setField5(field5);
getFooLocalService().updateFoo(foo);
}
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class JSPWARPortlet method updateFoo.
public void updateFoo(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long fooId = ParamUtil.getLong(actionRequest, "fooId");
String field1 = ParamUtil.getString(actionRequest, "field1");
boolean field2 = ParamUtil.getBoolean(actionRequest, "field2");
int field3 = ParamUtil.getInteger(actionRequest, "field3");
String field5 = ParamUtil.getString(actionRequest, "field5");
int dateMonth = ParamUtil.getInteger(actionRequest, "field4Month");
int dateDay = ParamUtil.getInteger(actionRequest, "field4Day");
int dateYear = ParamUtil.getInteger(actionRequest, "field4Year");
int dateHour = ParamUtil.getInteger(actionRequest, "field4Hour");
int dateMinute = ParamUtil.getInteger(actionRequest, "field4Minute");
int dateAmPm = ParamUtil.getInteger(actionRequest, "field4AmPm");
if (dateAmPm == Calendar.PM) {
dateHour += 12;
}
Date field4 = PortalUtil.getDate(dateMonth, dateDay, dateYear, dateHour, dateMinute, PortalException.class);
if (fooId <= 0) {
if (_log.isInfoEnabled()) {
_log.info("Adding a new foo...");
}
Foo foo = getFooLocalService().createFoo(0);
foo.setField1(field1);
foo.setField2(field2);
foo.setField3(field3);
foo.setField4(field4);
foo.setField5(field5);
foo.isNew();
getFooLocalService().addFoo(foo);
} else {
if (_log.isInfoEnabled()) {
_log.info("Updating a new foo...");
}
Foo foo = getFooLocalService().fetchFoo(fooId);
foo.setFooId(fooId);
foo.setField1(field1);
foo.setField2(field2);
foo.setField3(field3);
foo.setField4(field4);
foo.setField5(field5);
getFooLocalService().updateFoo(foo);
}
}
Aggregations