Skip Headers
Oracle® Application Development Framework Developer's Guide
10g Release 3 (10.1.3)
B25386-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

A.5 Structure Definition Files

Structure definition files are created to support a data control's structure, and the structure of read-only and updateable attributes and collections.

When you register a session bean as an Oracle ADF data control, an XML definition file is created in the Model project for every session bean. The structure definition file has the same name as the session bean, but has a .xml extension. A structure definition is also created for each EJB entity and TopLink POJO.

Figure A-5 shows the toplevel definition for the JavaBean structure definition.

Figure A-5 Schema Root for the Structure Definition of a JavaBean

Navigator showing basic model project.

A.5.1 Syntax for the Structure Definition for a JavaBean

The toplevel element of the structure definition is <JavaBean>:

<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="10.1.3.35.83"
          id="<beanname>" BeanClass="oracle.srdemo.model.entities.<beanname>"
          Package="oracle.srdemo.model.entities" isJavaBased="true">

where the XML namespace attribute (xmlns) specifies the URI to which the structure definition binds at runtime. Only the package name is editable; all other attributes should have the values shown.

Figure A-6 displays the <Attribute> child element of the <JavaBean> element. It defines the structure definition of a bean attribute.

Figure A-6 Schema for Attribute

Navigator showing basic model project.

Figure A-7 displays the <AccessorMethod> child element of the <JavaBean> element. It defines the structure information for an attribute that returns an object.

Figure A-7 Schema for AccessorAttribute

Navigator showing basic model project.

Figure A-8 displays the <MethodAccessor> child element of the <JavaBean> element. It defines the structure information for a method that returns an object or collection. Note that unlike attribute accessors, method accessors can define parameters.

Figure A-8 Schema for MethodAccessor

Navigator showing basic model project.

Table A-2 describes the attributes of the structure definition of the bean. Note that each attribute or method specified by the bean, will have its own <Attribute>, <AccessorAttribute>, and <MethodAccessor> definition and each method parameter will have its own <ParameterInfo> definition.

Table A-2 Attributes of the Structure Definition for a Bean

Element Syntax Attributes Attribute Description

<Attribute>

AttrLoad

Internal


DefaultValue

This field is used only in case of variables and ADF BC datacontrol. For beans, since the beans themselves create a new bean instance, it is assumed that all properties are appropriately defaulted in the new instance.


DiscrColumn

Internal.


IsNotNull

Determines if the attribute is mandatory.


IsPersistent

Determines if an attribute is persistent or transient


IsQueriable

Determines if this attribute can participate in a WHERE clause


IsUnique

Determines if the attribute is unique, and will have a UNIQUE constraint generated in the database.


IsUpdateable

Determines if the attribute is always updateable, only updateable while new, or never updateable.


IsVisible

.Determines if the attribute is visible or hidden.


Name

The attributes name.


PrecisionRule

Determines whether precision should be applied. If true, the precision rule is applied.


PrimaryKey

.Determines the attributes that participate in a primary key.

<AttributeAccessor>

ArrayElementType

This is only used for ADF BC domains, to define the array type.


BeanClass

Fully qualified package name. Identifies the full path to the type's structure definition.


CollectionBeanClass

Fully qualified package name. Identifies the full path to the method accessor's structure definition. In the case of a session bean that accesses an entity that is a collection, this value will be either ReadOnlyCollection or UpdateableCollection.


id

Unique identifier. Same as the method name that appears in the bean class.


IsCollection

Identifies whether the method accessor returns a collection. Set to true when the entity accessed is a collection and specify the CollectionBeanClass attribute value.


SourceName

The name of the property on the source of this bean.


BeanClass

Fully qualified package name. Identifies the full path to the type's structure definition.


CollectionBeanClass

Fully qualified package name. Identifies the full path to the method accessor's structure definition. In the case of a session bean that accesses an entity that is a collection, this value will be either ReadOnlyCollection or UpdateableCollection.


id

Unique identifier. Same as the method name that appears in the bean class.


IsCollection

Identifies whether the method accessor returns a collection. Set to true when the entity accessed is a collection and specify the CollectionBeanClass attribute value.


ReturnNodeName

Unique identifier. Name used in the Data Control Palette to display the return node.

<MethodAccessor> <ParameterInfo /></MethodAccessor>

id

Unique identifier. Same as the method parameter name that appears in the method signature of the session bean class


Type

Specifies the data type of the parameter


