2 Replies Latest reply on Jan 19, 2016 4:09 AM by handat

    Unable to customize java class for xml data control

    pradeep .n

      ctually I'm  new to the xml data control and I created a sample app in jdeveopler 11g by following the tutorial  Tutorial: Powerful and Easy ADF Data Control for XML Data - Part 1 [ARTICLE]

      So, till now   I'm able to create xsd , xml files, xml data control and able to print xml data.... but The problem  here is, To Customize the data I created java class and methods and annotated respectively and configured java class  in DataControls.dcx  as shown  below

       

       

      <?xml version="1.0" encoding="UTF-8" ?>

      <DataControlConfigs xmlns="http://xmlns.oracle.com/adfm/configuration"

                          version="11.1.1.65.57" id="DataControls" Package="view">

        <AdapterDataControl id="HRdataDC"

                            FactoryClass="oracle.adf.model.adapter.DataControlFactoryImpl"

                            ImplDef="org.adfemg.datacontrol.xml.DataControlDefinition"

                            SupportsTransactions="false"

                            SupportsSortCollection="false" SupportsResetState="false"

                            SupportsRangesize="false" SupportsFindMode="false"

                            SupportsUpdates="false" Definition="view.HRdataDC"

                            BeanClass="view.HRdataDC"

                            xmlns="http://xmlns.oracle.com/adfm/datacontrol">

          <Source>

            <definition xmlns="http://adfemg.org/adfm/datacontrol/configuration"

                        schema="HR.xsd" schema-root="DepartmentList"

                        dc-operation="getXML">

              <data-provider class="org.adfemg.datacontrol.xml.provider.data.ResourceDataProvider">

                <parameters>

                  <parameter name="resource" value="HRdata.xml"/>

                </parameters>

              </data-provider>

             <customization-provider class="org.adfemg.datacontrol.xml.provider.customization.CustomizationProviderImpl">

                  <paramaters>

                       <list-parameter name="classes">

                          <value>EmployeeCust</value>

                      </list-parameter>

                  </paramaters>

              </customization-provider>

            </definition>

          </Source>

        </AdapterDataControl>

       

      </DataControlConfigs>

       

      Java class:-

      package view;


      import org.adfemg.datacontrol.xml.annotation.CalculatedAttr;

      import org.adfemg.datacontrol.xml.annotation.ElementCustomization;

      import org.adfemg.datacontrol.xml.data.XMLDCElement;

       

       

      @ElementCustomization(target = "view.HRdataDC.getXML.DepartmentList.Department.Employees.Employee")

      public class EmployeeCust {

       

          @CalculatedAttr

          public String getFullName(XMLDCElement employee) {

           return employee.get("firstName") +" "+employee.get("lastName");

          }

      }

       

      PageDef.xml File:-

      <accessorIterator MasterBinding="EmployeesIterator" Binds="Employee"

                            RangeSize="25" DataControl="HRdataDC"

                            BeanClass="view.HRdataDC.getXML.DepartmentList.Department.Employees.Employee"

                            id="EmployeeIterator" ChangeEventPolicy="ppr"/>

       

      the problem I'm facing here is unable to find the variable fullName in Data control.

      (DataControl.dcx and Java class are in  package view)

       

      thank's,

      pradeep.

        • 1. Re: Unable to customize java class for xml data control
          dvohra21

          No such variable fullName is defined. The variable firstName is defined.

          • 2. Re: Unable to customize java class for xml data control
            handat

            You need to make sure the package name matches up:

             

            <customization-provider class="org.adfemg.datacontrol.xml.provider.customization.CustomizationProviderImpl">

                        <paramaters>

                             <list-parameter name="classes">

                                <value>EmployeeCust</value>

                            </list-parameter>

                        </paramaters>

                    </customization-provider>

             

             

            package view;


            import org.adfemg.datacontrol.xml.annotation.CalculatedAttr;

            import org.adfemg.datacontrol.xml.annotation.ElementCustomization;

            import org.adfemg.datacontrol.xml.data.XMLDCElement;

             

            According to the above, your DataControl is wrong. It should be view.EmployeeCust