SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings
Help

Compass Support Forums » Compass » Compass Users

Thread: Polymorphic component collection mapping

This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 15 - Pages: 2 [ 1 2 | Next ] - Last Post: Jan 1, 2012 7:30 PM Last Post By: miyao lin
Aleksei Valikov

Posts: 46
Registered: 3/6/06
Polymorphic component collection mapping
Posted: Aug 15, 2006 7:11 AM
 
  Click to reply to this thread Reply
How do I map a polymorphic/heterogeneous collection as component?

I have to main classes: Record and Entity. Record has a set of entities. There are many subclasses of Entity, therefor Record.getEntities() is a heterogeneous collection. There is a common supertype for all the elements (the Entity class), but concrete elements of the collection are of different classes.

I would like to index Record so that all the Entities are indexed as "components". That is, when record's entity matches the condition, the record is returned. Entities do not need to be mapped as "root" classes at all, they are always a part of the Record.

I have tried mapping this scenario with <component name="entities" ref-alias="Entity"/> but didn't work. I have expected that compass will consider the class of the concrete entity instance and save it with all its properties, but the only property that was saved was the uuid of the Entity (this is the only property that exists in the Entity class itself). Setting things like poly and so on also resulted in nothing.

I have checked the Compass code and could not figure out how could I make Compass resolve the entity mapping in the runtime. But gladly I've managed to find out that I could use a converter to achieve what I want.

So I did something like:

public class AnyComponentMappingConverter extends ComponentMappingConverter {

public boolean marshall(Resource resource, Object root, Mapping mapping,
MarshallingContext context) throws ConversionException {
// no need to marshall if it is null
if (root == null) {
return false;
}
HasRefAliasMapping hasRefAliasMapping = (HasRefAliasMapping) mapping;
ClassMapping classMapping = extractClassMapping(context, root.getClass(),
resource, hasRefAliasMapping);
Object current = context
.getAttribute(MarshallingEnvironment.ATTRIBUTE_CURRENT);
context.setAttribute(MarshallingEnvironment.ATTRIBUTE_PARENT, current);
return doMarshall(resource, root, hasRefAliasMapping, classMapping,
context);
}

private ClassMapping extractClassMapping(MarshallingContext context,
Class clazz, Resource resource,
HasRefAliasMapping hasRefAliasMapping) throws ConversionException {
ClassMapping origClassMapping = context.getCompassMapping()
.getClassMappingByClass(clazz);
if (origClassMapping == null) {
throw new ConversionException(
"No class mapping found when marshalling root alias ["
+ resource.getAlias() + "] and class [" + clazz
+ "]");
}
return origClassMapping;
}
}

This thing simply resolves the class mapping for the object.

Again, the question is - is this approach valid? Or did I missed something?
How could I map a heterogeneous collection without specifying all the concrete classes it may contain?
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: Polymorphic component collection mapping
Posted: Aug 15, 2006 3:45 PM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
Hey,

This has been discussed here: http://forums.opensymphony.com/thread.jspa?threadID=38333&tstart=30, and I have already implemented this feature in 1.1 M1. You will need to have a comma separated list of all the alias mappings that extend entity in your ref-alias.
Aleksei Valikov

Posts: 46
Registered: 3/6/06
Re: Polymorphic component collection mapping
Posted: Aug 16, 2006 1:47 AM   in response to: Shay Banon in response to: Shay Banon
 
  Click to reply to this thread Reply
Oh, haven't seen this.

My problem is that I can't specify the full list of alias mappings.
First of all, it's too large.
Second, mapping for the Record is defined in the core librar (or core project). There are many sub-projects which have different possible Entity classes...
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: Polymorphic component collection mapping
Posted: Aug 18, 2006 3:46 AM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
Agreed. This is what we have left in terms of this feature. Have the ability to automatically identify other mapping that extend a given mapping. Something like: ref-alias="base, [all-extends]", where [all-extends] would be a magic keyword that would expand to all the other mappings in Compass that extend base.
louisvuittonbox

Posts: 411
Registered: 8/23/11
Re: Polymorphic component collection mapping
Posted: Aug 23, 2011 10:23 PM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
miu miu bags. It's no secret that miu miu handbags are among the most popular in the world. That's because their longstanding reputation of quality and craftsmanship coupled with their amazing ability to foresee what will happen next in fashion makes their miu miu shoes among the absolute best and most unique in the world. Our miu miu 2011 offer all the same classic attributes . you'll be turning heads with one of these on your arm , and at only a fraction of the price! (Miu Miu Handbags)Please feel free to browse our Miu Miu replica handbags in our miu miu outlet, and contact us with any questions that you may have.
fangcao

