01: /*
02: This file is part of the Tutorial chapter of "Getting Started with Enhydra".
03: It is not meant to be used in any other context.
04: */
05:
06: package simpleapp.business;
07:
08: import simpleapp.data.*;
09: import java.util.*;
10:
11: import simpleapp.data.person.*;
12: import simpleapp.data.disc.*;
13: import com.lutris.dods.builder.generator.query.*;
14:
15: public class SimpleDiscList {
16:
17: public SimpleDiscList() {
18: try {
19:
20: } catch (Exception e) {
21: e.printStackTrace();
22: }
23: }
24:
25: /* Method to return a 2-dimensional array of strings representing
26: a result set from the Disc Table.
27: */
28: public String[][] getDiscList() {
29: try {
30: DiscDO[] discArray;
31: DiscQuery dquery = new DiscQuery();
32: discArray = dquery.getDOArray();
33: String result[][] = new String[discArray.length][4];
34:
35: for (int i = 0; i < discArray.length; i++) {
36: result[i][1] = discArray[i].getArtist();
37: result[i][0] = discArray[i].getTitle();
38: result[i][2] = discArray[i].getGenre();
39: result[i][3] = discArray[i].getIsLiked() ? "Yes" : "No";
40: }
41: return result;
42:
43: } catch (Exception e) {
44: e.printStackTrace();
45: }
46:
47: return null;
48:
49: } //getDiscList
50:
51: }
|