Documentation

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
jvx:firstapp [2018/01/25 08:32]
admin
jvx:firstapp [2018/01/25 08:44]
admin
Line 15: Line 15:
   * [[#​application|Application]]   * [[#​application|Application]]
   * [[#​workscreen|Work screen]]   * [[#​workscreen|Work screen]]
-  * Business object+  * [[#​workscreen|Business object]]
   * Database connection   * Database connection
  
Line 263: Line 263:
 |InitializeUI|Layouting of the work screen.| |InitializeUI|Layouting of the work screen.|
 |createSubConnection|We create a separate connection to the server. This has the advantage that a separate business object is used on the server. This object contains all objects needed by the work screen. Once the work screen is closed, the used memory is released. Moreover, each connection can have special parameters and time outs. \\ The requested business object is defined with the following class: ''​apps.firstapp.frames.DBEdit''​. \\ \\ The class will be created later on.| |createSubConnection|We create a separate connection to the server. This has the advantage that a separate business object is used on the server. This object contains all objects needed by the work screen. Once the work screen is closed, the used memory is released. Moreover, each connection can have special parameters and time outs. \\ The requested business object is defined with the following class: ''​apps.firstapp.frames.DBEdit''​. \\ \\ The class will be created later on.|
 +
 +^ Member ^ Description ^
 +|connection|The connection to the server, specially ​ for the work screen. A special communication protocol is used in the background. In our case, it mirrors the ''​DirectServerConnection''​ class.|
 +|dataSource|This is the data source and looks after the transfer of data between the client and the server. The connection is used for the transfer.|
 +|rdbContacts|The model and the controller for data display. \\ The name contacts defines under which name the server-side business object can be found.|
 +
 +{{anchor:​business:​}}
 +== Create a business object ==
 +
 +Once we have created the client, we need the corresponding business object on the server, so as to define the source of the data more precisely. To do so, we use the following code:
 +
 +<file java DBEdit.java>​
 +package apps.firstapp.frames;​
 +
 +import javax.rad.persist.IStorage;​
 +
 +import com.sibvisions.rad.persist.jdbc.DBStorage;​
 +
 +import apps.firstapp.Session;​
 +
 +/**
 + * The LCO for the DBEdit WorkScreen.
 + * <p/>
 + * @author René Jahn
 + */
 +public class DBEdit extends Session
 +{
 +  //​~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 +  // User-defined methods
 +  //​~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 +
 +  /**
 +   * Returns the contacts storage.
 +   ​* ​
 +   * @return the contacts storage
 +   * @throws Exception if the initialization throws an error
 +   */
 +  public IStorage getContacts() throws Exception
 +  {
 +    DBStorage dbsContacts = (DBStorage)get("​contacts"​);​
 +  ​
 +    if (dbsContacts == null)
 +    {
 +      dbsContacts = new DBStorage();​
 +      dbsContacts.setDBAccess(getDBAccess());​
 +      dbsContacts.setFromClause("​CONTACTS"​);​
 +      dbsContacts.setWritebackTable("​CONTACTS"​);​
 +      dbsContacts.open();​
 +   
 +      put("​contacts",​ dbsContacts);​
 +    }
 +  ​
 +    return dbsContacts;​
 +  }
 +  ​
 +}  // DBEdit
 +</​file>​
 +
 +^ Description ^
 +|The class mirrors the business object for the ''​DBEditFrame''​ work screen. The objects can only be accessed via the SubConnection of the work screen. \\ Through the class derivation of ''​apps.firstapp.Session'',​ it is very easy to access all objects of the Session and the ''​Application''​.|
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information