01: package com.flexive.examples.helloworld.war;
02:
03: import com.flexive.faces.model.FxResultSetDataModel;
04: import com.flexive.shared.exceptions.FxApplicationException;
05: import com.flexive.shared.search.FxResultSet;
06: import com.flexive.shared.search.SortDirection;
07: import com.flexive.shared.search.query.SqlQueryBuilder;
08:
09: import javax.faces.model.DataModel;
10:
11: /**
12: * @author Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
13: * @version $Rev: 1 $
14: */
15: public class HelloWorldBean {
16: private DataModel blogEntries;
17:
18: public DataModel getBlogEntries() throws FxApplicationException {
19: if (blogEntries == null) {
20: final FxResultSet result = new SqlQueryBuilder().select(
21: "@pk", "entryTitle", "entryText", "created_at")
22: .type("blogEntry").orderBy("created_at",
23: SortDirection.DESCENDING).getResult();
24: blogEntries = new FxResultSetDataModel(result);
25: }
26: return blogEntries;
27: }
28: }
|