Posts: 92
Registered: 8/14/11
Re: Polymorphic component collection mapping
Posted: Sep 26, 2011 10:05 PM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
Oh, come on! Runescape Gold is so cheap. Well, The price of Runescape equipment is quite low on this website and they always give discounts in this part. so you can get cheap rs characterand rs accountson this website. This website also provides cheap runescape gold. You can have a try.
factoryoutlet

Posts: 523
Registered: 10/5/11
Re: Polymorphic component collection mapping
Posted: Oct 5, 2011 8:38 PM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply

louis vuitton outlet leads you to bags collection of wide, such as LV bags and LV handbag etc. They are main name in luxury and style. It is excellent quality, fine Italian technology and extraordinary beauty.LV is universally renowned as a luxury brand. louis vuitton online store offers customers the newest fashion collections which can make you different.

In the past, Louis Vuitton only emphasis on classic, but in recent year, Louis Vuitton change its strategy and style to acquire new breakthrough. Especially louis vuitton bags like Louis Vuitton Vernis Wallet.Want to become more charming and faddish? Go to visit louis vuitton outlet webpage and select the most suitable products for yourself.

Want to become more charming and faddish? Go to visit louis vuitton outlet webpage and select the most suitable products for yourself.louis vuitton outlet online may often be the consideration alternative inside of your event to get these kinds of bags.Is without a doubt louis vuitton online seriously is present? Is it possible to offer an outlet designed for Louis Vuitton merchandise speaks out?

The choices are likely to be basically countless seeing that louis vuitton outlet occurs with the help of completely new and also incredible concepts once in a while.Mainly because mentioned before, you could buy in the louis vuitton online, via the producer's the web outlet. Owning worn it in past times. They can supply a appropriate evaluate for the property's simplicity as well as client service description.louis vuitton outlet online is the method to show the confidence of our handbags. The person who show himself in front of other people is a confident one.

LV bags in the louis vuitton outlet are a feminine update on an urban classic. With plenty of room for all of your essentials this covetable carryall will take you through the weekend in style.LV is universally renowned as a luxury brand. louis vuitton online store offers customers the newest fashion collections which can make you different.

This collection focus more on color selection compared with other LV handbags. Cute and sunshine design style increases its charm. louis vuitton outlet online provides you the very famous luxury worldwide brand.We are glad you come to join in our louis vuitton outlet online store, because the winter is upcoming now, Louis Vuitton released many new handbags to feedback our customers.Just come to visit once the louis vuitton online, you will fall in love with its fancy bags, purses, sunglasses, shoes and so on.

factoryoutlet

Posts: 523
Registered: 10/5/11
Re: Polymorphic component collection mapping
Posted: Oct 5, 2011 8:41 PM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply

coach factory outlet offer excellent, elegant coach products in order to generate room for your new collections.They're purchased more quickly that you may at any time imagine.coach factory store is the greatest destination to buy what type of bags you like. If you need to manage a new Coach carrier and most preferable strategy is to the coach regarding coupon codes.Here's your new way to look sophisticated styles. Carry the hot coach factory outlet store of this summer and be the true trendsetter!in the market you definitely can find various colorways that are designed in as well as the high quality that applied in. For most of you would like to come. So just come to our coach factory outlet online store to choose one.

coach factory outlet is really sizzling kinds of shopping way for you. With the usage of the replica designer coach bags, you can surely be able to change your individual looks in a stunning manner.You know, Coach items are so perfect and fascinating. Now I grow up, and find coach outlet on the Internet offering affordable products with reliable quality.Many fashionable women match with practical Coach Purses which will make the street shopping become relaxed,and make every person can enjoy more diversiform combination in coach factory outlet online.The coach factory outlet store are utilized for formal event in company area that will display your excellent taste.Not only does a briefcase make is easier to carry things.

Almost everyone has identified effectively about this, below, among the best to make sure you will get much more information about coach outlet.In the coach outlet online shop, a collection of high quality and hottest Coach Shoulder Bags is offered to you. They are all at the best prices you will ever find.

You know, Coach items are so perfect and fascinating. Now I grow up, and find coach outlet on the Internet offering affordable products with reliable quality.Once visit, you will be unable to restrain loving it. Warmly welcome all of you to the Summer Sales Promotion on coach factory outlet.coach factory outlet has new coach laptop bags in listing. No matter which style do you want, we can provide it for you.Coach bags enjoy high popularity throughout the world. I would like to share the coach factory outlet online with you. What are you waiting for? Just come to visit.

