Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Scout/Tutorial/5.0/webservices/Create WsLogTablePage"

< Scout‎ | Tutorial‎ | 5.0
m (Load WS Log data into WsLogTablePage)
(Create service to load WS Log data from database)
Line 54: Line 54:
 
== Create service to load WS Log data from database ==
 
== Create service to load WS Log data from database ==
 
Finally, we have to populate the table with WS Log data.  
 
Finally, we have to populate the table with WS Log data.  
For that purpose, go to the server node and double click on <tt>Outline Services > StandardOutlineService</tt> to open the corresponding Java class. In there, create the operation <tt>getWsLogTableData</tt> to load WS log data from database. Also add the operation signature to the service interface <tt>IStandardOutlineService</tt> to be accessible from client side.
+
For that purpose, go to the server node and double click on <tt>Outline Services > StandardOutlineService</tt> to open the corresponding Java class. In there, create the operation <tt>getWsLogTablePageData</tt> to load WS log data from database. Also add the operation signature to the service interface <tt>IStandardOutlineService</tt> to be accessible from client side.
  
 
<source lang="java">
 
<source lang="java">
 
@Override
 
@Override
public Object[][] getWsLogTableData() throws ProcessingException {
+
public WsLogTablePageData getWsLogTablePageData(WsLogTablePageData pageData) throws ProcessingException {
   return SQL.select("" +
+
   SQL.selectInto("" +  
        "SELECT   WS_LOG_NR, " +
+
      "SELECT WS_LOG_NR, " +  
        "         EVT_DATE, " +
+
      "       EVT_DATE, " +  
        "         SERVICE, " +
+
      "       SERVICE, " +  
        "         PORT, " +
+
      "       PORT, " +  
        "         OPERATION " +
+
      "       OPERATION " +  
        "FROM     WS_LOG ");
+
      "FROM   WS_LOG " +
 +
      "INTO  :{wsLogNr}, " +
 +
      "      :{date}, " +
 +
      "      :{service}, " +
 +
      "      :{port}, " +
 +
      "      :{operation} ",
 +
      pageData);
 +
  return pageData;
 
}
 
}
 
</source>
 
</source>

Revision as of 05:17, 31 March 2015

The Scout documentation has been moved to https://eclipsescout.github.io/.

Create WS Log Table Page

On the client node, go to Desktop > Outlines > StandardOutline. Right click on the node Child Pages to create a new The Scout documentation has been moved to https://eclipsescout.github.io/..

Create Company Table Page

As page layout, choose AbstractPageWithTable to create a page representing tabular data.

Choose Page Layout

On the next step, enter WS Log as name for that page and choose to add this page to the StandardOutline.

Give Page a name and link it with StandardOutline

By clicking Finish, the page is created and attached to the StandardOutline.

Create columns

On the WsLogTablePage node, go to Table > Columns. Right click on the node to create a new The Scout documentation has been moved to https://eclipsescout.github.io/..

Create column

Please add the following five columns to that table:

WsLogNrColumn
Type: Long Column
Name: Do not fill because column represents primary key and therefore is hidden
Class name: WsLogNrColumn
DateColumn
Type: String Column
Name: Date
Class name: DateColumn
ServiceColumn
Type: String Column
Name: Service
Class name: ServiceColumn
PortColumn
Type: String Column
Name: Port
Class name: PortColumn
OperationColumn
Type: String Column
Name: Operation
Class name: OperationColumn

To not display the WsLogNrColumn column because of holding the primary key, go to that column in Scout SDK and uncheck Displayable in Scout Property View.

To have the columns equally distributed over the available space of the table page, go to the The Scout documentation has been moved to https://eclipsescout.github.io/. node and check Auto Resize Columns in Scout Property View.

Create service to load WS Log data from database

Finally, we have to populate the table with WS Log data. For that purpose, go to the server node and double click on Outline Services > StandardOutlineService to open the corresponding Java class. In there, create the operation getWsLogTablePageData to load WS log data from database. Also add the operation signature to the service interface IStandardOutlineService to be accessible from client side.

@Override
public WsLogTablePageData getWsLogTablePageData(WsLogTablePageData pageData) throws ProcessingException {
  SQL.selectInto("" + 
      "SELECT WS_LOG_NR, " + 
      "       EVT_DATE, " + 
      "       SERVICE, " + 
      "       PORT, " + 
      "       OPERATION " + 
      "FROM   WS_LOG " + 
      "INTO   :{wsLogNr}, " + 
      "       :{date}, " + 
      "       :{service}, " + 
      "       :{port}, " + 
      "       :{operation} ", 
      pageData);
  return pageData;
}

Load WS Log data into WsLogTablePage

On client node, go to the WsLogTablePage to consume the service's data. On the Scout Property View, click on the operation Exec Load Data to populate the WS Log table. Implement the method as follows:

@Override
protected void execLoadData(SearchFilter filter) throws ProcessingException {
  WsLogTablePageData pageData = new WsLogTablePageData();
  pageData = SERVICES.getService(IStandardOutlineService.class).getWsLogTablePageData(pageData);
  importPageData(pageData);
}


You can continue the webservices tutorial.

Back to the top