# Liquid Data Control JCX File

When you create a Liquid Data Control, WebLogic Workshop generates a Java Control Extension (.jcx) file. The file contains methods corresponding to the queries in which the control accesses, shows the schema files of each query as a comment, and contains a commented method which, when uncommented, allows you to pass any XQuery statement to execute an ad-hoc query. This section describes the Liquid Data Control (.jcx) file and includes the following sections:

- Design View
- Source View
- Running Ad-Hoc Queries through the Liquid Data Control

## Design View

The design view of the Liquid Data Control (.jcx) file shows the available methods in a graphical view.

Figure 1-1 Design View of a Control File

With the right-click menu, you can add, modify (for example, change the query accessed by a method), rename, and delete methods. The right-click menu is context-sensitive; it displays different items if the mouse cursor is over a method, or in the control portion of the design pane.

## Source View

The source view shows the source code of the Java Control Extension (.jcx) file. It includes as comments the schema used to generate the XMLBean classes for each query. The signature for each method shows the return type of the method. The return type is the XMLBean class which was generated for the schemas.

This file is a generated file and the only time you should need to edit the source code is if you want to add a method to run an ad-hoc query, as described in Running Ad-Hoc Queries through the Liquid Data Control.

The following shows the beginning part of the source code for a generated Liquid Data Control (.jcx) file. It shows the package declaration, import statements, connection properties, the schema for the ApplOrderDetailView query, and the method that executes the ApplOrderDetailView query.

    package myFolder;

     import weblogic.jws.control.*;
     import com.bea.ld.control.LDControl;

     /**
     *   @jc:LiquidData urlKey="myTest.myTestWeb.myFolder.anotherLDControl"
     */
    public interface myLDControl extends LDControl, com.bea.control.ControlExtension
     {

        /* Generated methods corresponding to stored queries.
         */

        /**
         * @return <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="urn:retailer" xmlns:retailer="urn:retailer" xmlns:retailerType="urn:retailerType" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    	<xsd:import namespace="urn:retailerType"/>
    	<xsd:complexType name="ORDER_DETAIL_VIEW">
    		<xsd:sequence>
    			<xsd:element maxOccurs="unbounded" minOccurs="0" ref="retailerType:ORDER_DETAIL"/>
    		</xsd:sequence>
    	</xsd:complexType>
    	<xsd:element name="OrderDetailView">
    		<xsd:complexType>
    			<xsd:sequence>
    				<xsd:element maxOccurs="unbounded" minOccurs="0" name="ORDER_DETAIL_VIEW" type="retailer:ORDER_DETAIL_VIEW"/>
    			</xsd:sequence>
    		</xsd:complexType>
    	</xsd:element>
    </xsd:schema>
         *
         * @param orderid java.lang.String
         *
         * @param custid java.lang.String
         *
         * @jc:Stored-Query Name="rtl.ApplOrderDetailView"
         */
        retailer.OrderDetailViewDocument ApplOrderDetailView(java.lang.String
                                      orderid, java.lang.String custid);

## Running Ad-Hoc Queries through the Liquid Data Control

At the bottom of the generated Liquid Data Control (.jcx) file is a comment showing methods you can add which allow you to run an ad-hoc query through the control. To add one of these methods, uncomment the appropriate method and add a return type to the signature.

    /**
    *  Default method to execute an ad hoc query. This method can be customized
    * to have a differnt method name (e.g. runMyQuery), return a XML Bean class
    * (e.g. Customer), *  or to have one or both of the following two extra
    * parameters: com.bea.ldi.server.common.QueryParameters and
    * com.bea.ldi.server.common.QueryAttributes
    *  e.g. exec(String query, QueryParameters params);
    *  e.g. exec(String query, QueryAttributes attrs);
    *  e.g. exec(String query, QueryParameters params, QueryAttributes attrs);
    *             com.bea.xml.XmlObject executeXQuery(String query); */