Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Scout/Tutorial/3.9/webservices/Create WsLogForm"
(New page: {{ScoutPage|cat=Tutorial 3.9}} == Create Ws Log Form == On the client node, go to 'Forms'. Right click on the node to create the WsLog{{ScoutLink|Concepts|Form}} [http://wiki.eclipse.org/...) |
m (→Create Ws Log Form) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
== Create Ws Log Form == | == Create Ws Log Form == | ||
− | On the client node, go to | + | On the client node, go to <tt>Forms</tt>. Right click on the node to create the WsLog{{ScoutLink|Concepts|Form}}. |
− | Because the form does only display read-only data, change the < | + | [[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogForm_1.png|Create WsLogForm]] |
+ | |||
+ | As the name of the form, enter <tt>Ws Log</tt> and choose to create the Form ID which is the primary key of the log entry. | ||
+ | |||
+ | [[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogForm_3.9_2.png|Create WsLogForm]] | ||
+ | |||
+ | Click next to choose from the artifacts which also should be created by Scout SDK. | ||
+ | |||
+ | [[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogForm_3.9_3.png|Create WsLogForm artefacts]] | ||
+ | |||
+ | Uncheck all permissions as {{ScoutLink|Concepts|Security|Authorization}} is not part of this tutorial. As the WS log is read-only, also uncheck <tt>NewHandler</tt>. | ||
+ | |||
+ | Because the form does only display read-only data, change the <tt>ModifyHandler</tt> as follows: | ||
<source lang="java"> | <source lang="java"> | ||
Line 11: | Line 23: | ||
@Override | @Override | ||
public void execLoad() throws ProcessingException { | public void execLoad() throws ProcessingException { | ||
− | + | IWSLogService service = SERVICES.getService(IWSLogService.class); | |
− | + | WSLogFormData formData = new WSLogFormData(); | |
exportFormData(formData); | exportFormData(formData); | ||
formData = service.load(formData); | formData = service.load(formData); | ||
Line 24: | Line 36: | ||
== Create Form Fields == | == Create Form Fields == | ||
− | On the < | + | On the <tt>WsLogForm</tt> node, go to the <tt>MainBox</tt>. Right click on the MainBox to create the following 4 {{ScoutLink|Concepts|Field|form fields}}: |
'''DateField''' | '''DateField''' | ||
Line 53: | Line 65: | ||
Class name: SoapMessageBox | Class name: SoapMessageBox | ||
− | Because the tab box < | + | Because the tab box <tt>SoapMessageBox</tt> should not have a label, go to that node and uncheck the <tt>Label Visible</tt> property in the 'Advanced Properties' section of the Scout Property View. Next, we will create the two tabs. Therefore, right click on <tt>SoapMessageBox</tt> and create the following two boxes: |
+ | |||
+ | [[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogForm_4.png|Create Tab Box]] | ||
'''RequestBox''' | '''RequestBox''' | ||
Line 65: | Line 79: | ||
Finally, add two String fields to hold request and response to the boxes. | Finally, add two String fields to hold request and response to the boxes. | ||
− | Right click on <code>RequestBox</code> to create the 'Request' String field [ | + | Right click on <code>RequestBox</code> to create the 'Request' String field: |
+ | |||
+ | [[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogForm_5.png|Create Request tab]] | ||
+ | |||
'''RequestField''' | '''RequestField''' | ||
Type: String Field | Type: String Field | ||
Line 71: | Line 88: | ||
Class name: RequestField | Class name: RequestField | ||
− | Right click on <code>ResponseBox</code> to create the 'Response' String field [ | + | Right click on <code>ResponseBox</code> to create the 'Response' String field: |
+ | |||
+ | [[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogForm_6.png|Create Response tab]] | ||
+ | |||
'''ResponseField''' | '''ResponseField''' | ||
Type: String Field | Type: String Field | ||
Line 77: | Line 97: | ||
Class name: ResponseField | Class name: ResponseField | ||
− | In both fields, adjust their properties in Scout Property View as following [ | + | In both fields, adjust their properties in Scout Property View as following: |
+ | |||
+ | [[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogForm_7.png|Update properties of Request / Response fields]] | ||
* Set <code>Grid H</code> to 5 | * Set <code>Grid H</code> to 5 | ||
Line 87: | Line 109: | ||
== Associate WsLogForm with WsLogTablePage == | == Associate WsLogForm with WsLogTablePage == | ||
− | To view a log record, you have to add a | + | To view a log record, you have to add a <tt>VIEW</tt> menu to the <code>WsLogTablePage</code>. |
− | On client node, go to the node | + | On client node, go to the node <tt>Desktop > Outlines > StandardOutline > Child Pages > WsLogTablePage > Table > Menus</tt>. Right-click on the menu node to create the following menu: |
+ | |||
+ | [[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogForm_8.png|Create view menu on WsLogTablePage]] | ||
− | '''VIEW menu | + | '''VIEW menu''' |
Name: View WS Log... | Name: View WS Log... | ||
Class Name: ViewWsLogMenu | Class Name: ViewWsLogMenu | ||
Line 97: | Line 121: | ||
Form handler: ModifyHandler | Form handler: ModifyHandler | ||
− | We also have to provide the < | + | We also have to provide the <tt>WsLogNr</tt> primary key as argument to the <tt>WsLogForm</tt>. For that reason, double click the <tt>ViewWsLogMenu</tt> to modify the code in <code>execAction()</code> as follows: |
<source lang="java"> | <source lang="java"> | ||
Line 116: | Line 140: | ||
== Load WS Log data == | == Load WS Log data == | ||
− | Scout SDK already created <code> | + | Scout SDK already created <code>WsLogService</code> in order to load WS log data. |
Because we are only reading but not updating log entries, you can remove all operations except <code>load</code>. | Because we are only reading but not updating log entries, you can remove all operations except <code>load</code>. | ||
Line 122: | Line 146: | ||
<source lang="java"> | <source lang="java"> | ||
− | public class | + | public class WsLogService extends AbstractService implements IWsLogService { |
@Override | @Override | ||
Line 146: | Line 170: | ||
</source> | </source> | ||
− | + | ''You can continue the [[{{BASEPAGENAME}}/Webservices_with_JAX-WS|webservices tutorial]].'' | |
− | [[ | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 02:39, 22 August 2013
The Scout documentation has been moved to https://eclipsescout.github.io/.
Contents
Create Ws Log Form
On the client node, go to Forms. Right click on the node to create the WsLogThe Scout documentation has been moved to https://eclipsescout.github.io/..
As the name of the form, enter Ws Log and choose to create the Form ID which is the primary key of the log entry.
Click next to choose from the artifacts which also should be created by Scout SDK.
Uncheck all permissions as The Scout documentation has been moved to https://eclipsescout.github.io/. is not part of this tutorial. As the WS log is read-only, also uncheck NewHandler.
Because the form does only display read-only data, change the ModifyHandler as follows:
public class ModifyHandler extends AbstractFormHandler { @Override public void execLoad() throws ProcessingException { IWSLogService service = SERVICES.getService(IWSLogService.class); WSLogFormData formData = new WSLogFormData(); exportFormData(formData); formData = service.load(formData); importFormData(formData); // disable whole form setEnabledGranted(false); } }
Create Form Fields
On the WsLogForm node, go to the MainBox. Right click on the MainBox to create the following 4 The Scout documentation has been moved to https://eclipsescout.github.io/.:
DateField Type: Date Field Name: Date Class name: DateField
ServiceField Type: String Field Name: Service Class name: ServiceField
PortField Type: String Field Name: Port Class name: PortField
OperationField Type: String Field Name: Operation Class name: OperationField
To display the SOAP message for request and response, we create a The Scout documentation has been moved to https://eclipsescout.github.io/. that contains the two tabs 'Request' and 'Response', respectively.
SoapMessageBox Type: Tab Box Name: <leave empty as no label> Class name: SoapMessageBox
Because the tab box SoapMessageBox should not have a label, go to that node and uncheck the Label Visible property in the 'Advanced Properties' section of the Scout Property View. Next, we will create the two tabs. Therefore, right click on SoapMessageBox and create the following two boxes:
RequestBox Name: Request Class name: RequestBox
ResponseBox Name: Response Class name: ResponseBox
Finally, add two String fields to hold request and response to the boxes.
Right click on RequestBox
to create the 'Request' String field:
RequestField Type: String Field Name: <leave empty as no label> Class name: RequestField
Right click on ResponseBox
to create the 'Response' String field:
ResponseField Type: String Field Name: <leave empty as no label> Class name: ResponseField
In both fields, adjust their properties in Scout Property View as following:
- Set
Grid H
to 5 - Set
Grid W
to 0 (FULL_WIDTH) - Set
Label Visible
to false - Set
Max Length
to inf (Integer.MAX_VALUE) - Set
Multiline Text
to true - Set
Wrap Text
to true
Associate WsLogForm with WsLogTablePage
To view a log record, you have to add a VIEW menu to the WsLogTablePage
.
On client node, go to the node Desktop > Outlines > StandardOutline > Child Pages > WsLogTablePage > Table > Menus. Right-click on the menu node to create the following menu:
VIEW menu Name: View WS Log... Class Name: ViewWsLogMenu Super Type: AbstractMenu Form to start: WsLogForm Form handler: ModifyHandler
We also have to provide the WsLogNr primary key as argument to the WsLogForm. For that reason, double click the ViewWsLogMenu to modify the code in execAction()
as follows:
@Override protected void execAction() throws ProcessingException { WsLogForm form = new WsLogForm(); // Add the following line to set the primary key of the selected log record to the form form.setWSLogNr(getWsLogNrColumn().getSelectedValue()); form.startModify(); form.waitFor(); if (form.isFormStored()) { reloadPage(); } }
Load WS Log data
Scout SDK already created WsLogService
in order to load WS log data.
Because we are only reading but not updating log entries, you can remove all operations except load
.
Please implement the load-method stub as following:
public class WsLogService extends AbstractService implements IWsLogService { @Override public WsLogFormData load(WsLogFormData formData) throws ProcessingException { SQL.selectInto("" + "SELECT EVT_DATE, " + " SERVICE, " + " PORT, " + " OPERATION, " + " REQUEST, " + " RESPONSE " + "FROM WS_LOG " + "WHERE WS_LOG_NR = :wSLogNr " + "INTO :date, " + " :service, " + " :port, " + " :operation, " + " :request, " + " :response" , formData); return formData; }
You can continue the webservices tutorial.