Show TOC

Defining Supply Functions for the Node ElementsLocate this document in the navigation structure

Use

When the mobile client for laptop synchronizes with the DOE, the data is stored in the local database. So, an application running on the client has to read data from the local database (MaxDB is the default database for the client).

The data the application has to read are the attribute values. For each node element, you define a supply function. In the application, when a particular node element is instantiated, its supply function populates the node attributes with values that are present in the database.

Procedure
  1. In the Laptop UI explorer, expand the development component (DC), and then expand the CustomerComp node. Click Component Controller with the secondary mouse button, and choose Start of the navigation path Open  Next navigation step Open Controller Editor End of the navigation path.

  2. Choose the Context tab.

  3. Select the CUSTOMERS_ CUSTOMERHEADER context node, and in the Properties tab select Supply Function .

  4. To create the supply function, select Create .

  5. With the default name for the supply function, choose OK .

  6. Choose Save .

  7. In the CustomerComp node, click Component Controller with the secondary mouse button and choose Start of the navigation path Open  Next navigation step Open Java Editor End of the navigation path

  8. Perform the following steps by entering the code in the file CustomerComp.java:

Variable declaration and initialization

//@@begin others

ServiceModels model = ServiceModels. getInstance ();

ServiceQuery SQ = model.create ServiceQuery();

String Qid;

//@@end

Supply function for Customer node

public void supplyCUSTOMERS_CUSTOMERHEADER(IPrivateDemocomp.ICUSTOMERS_CUSTOMERHEADERNode node, IPrivateDemocomp.IContextElement parentElement)

{

//@@begin supplyCUSTOMERS_CUSTOMERHEADER(IWDNode,IWDNodeElement)

Collection col = model.getCUSTOMERS_CUSTOMERHEADERs();

if (col== null )

{

CUSTOMERS_CUSTOMERHEADER inst = model.createCUSTOMERS_CUSTOMERHEADER();

model.addToCUSTOMERS_CUSTOMERHEADERs(inst);

col = model.getCUSTOMERS_CUSTOMERHEADERs();

}

node.bind(col);

//@@end

}

Supply function for ServiceQuery node

public void supplyServiceQuery(IPrivateCustomerComp.IServiceQueryNode node, IPrivateCustomerComp.IContextElement parentElement)

{

//@@begin supplyQueryResult(IWDNode,IWDNodeElement)

wdContext.nodeServiceQuery().bind(SQ);

//@@end

}