View Javadoc

1   package edu.sampleu.demo.kitchensink;
2   
3   import javax.ws.rs.GET;
4   import javax.ws.rs.Path;
5   
6   /**
7    * Test service exposed through REST and connected to a {@link org.kuali.rice.krad.uif.element.DataTable}
8    * component in the UIF
9    *
10   * @author Kuali Rice Team (rice.collab@kuali.org)
11   */
12  @Path("/")
13  public class DataTableRestServiceTestImpl {
14  
15      /**
16       * Returns a string of data in JSON format for populating the table
17       *
18       * @return String json data string
19       */
20      @GET
21      @Path("/TableData")
22      public String getTableData() {
23          StringBuilder sb = new StringBuilder();
24  
25          sb.append("{ \"aaData\": [\n");
26  
27          for (int i = 0; i < 800; i++) {
28              sb.append("[\"CHEM " + i + "\",");
29              sb.append("\"INTRODUCTION TO GENERAL CHEMISTRY\",");
30              sb.append("\"3\",");
31              sb.append("\"AU\",");
32              sb.append("\"NW\",");
33              sb.append("\"Neal\",");
34              sb.append("\"MWF\",");
35              sb.append("\"300.00\",");
36              sb.append("\"3\",");
37              sb.append("\"100\"]");
38  
39              if (i < 799) {
40                  sb.append(",\n");
41              }
42          }
43  
44          sb.append("\n] }");
45  
46          return sb.toString();
47      }
48  }