A.5.2 Sample Structure Definition for the <sessionbeanname>.xml File

Example A-3 shows the sample SRAdminFacade.xml file from the SRDemo application. Notice that the SRAdminFacade.xml file lists attributes, accessors, and operations. Notice that operations may have parameters which reference other strucutre definitions (which are in turn composed of attributes, accessors, and operations).

Example A-3 Structure Definition of SRAdminFacade.xml

<?xml version="1.0" encoding="UTF-8" ?>
<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="10.1.3.35.83"
          id="SRAdminFacade" BeanClass="oracle.srdemo.model.SRAdminFacade"
          Package="oracle.srdemo.model" isJavaBased="true">
  <MethodAccessor IsCollection="false"
                  Type="oracle.srdemo.model.entities.ExpertiseArea"
                  BeanClass="oracle.srdemo.model.entities.ExpertiseArea"
                  id="createExpertiseArea"
                  ReturnNodeName="oracle.srdemo.model.entities.ExpertiseArea">
    <ParameterInfo id="product" Type="oracle.srdemo.model.entities.Product"
                   isStructured="true"/>
    <ParameterInfo id="user" Type="oracle.srdemo.model.entities.User"
                   isStructured="true"/>
    <ParameterInfo id="prodId" Type="java.lang.Integer" isStructured="false"/>
    <ParameterInfo id="userId" Type="java.lang.Integer" isStructured="false"/>
    <ParameterInfo id="expertiseLevel" Type="java.lang.String"
                   isStructured="false"/>
    <ParameterInfo id="notes" Type="java.lang.String" isStructured="false"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false"
                  Type="oracle.srdemo.model.entities.Product"
                  BeanClass="oracle.srdemo.model.entities.Product"
                  id="createProduct"
                  ReturnNodeName="oracle.srdemo.model.entities.Product">
    <ParameterInfo id="prodId" Type="java.lang.Integer" isStructured="false"/>
    <ParameterInfo id="name" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="image" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="description" Type="java.lang.String"
                   isStructured="false"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="oracle.srdemo.model.entities.User"
                  BeanClass="oracle.srdemo.model.entities.User" id="createUser"
                  ReturnNodeName="oracle.srdemo.model.entities.User">
    <ParameterInfo id="userId" Type="java.lang.Integer" isStructured="false"/>
    <ParameterInfo id="userRole" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="email" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="firstName" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="lastName" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="streetAddress" Type="java.lang.String"
                   isStructured="false"/>
    <ParameterInfo id="city" Type="java.lang.String" isStructured="false"/>
    <ParameterInfo id="stateProvince" Type="java.lang.String"
                   isStructured="false"/>
    <ParameterInfo id="postalCode" Type="java.lang.String"
                   isStructured="false"/>
    <ParameterInfo id="countryId" Type="java.lang.String" isStructured="false"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="true" Type="oracle.srdemo.model.entities.User"
                  BeanClass="oracle.srdemo.model.entities.User"
                  id="findAllStaffWithOpenAssignments"
                  ReturnNodeName="oracle.srdemo.model.entities.User"
                  CollectionBeanClass="UpdateableCollection"/>
  <MethodAccessor IsCollection="true"
                  Type="oracle.srdemo.model.entities.ExpertiseArea"
                  BeanClass="oracle.srdemo.model.entities.ExpertiseArea"
                  id="findExpertiseByUserId"
                  ReturnNodeName="oracle.srdemo.model.entities.ExpertiseArea"
                  CollectionBeanClass="UpdateableCollection">
    <ParameterInfo id="userIdParam" Type="java.lang.Integer"
                   isStructured="false"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="java.lang.Object" id="mergeEntity"
                  ReturnNodeName="Return">
    <ParameterInfo id="entity" Type="java.lang.Object" isStructured="false"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="java.lang.Object"
                  id="persistEntity" ReturnNodeName="Return">
    <ParameterInfo id="entity" Type="java.lang.Object" isStructured="false"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="java.lang.Object"
                  id="refreshEntity" ReturnNodeName="Return">
    <ParameterInfo id="entity" Type="java.lang.Object" isStructured="false"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="void" id="removeEntity"
                  ReturnNodeName="Return">
    <ParameterInfo id="entity" Type="java.lang.Object" isStructured="false"/>
  </MethodAccessor>
</JavaBean>

A.5.3 Sample Structure Definition for the <entitybeanname>.xml File