coach factory outlet supplies the newest and most fashionable brand Coach on sale.The more Coach shoulder bags you order, the more discount you will get.It's wonderful to find out it does not slip in your signature at the bottom of the case and the appearance of brass accents from coach outlet online, Because women who can look stylish this summer.coach outlet has a zippered closure and buckles for extra security. Shiny brass hardware, rounded leather handle, and an interior pocket. It also includes a limited edition Hawaii luggage tag and lock.You can find all kinds of coach bags whatever you chose which one in coach factory outlet online will never be out of fashion. Not only they have many nice and design styles, but also made from the finest leather and fabric.

With the great diversity of styles, patterns and sizes available nowadays, finding the right pieces to highlight your personality is quite important. coach outlet offers exactly what you want.coach factory outlet supplies the newest and most fashionable brand Coach on sale.The more Coach shoulder bags you order, the more discount you will get.Look at this golden Coach bag in the? coach factory outlet online.Those new bags with classic and fashionable design are more and more popular now!After graduating from university, my cousin came back to my hometown from USA last month. She told me that coach outlet store is very popular among her classmate.

coach outlet online own a couple of line, color, or the selected theme, it should be a good choice. It may be the place where offer the bag ladies handbag, you will be able to follow a course of education or training receives for the slim project chest strap wallet.coach outlet will send you a coupon in the post to use in their upon only after you type a achieve. The Coach bags are customarily somewhat many than the ones in the stores.In particular, products from coach factory outlet with leather design are fashionable, handmade,leading the wave of American pop.It with simple,durable and unique style to win consumers.coach factory not only supply with the highest quality crystal at reasonable price but also provide good after-sales service. Companies operating purposes: science and technology in order to survive, credibility and development, strict quality control.

coach outlet handbags's special design and fashion is certainly and so eye-catching, I hope you are able to get much more attention towards the Cheap Coach Crossbody.As long as you open our coach factory outlet webpage, you will view various Coach New Arrivals which are the most popular also the most fashionable in this year.Are you anxious to choose some of the brand bags? Are you searching for reliable sellers? When you come to the coach factory outlet online, these are not problems.

At the coach outlet online you have the largest selection of the day. If you touch the item and like it, keep it in your possession until you make your final decision.Over the years, coach factory online has added a multitude of new handbag shapes, styles and materials to their collection. However, the highest care is taken that every Coach handbags is both aesthetically beautiful and functional.Are you searching for a cool and stylish coach bag? The coach factory outlet online Online is your first priority.

eemm

Posts: 68
Registered: 10/31/11
Re: Many LJT files in temp directory
Posted: Oct 31, 2011 9:15 PM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
Coach Outlet Online offer different kinds of coach handbags outlet. Another very important item details from Louis Vuitton Outlet Online, I bet you won't have identified feasible fact of coach outlet online are possibly one of the most option and look for to pursue handbags. Coach Factory Online Store updates quicker with very good good quality with entire Coach Outlet Online at exact value but you can only purchase nike dunk or gucci canvas bag so Coach outlet online store progressively preferred in current years, nearly started to be a ordinary Cheap Coach Purses. Choose Coach Factory Outlet Store, it will allow you on this summer time awesome self-confidence. Seemingly North Face Outlet little visual appeal however the fundamental merchandise could be total accommodate. American stylish pioneer manufacturer new Coach Purses Outlet presented the girl stylist in spring 2010. Louis Vuitton Bags Outlet little shoulder bag are also stylish and grave Coach Outlet. We perform with each other with stylish component to overturn everything. Buying cheap coach purses from Coach Outlet Online substance is completely gauzy and most palpable of which top cheap gucci handbags designer to go with. Welcome order on our Coach Factory Outlet! You can always find a luxury Coach Shoulder Bags that can catch your heart, you will have the surprise when you place the order! Go head!
hogan280

Posts: 180
Registered: 12/3/11
Hogan
Posted: Dec 3, 2011 1:16 AM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
riscaldatore seduto accanto any credited grandi uomini, mother quando low haya visto l . a . stessa cosa, mother low c'è da meravigliarsi, my partner and i credited grandi uomini, una penna any mano, una pila di documenti prima di loro, not possesso di not giornale, anche schierati sul tavolinodi fronte any una mappa, my partner and i bambini low è venuto inside pace every trovare l . a . initial. Queshi Bi Yuan Ning ancora 's cello superiore photographic camera da letto giù more quickly. hogan 5 laggiù insieme any Ning Yuan Ruhuasiyu appear una donna giovane, il suo volto sembra prendere sempre not sorriso malizioso, low è l . a . madre si è donne elizabeth L . a . signorina Li Ying Dong Lida chi altro
longchamp

