Hello Keith,

I would to like to have an sample code for the solution u mentioned i.e using a combination of special fieldhandler and the wrapper class.

The following are the sample classes as suggested by you:

The sample order class:

public class sampleorder
{
  protected java.lang.String sparte;
  public sampleorder() {  }
   /** Accessor for attribute sparte */
    public java.lang.String getSparte() {
        return sparte;
    }
    /** Mutator for attribute sparte */
    public void setSparte(java.lang.String newSparte) {
        sparte = newSparte;

    }
}

 

the wrapper class:

public class sampleorderWrapper extends sampleorder
{
   protected java.lang.String sparte;
   protected java.lang.String type;
   public sampleorderWrapper() {  }

   /** Accessor for attribute sparte */
    public java.lang.String getSparte() {
        return super.sparte;
    }
    /** Mutator for attribute sparte */
    public void setSparte(java.lang.String newSparte) {
        super.sparte = newSparte;
    }
       /** Accessor for attribute sparte */
    public java.lang.String getType() {
        return type;
    }
    /** Mutator for attribute sparte */
    public void setType(java.lang.String newType) {
        type=newType;
    }

}

 

I would like to have further inputs from you in terms of the code to be put in the fieldhandler class and the relevant changes to be made in the mapping file:

Kindly provide me with the same.

Thankyou,

Regds,

Chetan Rathi


 




 
>From: "Chetan Rathi" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Re: [castor-dev] Functionality of create-method attribute
>Date: Tue, 14 May 2002 15:53:51 +0000
>


Chat with friends online, try MSN Messenger: Click Here
--- Begin Message ---

Hello Keith,

Was working on the concept as suggested by you..

But am not getting it right..

Could you provide with a sample example showing the mapping file, calling the fieldHandler class which in turn operates on the attributes as mentioned in the wrapper class...

A working sample example would be a great help.

Thanking oyu,

Regds,

Chetan



 




Chetan Rathi
Augsburger Str.336
70327 Stuttgart
Tel no.0711-7861-3148(off.)
Handy.no.015055564671
 