The XML files that get created for a TopLink POJO, EJB entity or a Java bean are very similar, as the constructs listed in each case are generic ADF metadata. The following syntax shows a TopLink entity XML file.

Example A-4 shows the sample Product.xml file from the SRDemo application. Notice the structure of the file, that it is broken up into attributes, accessors, and operations (methods).

Example A-4 Structure Definition of Product.xml

<?xml version="1.0" encoding="UTF-8" ?>
<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="10.1.3.35.65"
          id="Product" BeanClass="oracle.srdemo.model.entities.Product"
          Package="oracle.srdemo.model.entities" isJavaBased="true">
  <Attribute Name="description" Type="java.lang.String"/>
  <Attribute Name="image" Type="java.lang.String"/>
  <Attribute Name="name" Type="java.lang.String"/>
  <Attribute Name="prodId" Type="java.lang.Integer"/>
  <AccessorAttribute id="expertiseAreaCollection" IsCollection="true"
                     BeanClass="oracle.srdemo.model.entities.ExpertiseArea"
                     CollectionBeanClass="UpdateableCollection"/>
  <AccessorAttribute id="serviceRequestCollection" IsCollection="true"
                     BeanClass="oracle.srdemo.model.entities.ServiceRequest"
                     CollectionBeanClass="UpdateableCollection"/>
  <MethodAccessor IsCollection="false" Type="void" id="addExpertiseArea"
                  ReturnNodeName="Return">
    <ParameterInfo id="anExpertiseArea"
                   Type="oracle.srdemo.model.entities.ExpertiseArea"
                   isStructured="true"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="void" id="addExpertiseArea"
                  ReturnNodeName="Return">
    <ParameterInfo id="index" Type="int" isStructured="false"/>
    <ParameterInfo id="anExpertiseArea"
                   Type="oracle.srdemo.model.entities.ExpertiseArea"
                   isStructured="true"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="void" id="addServiceRequest"
                  ReturnNodeName="Return">
    <ParameterInfo id="aServiceRequest"
                   Type="oracle.srdemo.model.entities.ServiceRequest"
                   isStructured="true"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="void" id="addServiceRequest"
                  ReturnNodeName="Return">
    <ParameterInfo id="index" Type="int" isStructured="false"/>
    <ParameterInfo id="aServiceRequest"
                   Type="oracle.srdemo.model.entities.ServiceRequest"
                   isStructured="true"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="void" id="removeExpertiseArea"
                  ReturnNodeName="Return">
    <ParameterInfo id="anExpertiseArea"
                   Type="oracle.srdemo.model.entities.ExpertiseArea"
                   isStructured="true"/>
  </MethodAccessor>
  <MethodAccessor IsCollection="false" Type="void" id="removeServiceRequest"
                  ReturnNodeName="Return">
    <ParameterInfo id="aServiceRequest"
                   Type="oracle.srdemo.model.entities.ServiceRequest"
                   isStructured="true"/>
  </MethodAccessor>
  <ConstructorMethod IsCollection="false" Type="void" id="Product"/>
</JavaBean>

A.5.4 Collection and SingleValue Sample Files

Four additional f iles are also generated:

  • ReadOnlyCollection.xml

  • ReadOnlySingleValue.xml

  • UpdateableCollection.xml

  • UpdateableSingleValue.xml

These files support the Data Control Palette in JDeveloper. The files are used only at design time to specify the list of operations that the Data Control Palette may display for a given accessor. These files are referenced by the accessor's CollectionBeanClass attribute. Typically you do not edit these files, but if you wanted to remove an operation from the Palette, you could remove an item on this list.

Example A-2 shows a read-only collection. The syntax for all four design-time XML files is similar.

Example A-5 Read-only Collection Syntax

<?xml version="1.0" encoding="UTF-8" ?>
<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="10.1.3.35.65"
          id="ReadOnlyCollection" BeanClass="ReadOnlyCollection"
          isJavaBased="false">
  <BuiltinOperation id="IteratorExecute"/>
  <BuiltinOperation id="Find"/>
  <BuiltinOperation id="First"/>
  <BuiltinOperation id="Last"/>
  <BuiltinOperation id="Next"/>
  <BuiltinOperation id="Previous"/>
  <BuiltinOperation id="NextSet"/>
  <BuiltinOperation id="PreviousSet"/>
  <BuiltinOperation id="setCurrentRowWithKey"/>
  <BuiltinOperation id="setCurrentRowWithKeyValue"/>
</JavaBean>