0 Replies Latest reply on Nov 24, 2012 6:49 PM by 892197

    JAXB annotations not working

    892197
      I have the following requirement where I need to move the following XML into Java Objects

      <bundle>
      <entities>
      <processingSequence>5</processingSequence>
      <sequence>1</sequence>
      <mo>F1-BUS OBJ</mo>
      <pk1>DM-ElectricServicePoint</pk1>
      <bo>F1-BusinessObjectPhysicalBO</bo>
      <boData>
      .......................CLOB Data here..........
      </boData>
      </entities>
      </bundle>


      I have create following 2 classes
      Bundle
      Entities
      I am not able to get the annotations right
      ==============Bundle===================


      import java.util.ArrayList;

      import javax.xml.bind.annotation.*;
      import javax.xml.bind.annotation.XmlAttribute;
      import javax.xml.bind.annotation.XmlElement;
      import javax.xml.bind.annotation.XmlElementWrapper;
      import javax.xml.bind.annotation.XmlRootElement;

      @XmlRootElement (name ="bundle")
      public class Bundle {
           

      /**
      * field for BundleId
      */
      java.lang.String localBundleId ;
           

           
           
      public java.lang.String getBundleId(){
      return localBundleId;
      }


      /**
      * Auto generated setter method
      * @param param BundleId
      */
      @XmlElement
      public void setBundleId(java.lang.String param){


      this.localBundleId=param;


      }





      java.lang.String localBo ;






      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getBo(){
      return localBo;
      }



      /**
      * Auto generated setter method
      * @param param Bo
      */
      @XmlElement
      public void setBo(java.lang.String param){


      this.localBo=param;


      }


      /**
      * field for BoStatus
      */


      java.lang.String localBoStatus;
      /* This tracker boolean wil be used to detect whether the user called the set method
      * for this attribute. It will be used to determine whether to include this field
      * in the serialized XML
      */




      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getBoStatus(){
      return localBoStatus;
      }



      /**
      * Auto generated setter method
      * @param param BoStatus
      */
      @XmlElement
      public void setBoStatus(java.lang.String param){


      this.localBoStatus=param;


      }


      /**
      * field for StatusDateTime
      */


      java.util.Calendar localStatusDateTime ;



      /**
      * Auto generated getter method
      * @return java.util.Calendar
      */

      public java.util.Calendar getStatusDateTime(){
      return localStatusDateTime;
      }



      /**
      * Auto generated setter method
      * @param param StatusDateTime
      */
      @XmlElement
      public void setStatusDateTime(java.util.Calendar param){


      this.localStatusDateTime=param;


      }


      /**
      * field for UserId
      */


      protected java.lang.String localUserId ;






      /**
      * Auto generated getter method
      * @return java.lang.String
      */

      public java.lang.String getUserId(){
      return localUserId;
      }



      /**
      * Auto generated setter method
      * @param param UserId
      */
      @XmlElement
      public void setUserId(java.lang.String param){


      this.localUserId=param;


      }


      /**
      * field for CreationDateTime
      */


      protected java.util.Calendar localCreationDateTime ;




      /**
      * Auto generated getter method
      * @return java.util.Calendar
      */
      public java.util.Calendar getCreationDateTime(){
      return localCreationDateTime;
      }



      /**
      * Auto generated setter method
      * @param param CreationDateTime
      */
      @XmlElement
      public void setCreationDateTime(java.util.Calendar param){


      this.localCreationDateTime=param;


      }


      /**
      * field for Description
      */


      protected java.lang.String localDescription ;




      /**
      * Auto generated getter method
      * @return java.lang.String
      */

      public java.lang.String getDescription(){
      return localDescription;
      }



      /**
      * Auto generated setter method
      * @param param Description
      */
      @XmlElement
      public void setDescription(java.lang.String param){


      this.localDescription=param;


      }


      /**
      * field for Version
      */

      protected java.math.BigDecimal localVersion ;






      /**
      * Auto generated getter method
      * @return java.math.BigDecimal
      */
      public java.math.BigDecimal getVersion(){
      return localVersion;
      }



      /**
      * Auto generated setter method
      * @param param Version
      */
      @XmlElement
      public void setVersion(java.math.BigDecimal param){


      this.localVersion=param;


      }


      /**
      * field for ExternalReferenceId
      */


      protected java.lang.String localExternalReferenceId ;


      /**
      * Auto generated getter method
      * @return java.lang.String
      */

      public java.lang.String getExternalReferenceId(){
      return localExternalReferenceId;
      }



      /**
      * Auto generated setter method
      * @param param ExternalReferenceId
      */
      @XmlElement
      public void setExternalReferenceId(java.lang.String param){

      this.localExternalReferenceId=param;


      }


      /**
      * field for SourceEnvironment
      */


      protected java.lang.String localSourceEnvironment ;

      /* This tracker boolean wil be used to detect whether the user called the set method
      * for this attribute. It will be used to determine whether to include this field
      * in the serialized XML
      */



      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getSourceEnvironment(){
      return localSourceEnvironment;
      }



      /**
      * Auto generated setter method
      * @param param SourceEnvironment
      */
      @XmlElement
      public void setSourceEnvironment(java.lang.String param){

      this.localSourceEnvironment=param;


      }


      /**
      * field for SourceProductVersion
      */


      protected java.lang.String localSourceProductVersion ;



      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getSourceProductVersion(){
      return localSourceProductVersion;
      }



      /**
      * Auto generated setter method
      * @param param SourceProductVersion
      */

      public void setSourceProductVersion(java.lang.String param){


      this.localSourceProductVersion=param;


      }




           private ArrayList <Entities_type1> entities ;

           
           @XmlElement(name = "entities")
           public void setEntities(ArrayList<Entities_type1> entities) {
           this.entities = entities;
           }
           
           
           
      public ArrayList<Entities_type1> getEntities(){
      return entities;
      }









      }


      ==============Entities===================
      import javax.xml.bind.annotation.XmlAccessorOrder;

      import javax.xml.bind.annotation.XmlAccessType;
      import javax.xml.bind.annotation.XmlAccessorType;
      import javax.xml.bind.annotation.XmlElement;
      import javax.xml.bind.annotation.XmlRootElement;

      import org.apache.axis2.databinding.utils.*;

      import javax.xml.bind.annotation.*;



      public class Entities_type1
      {
      /* This type was generated from the piece of schema that had
      name = entities_type0
      Namespace URI = http://oracle.com/F1-BundleImport.xsd
      Namespace Prefix = ns2
      */


      /**
      * field for ProcessingSequence
      */


      protected java.math.BigDecimal localProcessingSequence ;

      /* This tracker boolean wil be used to detect whether the user called the set method
      * for this attribute. It will be used to determine whether to include this field
      * in the serialized XML
      */



      /**
      * Auto generated getter method
      * @return java.math.BigDecimal
      */
      public java.math.BigDecimal getProcessingSequence(){
      return localProcessingSequence;
      }



      /**
      * Auto generated setter method
      * @param param ProcessingSequence
      */

      @XmlElement
      public void setProcessingSequence(java.math.BigDecimal param){


      this.localProcessingSequence=param;


      }


      /**
      * field for Sequence
      */


      protected java.math.BigDecimal localSequence ;




      /**
      * Auto generated getter method
      * @return java.math.BigDecimal
      */
      public java.math.BigDecimal getSequence(){
      return localSequence;
      }



      /**
      * Auto generated setter method
      * @param param Sequence
      */

      @XmlElement
      public void setSequence(java.math.BigDecimal param){


      this.localSequence=param;


      }


      /**
      * field for Mo
      */


      protected java.lang.String localMo ;

      /* This tracker boolean wil be used to detect whether the user called the set method
      * for this attribute. It will be used to determine whether to include this field
      * in the serialized XML
      */



      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getMo(){
      return localMo;
      }



      /**
      * Auto generated setter method
      * @param param Mo
      */

      @XmlElement
      public void setMo(java.lang.String param){


      this.localMo=param;


      }


      /**
      * field for Pk1
      */


      protected java.lang.String localPk1 ;





      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getPk1(){
      return localPk1;
      }



      /**
      * Auto generated setter method
      * @param param Pk1
      */
      @XmlElement
      public void setPk1(java.lang.String param){


      this.localPk1=param;


      }


      /**
      * field for Pk2
      */


      protected java.lang.String localPk2 ;




      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getPk2(){
      return localPk2;
      }



      /**
      * Auto generated setter method
      * @param param Pk2
      */

      @XmlElement
      public void setPk2(java.lang.String param){


      this.localPk2=param;


      }


      /**
      * field for Pk3
      */


      protected java.lang.String localPk3 ;

      /* This tracker boolean wil be used to detect whether the user called the set method
      * for this attribute. It will be used to determine whether to include this field
      * in the serialized XML
      */



      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getPk3(){
      return localPk3;
      }



      /**
      * Auto generated setter method
      * @param param Pk3
      */
      @XmlElement
      public void setPk3(java.lang.String param){


      this.localPk3=param;


      }


      /**
      * field for Pk4
      */


      protected java.lang.String localPk4 ;




      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getPk4(){
      return localPk4;
      }



      /**
      * Auto generated setter method
      * @param param Pk4
      */
      @XmlElement
      public void setPk4(java.lang.String param){


      this.localPk4=param;


      }


      /**
      * field for Pk5
      */


      protected java.lang.String localPk5 ;

      /**
      * Auto generated getter method
      * @return java.lang.String
      */
      public java.lang.String getPk5(){
      return localPk5;
      }



      /**
      * Auto generated setter method
      * @param param Pk5
      */
      @XmlElement
      public void setPk5(java.lang.String param){


      this.localPk5=param;


      }


      /**
      * field for Bo
      */


      protected java.lang.String localBo ;

      /* This tracker boolean wil be used to detect whether the user called the set method

      public java.lang.String getBo(){
      return localBo;
      }



      /**
      * Auto generated setter method
      * @param param Bo
      */
      @XmlElement
      public void setBo(java.lang.String param){


      this.localBo=param;


      }


      /**
      * field for BoData
      * This was an Array!
      */


      protected java.lang.Object[] localBoData ;

      /* This tracker boolean wil be used to detect whether the user called the set method
      * for this attribute. It will be used to determine whether to include this field
      * in the serialized XML
      */
      protected boolean localBoDataTracker = false ;

      public boolean isBoDataSpecified(){
      return localBoDataTracker;
      }



      /**
      * Auto generated getter method
      * @return java.lang.Object[]
      */
      public java.lang.Object[] getBoData(){
      return localBoData;
      }






      /**
      * validate the array for BoData
      */
      protected void validateBoData(java.lang.Object[] param){

      }


      /**
      * Auto generated setter method
      * @param param BoData
      */

      public void setBoData(java.lang.Object[] param){

      validateBoData(param);



      this.localBoData=param;
      }



      /**
      * Auto generated add method for the array for convenience
      * @param param java.lang.Object
      */
      @XmlElement
      public void addBoData(java.lang.Object param){
           
      if (localBoData == null){
      localBoData = new java.lang.Object[]{};
      }


      //update the setting tracker
      localBoDataTracker = true;


      java.util.List list =
      ConverterUtil.toList(localBoData);
      list.add(param);
      this.localBoData =
      (java.lang.Object[])list.toArray(
      new java.lang.Object[list.size()]);

      }

      }
      =========================================