>From: Keith Visco <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Re: [castor-dev] Functionality of create-method attribute
>Date: Wed, 08 May 2002 02:17:04 -0500
>
>
>Chetan,
>
>You'll need to use a combination of a Wrapper class as well as a special
>FieldHandler.
>
>The Wrapper class will be the main class used by Castor for
>unmarshalling and marshalling of the AuftragParter.
>
>The FieldHandler will "unwrap" the wrapper class during unmarshalling
>and the "wrap" the AuftragParter during marshalling.
>
>So something like:
>
>public class AuftragPartnerWrapper {
>
> ...
>
> public String getName() {
> return _name;
> }
>
> public String getType() {
> return _type;
> }
>
> public void setType(String type) {
> _type = type;
> }
> ...
>
>}
>
>Unpon unmarshalling, your special FieldHandler (FieldHandler#setValue)
>can then use the AuftragPartnerWrapper to create the proper class based
>on the type value, and set this in the Auftragposition class.
>
>During Marshalling, the FieldHandler (FieldHandler#getValue) will get
>the proper class from the Auftragposition class and wrap it inside of
>AuftragPartnerWrapper and return it to Castor for marshalling.
>
>Hope that helps,
>
>--Keith
>
>Chetan Rathi wrote:
> >
> > Hello Keith,
> >
> > Kindly respond for this forwarded query....
> >
> > Regds,
> >
> > Chetan Rathi
> > >From: "Chetan Rathi"
> > >Reply-To: [EMAIL PROTECTED]
> > >To: [EMAIL PROTECTED]
> > >Subject: [castor-dev] Functionality of create-method attribute
> > >Date: Tue, 07 May 2002 07:00:47 +0000
> > >
> >
> > ----------------------------------------------------------------------
> > MSN Photos is the easiest way to share and print your photos: Click
> > Here
> >
> > Hello Keith,
> >
> > There is the requirement of altering the XML document so generated in
> > terms of adding additional attribute for better understanding of the
> > same by the other interfaces interacting with the this XML document
> > example the COI Archival system.
> >
> > The following document shows the XML document generated using the
> > Mapping option representing the underlying java classes:
> >
> >
> >
> > HU
> >
> >
> >
> > SCHELLING
> > JOCHEN
> >
> >
> > SCHELLING
> > JOCHEN
> >
> >
> >
> > The above is to be represented as:
> >
> >
> > HU
> > > > PartnerOID="0000108G100TKKS4O3N0590">
> > SCHELLING
> > JOCHEN
> >
> > > > type="Organisation" PartnerOID="0000108G100TKKS4O3N0590">
> > SCHELLING
> >
> > JOCHEN
> >
> >
> >
> > Thus the requirement is adding an additional attribute tpye
> > which wud in turn tell the marshalling tool to instantiate
> > the object of the person or Organisation class.
> >
> > The Auftragsposition has a one to many relationship with
> > Partner which are of types Person and Orgnaisation.
> >
> > Auftag is bascially an order and Auftragposition is the
> > order postion for your information.
> >
> > So a given auftragpostion can have many partner and the same
> > is to be represented in the above mentioned form.
> >
> > I was probing into the field Handler functionality perhaps
> > using the create-method attribute...whcih wud allow me to
> > use my code to be run to generate the above mentioned
> > output, thus being called through the mapping file so
> > written.
> >
> > Hopefully , i make myself clear.
> >
> > Also send me an example showing the usage of the create-method and its
> > relevance to the above mentioned problem.
> > Can it be done using Castor??
> > Regds,
> > Chetan Rathi
> >
> > ----------------------------------------------------------------------
> > Join the world�s largest e-mail service with MSN Hotmail. Click Here
> >
> > ---------------------------------------------------------------
> >
> > Subject: [castor-dev] Example for functionality of create-method attribute
> > Date: Fri, 03 May 2002 10:44:17 +0000
> > From: "Chetan Rathi" <[EMAIL PROTECTED]>
> > Reply-To: [EMAIL PROTECTED]
> > To: [EMAIL PROTECTED]
> >
> >
> >
> > Hello Keith,
> >
> > There is the requirement of altering the XML document so generated in
> > terms of adding additional attribute for better understanding of the
> > same by the other interfaces interacting with the this XML document
> > example the COI Archival system.
> >
> > The following document shows the XML document generated using the
> > Mapping option representing the underlying java classes:
> >
> >
> >
> > HU
> >
> > SCHELLING
> > JOCHEN
> >
> >
> > SCHELLING
> > JOCHEN
> >
> >
> >
> > The above is to be represented as:
> >
> >
> > HU
> > > > PartnerOID="0000108G100TKKS4O3N0590">
> > SCHELLING
> > JOCHEN
> >
> > > > type="Organisation" PartnerOID="0000108G100TKKS4O3N0590">
> > SCHELLING
> >
> > JOCHEN
> >
> >
> >
> > Thus the requirement is adding an additional attribute tpye
> > which wud in turn tell the marshalling tool to instantiate
> > the object of the person or Organisation class.
> >
> > The Auftragsposition has a one to many relationship with
> > Partner which are of types Person and Orgnaisation.
> >
> > Auftag is bascially an order and Auftragposition is the
> > order postion for your information.
> >
> > So a given auftragpostion can have many partner and the same
> > is to be represented in the above mentioned form.
> >
> > I was probing into the field Handler functionality perhaps
> > using the create-method attribute...whcih wud allow me to
> > use my code to be run to generate the above mentioned
> > output, thus being called through the mapping file so
> > written.
> >
> > Hopefully , i make myself clear.
> >
> > Also send me an example showing the usage of the create-method and its
> > relevance to the above mentioned problem.
> > Can it be done using Castor??
> > Regds,
> > Chetan Rathi
> >
> >
> > ----------------------------------------------------------------------
> > Get your FREE download of MSN Explorer at http://explorer.msn.com.
> > ----------------------------------------------------------- If you
> > wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev


Chat with friends online, try MSN Messenger: Click Here
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev --- End Message ---

Reply via email to