ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Use Java to move the tree to a collection

Post new topic  Reply to topic
 Use Java to move the tree to a collection « View previous topic :: View next topic » 
Author Message
siva1431202
PostPosted: Mon May 09, 2011 6:35 am    Post subject: Use Java to move the tree to a collection Reply with quote

Novice

Joined: 04 May 2011
Posts: 20

Use Java to move the tree to a collection, sort and move the result back to a tree.Do any one have an idea regarding this?

This i am trying in java compute node..so that it will be easier to sort and to remove duplicate.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 09, 2011 6:44 am    Post subject: Re: Use Java to move the tree to a collection Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

siva1431202 wrote:
This i am trying in java compute node..so that it will be easier to sort and to remove duplicate.


Following on from the discussion here presumably?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 09, 2011 6:45 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

And of course here?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 09, 2011 6:50 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

As one of my most worth associates commented in an earlier post, the collections object doesn't have methods for a message tree. I would have thought your best bet would be to walk the tree and add the elements, de-duplicate and reassemble them.

Another poster suggested something similar when the talk of a collections object came up. My Java's really insufficient to comment further but I do wonder how this would leave you if you needed to preserve the order of the elements but remove duplicates.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon May 09, 2011 7:00 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The suggestion given was to create a comparator method that understood how to access and evaluate the contents of an MbElement.

The difficulty is that you also might need something to allow the collection sort utility to walk the MbMessage tree.. and another something to allow the collection sort utility to exchange two elements in the message tree.

So the other notion is to walk the message tree and create an array that contains the relative key values and then a pointer to the relevant MbElement object, and then sort that.

Then you could detach/attach the elements in order to the new message.

Or you could do any number of other, more sensible, things.
Back to top
View user's profile Send private message
siva1431202
PostPosted: Mon May 09, 2011 9:09 pm    Post subject: Reply with quote

Novice

Joined: 04 May 2011
Posts: 20

Thanks for all the replies i received

we can evaluate the contents of the of an MB element using

(String)inMessage.evaluateXPath("string(/Employee/Emp)");

I am able to put into the collection but based on some field it has to sort...
let us assume msg have three fields - EmpID,EmpFname ,EmpLname ..

Sorting should be based on EmpFname and remove duplicates based on EmpID.

So what is the next step that i can do.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue May 10, 2011 1:17 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

siva1431202 wrote:
Thanks for all the replies i received

we can evaluate the contents of the of an MB element using

(String)inMessage.evaluateXPath("string(/Employee/Emp)");

I am able to put into the collection but based on some field it has to sort...
let us assume msg have three fields - EmpID,EmpFname ,EmpLname ..

Sorting should be based on EmpFname and remove duplicates based on EmpID.

So what is the next step that i can do.

Good luck sorting on Fname. Do you consider M., Mik, Mike, Michael, Michel to be equivalent?

Why not sort on ID + Lname + Fname and dedup based on ID?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
siva1431202
PostPosted: Tue May 10, 2011 4:47 am    Post subject: Reply with quote

Novice

Joined: 04 May 2011
Posts: 20

I will try it later. First i want to continue with one parameter.

I dont know whether which is the easies way.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Use Java to move the tree to a collection
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.