Replace deprecated DOM.setElementAttribute().
[online-glom:gwt-glom.git] / src / main / java / org / glom / web / client / OnlineGlomService.java
1 /*
2  * Copyright (C) 2010, 2011 Openismus GmbH
3  *
4  * This file is part of GWT-Glom.
5  *
6  * GWT-Glom is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * GWT-Glom is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with GWT-Glom.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 package org.glom.web.client;
21
22 import java.util.ArrayList;
23
24 import org.glom.web.shared.DataItem;
25 import org.glom.web.shared.DetailsLayoutAndData;
26 import org.glom.web.shared.DocumentInfo;
27 import org.glom.web.shared.Documents;
28 import org.glom.web.shared.NavigationRecord;
29 import org.glom.web.shared.Reports;
30 import org.glom.web.shared.TypedDataItem;
31 import org.glom.web.shared.libglom.layout.LayoutGroup;
32 import org.glom.web.shared.libglom.layout.LayoutItemPortal;
33
34 import com.google.gwt.user.client.rpc.RemoteService;
35 import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
36
37 @RemoteServiceRelativePath("gwtGlom")
38 public interface OnlineGlomService extends RemoteService {
39
40         String getConfigurationErrorMessage();
41
42         /**
43          * Gets data for the details view.
44          * 
45          * @param documentID
46          *            identifier for the Glom document
47          * @param tableName
48          *            name of the table in the Glom document or an empty {@link String} ("") to get the layout for the
49          *            default table
50          * @param primaryKeyValue
51          *            value of the primary key in the specified Glom table to use in the query
52          * @return the result of the SQL query as an array of {@link DataItem}s
53          */
54         DataItem[] getDetailsData(String documentID, String tableName, TypedDataItem primaryKeyValue);
55
56         /**
57          * Gets a {@link DetailsLayoutAndData} object that contains the layout and data of the details view.
58          * 
59          * @param documentID
60          *            identifier for the Glom document
61          * @param tableName
62          *            name of the table in the Glom document or an empty {@link String} ("") to get the layout for the
63          *            default table
64          * @param primaryKeyValue
65          *            value of the primary key in the specified Glom table to use in the query
66          * @return a {@link DetailsLayoutAndData} object for the layout and initial data of the details view.
67          */
68         DetailsLayoutAndData getDetailsLayoutAndData(String documentID, String tableName, TypedDataItem primaryKeyValue,
69                         final String localeID);
70
71         DocumentInfo getDocumentInfo(String documentID, String localeID);
72
73         /**
74          * Gets a list of Glom documents found in the configured directory.
75          * 
76          * @return an {@link ArrayList<String>} of Glom document titles. If the list is empty, no glom documents were found
77          *         in the configured directory because it's empty or the directory is not configured correctly.
78          */
79         Documents getDocuments();
80
81         /**
82          * Retrieves data for a list view table.
83          * 
84          * @param documentID
85          *            identifier for the Glom document
86          * @param tableName
87          *            name of the table in the Glom document or an empty {@link String} ("") to get the layout for the
88          *            default table
89          * @param start
90          *            the start index in the data result set from the SQL query that should be retrieved
91          * @param length
92          *            the number of rows of data to retrieve
93          * @param sortColumnIndex
94          *            the index of the column to sort, or -1 for none.
95          * @param ascending
96          *            <code>true</code> if the column should be sorted in ascending order, <code>false</code> if the column
97          *            should be sorted in descending order
98          * @return an {@link ArrayList} of {@link DataItem} arrays that represents the requested data
99          */
100
101         ArrayList<DataItem[]> getListViewData(String documentID, String tableName, String quickFind, int start, int length,
102                         int sortColumnIndex, boolean isAscending);
103
104         LayoutGroup getListViewLayout(String documentID, String tableName, final String localeID);
105
106         /**
107          * Retrieves data for the related list table with the specified portal and foreign key value.
108          * 
109          * @param documentID
110          *            identifier for the Glom document
111          * @param tableName
112          *            name of the table in the Glom document or an empty {@link String} ("") to get the layout for the
113          *            default table
114          * @param portal
115          *            The portal to use for setting up the SQL query
116          * @param foreignKeyValue
117          *            the value of the foreign key
118          * @param start
119          *            the start index in the data result set from the SQL query that should be retrieved
120          * @param length
121          *            the number of rows of data to retrieve
122          * @param sortColumnIndex
123          *            the index of the column to sort, or -1 for none.
124          * @param ascending
125          *            <code>true</code> if the column should be sorted in ascending order, <code>false</code> if the column
126          *            should be sorted in descending order
127          * @return an {@link ArrayList} of {@link DataItem} arrays that represents the requested data
128          */
129         ArrayList<DataItem[]> getRelatedListData(String documentID, String tableName, LayoutItemPortal portal,
130                         TypedDataItem foreignKeyValue, int start, int length, int sortColumnIndex, boolean ascending);
131
132         /**
133          * Gets the expected row count for the related list table with the specified portal and foreign key value.
134          * 
135          * @param documentID
136          *            identifier for the Glom document
137          * @param tableName
138          *            name of the table in the Glom document or an empty {@link String} ("") to get the layout for the
139          *            default table
140          * @param portal
141          *            The portal to use for setting up the SQL query
142          * @param foreignKeyValue
143          *            the value of the foreign key
144          * @return the expected row count
145          */
146         int getRelatedListRowCount(String documentID, String tableName, LayoutItemPortal portal,
147                         TypedDataItem foreignKeyValue);
148
149         String getReportHTML(String documentID, String tableName, String reportName, String quickFind, String localeID);
150
151         /**
152          * Get a list of reports for the specified table.
153          * 
154          * @param documentID
155          *            identifier for the Glom document
156          * @param tableName
157          *            name of the table in the Glom document.
158          * @param localeID
159          *            The locale for the table titles.
160          * @return The names and titles of the table's reports.
161          */
162         Reports getReportsList(String documentID, String tableName, String localeID);
163
164         // TODO: Do this only on the server side, or only on the client side?
165         NavigationRecord getSuitableRecordToViewDetails(String documentID, String tableName, LayoutItemPortal portal,
166                         TypedDataItem primaryKeyValue);
167 }