Posts: 272
Registered: 12/1/11
Longchamp
Posted: Dec 3, 2011 3:30 AM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
longchamp publié durante ligne au printemps 2012 sacs à major, comme l'ensemble des grandes marques, comme, Longchamp a new également tombé durante amour avec chicago couleur des bonbons. Fill chicago plupart des gens qui sac longchamp aiment longchamp, longchamp qui est confortable, sac à major durante cuir traditionnel. Chacun est élégant et discret, mais qui n'aime pas l'ensemble des surprises aussi!www.sacslongchamp-france.org
longchamp

Posts: 272
Registered: 12/1/11
Longchamp
Posted: Dec 3, 2011 3:32 AM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
longchamp nom de l . a . propagation dans toute l'Europe comme not symbole de l . a . additionally belle des produits de trip. Jusqu'à aujourd'hui, additionally tard, indépendamment de l'extension de cuir,sac longchamp de soie, ou les montres, les stylos et même des vêtements, sont basées sur le défenseur Longchamp siècle passé raffiné, de qualité et confortable "philosophie du voyage», en commençant comme foundation de pregnancy.www.sacslongchamp-france.org
woolrich

Posts: 142
Registered: 12/3/11
Re: Polymorphic component collection mapping
Posted: Dec 3, 2011 3:47 AM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
L'acquisto di not giubbotto Woolrich inside est è una scelta saggia, si potrebbe incontrare alcuni affari veramente buono elizabeth cominciare any costruire su quella collezione di giubbotti woolrich. Questo è il marchio di quella che sarà l . a . prova del pace male impotence è quindi sempre una buona thought di acquistarne uno, anche inside est. L'acquisto di una giacca di questa marca può essere facile, low hanno nemmeno bisogno di caccia di prezzi stracciati every il pezzo autentico di abbigliamento da not negozio all'altro a on the web.
redneck2011

Posts: 4
Registered: 11/25/11
Re: Polymorphic component collection mapping
Posted: Dec 5, 2011 2:25 AM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
anitas

Posts: 95
Registered: 11/20/11
Re: Polymorphic component collection mapping
Posted: Jan 1, 2012 7:03 PM   in response to: Aleksei Valikov in response to: Aleksei Valikov
 
  Click to reply to this thread Reply
I love this article, it's very well.oakley sunglasses saleFake Oakley Flak Jacket Sunglassesreplica Oakley Polarized SunglassesOakley Batwolf sunglasses outletoakley sunglasses wholesaleReplica Oakley Flak Jacket SunglassesOakley Restless SunglassesOakley Dispatch sunglassesreplica oakley sunglassesReplica Oakley Fuel Cell Sunglassesoakley scalpel sunglassesOakley Flak Jacket sunglassesreplica Oakley Commit SQ SunglassesFake Oakley GascanOakley Split Jacket SunglassesOakley Frogskins sunglasses outletoakley fives squared sunglassesFake Oakley Polarized Sunglassesoakley straight jacket sunglassesOakley Gascan sunglassesOakley Half Jacket SunglassesReplica Oakley Polarized SunglassesOakley Ten SunglassesFake Oakley Hijinx sunglassesreplica Oakley Half Wire SunglassesFake Oakley RadarOakley Zero SunglassesOakley Jawbone sunglassesreplica Oakley Half X SunglassesReplica Oakley sunglassesOakley Juliet sunglassesOakley Hijinx SunglassesCheap oakleys Commit SQ SunglassesOakley Jupiter sunglassesOakley Holbrook SunglassesReplica Oakley Fives SquaredOakley M Frame sunglasses outletoakley jawbone sunglassesReplica Oakley Flak JacketOakley Minute sunglassesoakley juliet sunglassesReplica Oakley FrogskinsOakley Monster Dog sunglassesreplica Oakley Jupiter SunglassesReplica Oakley Fuel CellOakley Oil Rig sunglassesOakley Jury SunglassesReplica Oakley GascanOakley Pit Boss sunglassesoakley m frame sunglassesCheap oakleys Half Wire SunglassesOakley Polarized sunglasses outletoakley minute sunglassesCheap oakleys Half X SunglassesOakley Radar sunglassesreplica oakley minute sunglassesCheap oakleys Hijinx SunglassesOakley Restless sunglassesoakley monster dog sunglassesCheap oakleys Jawbone SunglassesOakley Scalpel sunglassesOakley Necessity SunglassesCheap oakleys Oil Rig SunglassesOakley Straight Jacket sunglassesoakley oil rig sunglassesCheap oakleys Pit Boss SunglassesOakley Ten sunglassesOakley Pit Bull SunglassesCheap oakleys Radar SunglassesOakley Zero sunglassesOakley Plaintiff SunglassesCheap oakleys Straight Jacket Sunglasses
Legend
Guru: 2001 + pts
Expert: 501 - 2000 pts
Super-star: 101 - 500 pts
Assistant: 51 - 100 pts
Participant: 0 - 50 pts
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums