01: package com.flexive.examples.tutorial01;
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: * JSF managed bean for the tutorial01 application.
13: *
14: * @author Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
15: * @version $Rev: 1 $
16: */
17: public class Tutorial01Bean {
18: private DataModel documents;
19:
20: public DataModel getDocuments() throws FxApplicationException {
21: if (documents == null) {
22: final FxResultSet result = new SqlQueryBuilder().select(
23: "@pk", "document01/file", "caption", "created_at")
24: .type("document01").orderBy("created_at",
25: SortDirection.DESCENDING).getResult();
26: documents = new FxResultSetDataModel(result);
27: }
28: return documents;
29: }
30: }
|