DPL and composite pattern

Hello...using DPL, JE (3.1.0), and trying to come up with a design that fits the following mold:
@Entity
public class Thing {
   @PrimaryKey
   long id;
   @SecondaryKey(relate=MANY_TO_ONE)
   int thingTypeId;
   // how to link this to thing attribute model below?
   List<ThingAttribute> thingAtts = new ArrayList<ThingAttribute>( );
}Thus, a Thing can have a list of attributes. A thing has a unique id (primary key), and a thing has a thing-type id...and there can be many instances of that thing-type, so it is MANY_TO_ONE.
Now, a ThingAttribute follows the Composite Pattern...as below. I took a stab at annotations here, but I'm not sure it seems correct:
@Persistent
public abstract class AbstractThingAttribute {
   /* only simple attribute subclass has an id -- composite subclass does not
    * so we add a sequence here
   @PrimaryKey(sequence="ID")
   long id;
   // thing type id
   @SecondaryKey(relate=MANY_TO_ONE)
   int thingAttributeType;
@Entity
public class SimpleThingAttribute<T> extends AbstractThingAttribute {
  // unique id
  @SecondaryKey(relate=ONE_TO_ONE)
  long id;
  // generic type value
  T value;
@Entity
public class CompositeThingAttribute extends AbstractThingAttribute {
  // this is a recursive-definition relationship; not sure how to deal with DPL?
  // list of children
  List<ThingAttribute> children = new ArrayList<ThingAttribute>( );
}As an aside, there is an interface for ThingAttribute, SimpleThingAttribute, and CompositeThingAttribute...this is not too relevant for this example, but Simple/Composite interfaces extend the ThingAttribute interface.
Q1) If I create a new Thing object, and I want to persist it, it is clear to me how it works for the primary secondary key here, but how do I annotate the ThingAttribute hierarchy such that it gets persisted along with the Thing object? I guess this boils down to a couple things:
a) how to treat the thingAtts ArrayList in a Thing object itself so it gets persisted?
b) now, i have a list of objects, where each entry in the list follows the structure of the composite pattern. how should i approach annotating this model?
Thanks in advance,
Davis

Hi Davis!
Q1) If I create a new Thing object, and I want to
persist it, it is clear to me how it works for the
primary secondary key here, but how do I annotate the
ThingAttribute hierarchy such that it gets persisted
along with the Thing object? I guess this boils down
to a couple things:
a) how to treat the thingAtts ArrayList
in a Thing object itself so it gets persisted?You just embed the thingAttrs object (as you have) in the entity. As long as the class is @Persistent (or a simple type) you can persist arbitrarily complex graphs of objects. The thin to remember is that it is stored as one object graph per entity, indexed by primary key and optionally by one or more secondary keys.
b) now, i have a list of objects, where each entry
in the list follows the structure of the composite
pattern. how should i approach annotating this
model? Don't annotate the embedded objects with @Entity, just with @Persistent. @Entity is only used when you want a separate PrimaryIndex. Objects embedded inside an entity are annotated with @Persistent only.
So when you have multiple objects you can use either embedding or relationships. With embedding, the object graph for the entire entity is stored in a single record.
With relationships, you store the keys of one entity as a field in the other entity, and you annotate that field with @SecondaryIndex(relate=..., relatedEntity=...). With relationships, you have to get the related object yourself via its own PrimaryIndex.
Hope this helps,
Mark

Similar Messages

  • Composite patterns in bash for copying

    I've used several hours today to try to make a shell (bash) script in order to take backup of some (quite some) directories. The problem (challenge) is that i want to leave some files (the big result files) out.
    My directory structure:
    Dir/
    SubDir1/
       smallfile1
       smallfile2
       bigfile
    SubDir2
       smallfile1
       smallfile2
       bigfile
    By switching on extglob in bash (shopt -s extglob) it is possible to use socalled composite patterns for wildcards (ref. http://www.linux-mag.com/content/view/1528/43/), and i thought this would help.
    Problem 1: I try to type in the following command, standing above Dir/, cp -R Dir/*/!(bigfile) new_location. This does not reproduce the directory structure (which i need) and files from Dir2 overwrites files from Dir1.
    Problem 2: Since i didn't know how to solve problem 1, i tried to make a small bash script so that i can be in Dir/ and just write 'mycopy 1' so that 'cp SubDir1/!(bigfile) new_location/SubDir1' is run. Now i get an error message which says that "(" is unexpected.
    Now i'm 100% stuck and i really don't want to do it manually...

    You need to Control click (or right click)in the selected area below so that you will be able to see the Copy/paste menu:
    !http://i37.tinypic.com/ehixl.png!
    A

  • How can I make the paths visible in a composite pattern created via the Swatch Palette?

    I created a swatch, used it to make a large composite pattern.  I can't find the paths.  They are needed so that
    a laser cutter can follow them for production.  What am I missing?

    Try selecting everything with the pattern and use Expand (or Expand Appearance, which ever is available) from the object menu. You might need to cleanup quite a lot depending on how you constructed the paths in the original pattern tile.

  • Does DVI to Video adapter send both s-video and composite simoutanesly?

    Hi,
    I´m wondering if you connect the DVI to Video adapter on the new MacMini (DVI to s-video+composite), does the Mini send BOTH s-video and composite at the same time?
    If connected to TV and projector, I want to see both simotanesly, not neede to change something in the setup...
    The both having same resolution I guess is a must!
    Regards,
    Pat

    Yes, many think, but i´ve havnt heard anyone whoose sure?! Can´t be such a odd thing, connect a Mini to two displays at same same time...

  • How can I do live streaming with a Mac Book Pro 2011, using a new model of Sony HD camcorder which does not have firewire out/input? it comes only with a component video output, USB, HDMI and composite RCA output?

    I need to do live streaming with a Mac Book Pro 2011, using a new model of Sony HD camcorder (http://store.sony.co...ber=HDRAX2000/H) ..this camcorder model does not have firewire out/input ..it comes only with a component video output, USB, HDMI and composite A/V video output..
    I wonder how can I plug this camcorder to the firewire port of my laptop? Browsing on internet I found that Grass Valley Company produces this converter http://www.amazon.co...=A17MC6HOH9AVE6 ..but I am not sure -not even after checking the amazon reviews- if this device will send the video signal through firewire to my laptop, in order to live streaming properly? ..anyone in this forum could help me please?
    Thanx

    I can't broadcast with the built in iSight webcam... how would I zoom in or zoom out? or how would I pan? I've seem people doing it walking with their laptops but that's not an option for me... there's nothing wrong with my USB ports but that's neither an option to stream video because as far as I know through USB you can't connect video in apple operating systems ..you can for sure plug any video cam or photo camera through usb but as a drive to transfer data not as a live video camera...  is by firewire an old interface developed by apple that you can connect all sorts of cameras to apple computers... unfortunately my new sony HDR-AX2000 camcorder doesn't have firewire output...
    thanx

  • S-Video and Composite Adapter Output Flickers, is B&W, etc.

    Okay, here are the details:
    - Bought a new *Mac Pro (2009)* Quad 2.66
    - Customized with an *ATI Radeon HD 4870* card
    - Current OS version: 10.5.7
    - Attempting to use *Apple's DVI-Video adapter* (works fine with my G5)
    - Poor, flickering, black & white, duplicate, partial signal appears on TV using either composite (RCA - yellow) or S-Video
    - There is *no literature anywhere* that states whether this adapter is supported (or not)
    - ATI cards have traditionally (before the 4870, not sure about the previous Mac Pro model's ATI cards) been able to correctly output analog video signals using this adapter
    - Apple's phone support personnel say *it should work*
    - Tried a *newer adapter at a service provider with no difference* in the results
    Any help, advice, etc. is appreciated.
    PS - If I can't find a solution that doesn't involve buying anything extra, I'm considering getting the DVI-VGA adapter with a VGA converter box (VGA in, S-Video and Composite out) which seems to be the only viable alternative (as getting a new card won't help when/if I get a Mac Mini for movie watching).

    Hi Com,
    I don't have an answer for you but maybe in the comments about it someone has said something helpful: http://store.apple.com/us/product/M9267G/A
    I think that Apple would like to say all it's adapters work fine but I don't think that's really the case. The VGA to Mini Display adapter I just bought was only able to coax a very limited amount of resolutions from my CRT. Other people are finding other adapters not being up to snuff and buying this one as a cure. http://store.apple.com/us/product/MB571Z/A?fnode=MTY1NDA3Ng&mco=MjE0ODQ2Nw
    But even this has it's problems.
    I hope someone else writes in to help. I hope there's a work around for you. It's just hard to know what is Apples responsibility to do and yours. Yours I don't believe should be an issue if the adapter worked right.

  • Does the video adapter output both S-Video and Composite simultaneously?

    I have a multi-zone receiver which converts S-Video to component for the main zone and passes S-Video signals through to zone 2 but does not convert them to composite which is how that zone is set up. I solved a similar problem with my DVD player by connecting both the component output and composite output of the DVD player to the receiver allowing high quality viewing in the lounge room and passable viewing in the bedroom.
    I realise the quality from the adapter is questionable particularly for composite but I'm still interested if both S-Video and composite signals are output from the MBP 17" via the adapter simultanesouly.
    Thanks,
    Max.

    I have a follow-up question which may help answer the original question. Does the MBP have to detect the external display when connected via S-Video/Composite in the same way that it has to when connected via DVI? My Dell notebook had so much trouble detecting composite and S-Video connections that eventually I gave up so I'm a little "once bitten twice shy" on this. If the MBP doesn't attempt to detect the external display via S-Video or composite then it must output both S-Video and Composite signals continuously (which would be great).
    Thanks,
    Max.

  • How to get plain old S-video and Composite out from a MBP?

    Hi,
    this question is about someone's MacBook Pro he newly bought with adapters to get both DVI and Svideo/Composite Out.
    He got Mini DisplayPort to DVI-D converter, and a DVI-I to video converter, that cannot be plugged into a DVI-D port. Apple removed the analog capability of its adapter, that's bad. But what's badder is there doesn't seem to have any Mini DisplayPort to Svideo/Composite adapter, as there was with previous generation machines.
    How can someone easily output analog video from MBP?

    In fact, I recognize that these standards are old, which doesn't mean they're not up-to-date. Similar example, VGA connector is old, but perfectly useful, even in 2009. I recently plugged a 22" LCD with VGA and DVI on the same computer (a bland desktop PC), and there was strictly no difference. Same color depth, same crisp display. Even looking at a corner with a magnifier, nothing was different.
    So, changing standards just for the sake of it doesn't make any sense.
    Agreed that, as a pro, Apple would like me to buy their pro line, but nowhere in the pro line does an easy solution exists for S-Video and composite out. The solution you posted exists, but is unwieldly and not neat at all, if it doesn't break the Mac's connector under its weight. If a manufacturer can do this kind of adapter, Apple can do it better, and make a bigger profit out of it.
    For the adapter you posted, I don't ever buy anything that is not at least Mac+Windows compatible, or at a minimum is open-source, so anyone with programming skills can make something. The manufacturer also doesn't give a clue on how this works. I guess some sort of virtual driver sits in the system as a virtual IEEE1394 port so any program requiring FW can work transparently. Still, incompatible with the OS that most manufacturer ship their new PCs with, poor commercial decision, wether you like the OS or not.
    Adding FW in the MB unibody design wouldn't have cost anout $30. Rather, we're talking about a 25 cents chip, a 25 cents connector, which they would have rounded up to $20 and still, that was present in previous-gen MB. After all, they are indeed selling a matte screen on the MBP 17" for $50 more, despite them removing a single piece of glass which may cost, well, let's be fair, $5 to manufacture? That's dishonest. And capitalistically justified.
    So far, choosing a Mac for one's needs is no easy task: older white MacBooks have the same power as unibodies, excellent connectivity, top notch transfer speeds, BUT are heavier, as not as ecologically friendly nor do they have future-proof RAM standard. The unibodies are sleekier, easily recycled and will be able to be upgraded in the near future BUT is most likely unable to use current devices and have slower transfer speeds.
    For Pro models, the newer ones have great efficiency, much power and flexibility with their dual GPU BUT lost the option of matte screen, although their other pro-oriented monitors still default to matte. Only the 17" has the option. If a pro already finds his 15,4" bulky and with ample reserve power, will he buy the bigger and heavier 17"? Probably not.
    I understand that Apple way of doing business is keeping only what's essential with no unnecessary options (I'm looking at you, Asus, with you at least 10 different versions of you netbook). But this time, not everyone can find what he or she wants in Apple's line of laptops, as opposed to the iPod thing, where virtually any possible preference is covered.

  • No S-Video and composite video cable adapters from Apple?

    Hello.
    Is it me or does Apple's http://store.apple.com/us/browse/home/shop_mac/mac_accessories/cables/cable_choo ser not carry any video cable adapters that go to S-Video and composite inputs (an old Panasonic projector TV from Y2K) from MacBook Pros (2008 and 2012 models)? This is just for watching fullscreen videos.
    Thank you in advance.

    Courcoul wrote:
    Might want to canvass Mom & Pop computer stores in the area, that usually don't have such a furious inventory turnover rate as the big chains, and maybe you'll find what you need. Or look in eBay, Amazon, etc. Note that you don't NEED an Apple-labeled adapter, just one that will plug in whatever ports you have left and gives the required output.
    OK and thanks. I tried to find on big retailer stores online like Best Buy, Fry's Electronics, Office Max, Radio Shack, etc. but had no luck. Or maybe I am not searching correctly (DVI S-Video and DVI composite keywords as two examples)? I did find Apple's on Amazon.com based on the model number from someone on comp.sys.mac.system newsgroup: http://www.amazon.com/APPLE-M9267G-DVI-Video-Adapter/dp/B0000ACOBL/ ...

  • TV isn't detected properly with Mini-DVI and composite video

    Hi,
    Just got a mini-dvi adaptor from Apple, and having trouble getting it working on a CRT TV (have had other windows laptops running s-video out ok on there before via scart and composite)....
    I plug it all in, turn on the TV, turn on the macbook, choose 'Detect Displays', and get the secondary display detected as 'Display' rather than TV --> don't get any tv options on the display prefs for that display...
    any ideas?
    S-Video just gets a blank screen, at least composite video shows a flickering black and white screen (with 5-6 repeated screens squished up).
    dodgy mini-dvi cable?? dodgy macbook?? dodgy TV?
    thanks
    Rach
    MacBook ultimate   Mac OS X (10.4.8)  

    Yup - using the same input channel as the playstation/digital tv usually comes in (we only have one 'video in' channel on the tv). Have tried through the scart port (that's how the playstation usually goes in), and the composite port too.
    TV is PAL format here i think --- however everywhere I've read, everyone else gets a 'TV' display preference option when it detects it's a TV, and can set the format to PAL/NTSC there. I don't get this as it just thinks it's a display rather than a TV.
    Darn, back to the Oxford Circus Apple store for me to see if it's the mini-dvi cable, the macbook or our tv... fighting with all the tourists

  • Nouveau and Compositing?

    Hi there,
    as of now, rather fresh install and all, I use the nv driver and let xorg/HAL/dbus do all the work, i.e I have no xorg.conf.
    I get a nicely working KDE4 environment, no hassle.
    I initially tried to use nouveau but that unfortunately does not auto-work, somehow it set's things too "high" for my poor old monitor and I just get a black screen and a "out of range" warning.
    So these are kinda two questions: How can I make nouveau work without having an xorg.conf?
    Can I get compositing with nouveau?
    And sort of as an afterthought: Can I get compositing at all without an xorg.conf?
    Thanks in advance.

    Alright... I gave in an created an xorg.conf.
    Section "Module"
    Load "glx"
    Load "extmod"
    Load "record"
    Load "dbe"
    Load "dri"
    Load "dri2"
    EndSection
    Section "Monitor"
    Identifier "Monitor0"
    VendorName "Monitor Vendor"
    ModelName "Monitor Model"
    HorizSync 28-64
    VertRefresh 60
    EndSection
    Section "Device"
    ### Available Driver options are:-
    ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
    ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
    ### [arg]: arg optional
    #Option "SWcursor" # [<bool>]
    #Option "HWcursor" # [<bool>]
    #Option "NoAccel" # [<bool>]
    #Option "ShadowFB" # [<bool>]
    #Option "VideoKey" # <i>
    Identifier "Card0"
    Driver "nouveau"
    VendorName "nVidia Corporation"
    BoardName "G73 [GeForce 7600 GT]"
    BusID "PCI:4:0:0"
    EndSection
    Section "Screen"
    Identifier "Screen0"
    Device "Card0"
    Monitor "Monitor0"
    DefaultDepth 24
    SubSection "Display"
    Viewport 0 0
    Depth 1
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 4
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 8
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 15
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 16
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 24
    Modes "1024x768" "800x600"
    EndSubSection
    EndSection
    I have a working KDE environment and I use nouveau as the Xorg.0.log confirmes.
    Now, I read up on Nouveau and composite some and it would appear that the two do not go well together. I suspect all that fancy-smancy effect stuff KDE (or rather kwin?) can pull off is considered 3D and therefore off-limits for nouveau?

  • Slideshow Widget and Composition Widget Synchronizing Problem

    I have a slideshow with images and composition widget of text that corresponds with each slide. The settings are the same for both, works fine on desktop yet on the tablet and iphone versions, they are messed up.
    Here's the BC site: dezinegirl
    I have been waiting for Customer Care via Chat to figure it out looking at my files, but it's been an HOUR and I don't think he knows.
    Anyone else have this issue?
    BTW: I am working with a purchased template.
    Thanks!

    Hi Pam,
    Instead of using the slideshow widget in sync with the composition widget, I will suggest that you switch to using one composition widget. Slideshow widgets does not allow text frame but composition widgets allows images as well as text frames. So you can allocate individual text frames to each target and that should give you the effect that you are looking for with no sync issues.
    Let me know if you need more clarifications on this.
    - Abhishek Maurya

  • Query on Enhancement Spots and Composite Enhancement spots

    Hi Group,
    I want to know about "Enhancement Spots and Composite Enhancement spots" and how to implement them in the system?
    please provide me the uses and how to implement them for our requirements?
    Thanks,
    Vishnu.

    Hai.
    check the links.
    http://help.sap.com/saphelp_nw70/helpdata/en/91/f1e540f8648431e10000000a1550b0/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/1c/2cee3957f7cd55e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/1c/2cee3957f7cd55e10000000a114084/content.htm
    http://www.sap.info/public/INT/int/index/Category-28943c61b1e60d84b-int/0/articlesVersions-22681475d1a792eff3
    regards.
    sowjanya.b

  • Life cycle and desing patterns

    Hi Friends,
    I am new to SAP BI/BW and learned extract and Reports
    Now i am getting some doubts like what sdlc and design patterns are used to SAP BI/BW
    Please could you suggest , whether we are have to use in BI/BW
    thanks
    Babu

    Hi Babu,
    SAP BI/BW project also has got the standard project life cycle steps. Whenever you are working on a SAP BI/BW implementation project it starts from
    Requirement Gathering -
    > Blueprinting -
    > High level and detailed design -
    > Implementation -
    > Unit Testing -
    > Integration Testing -
    > Go live.
    Regards,
    Durgesh.

  • (NWDS) trial version for EP 7.0 and Composition Enviroment  7.1

    Hi Experts,
    I am looking for the netweaver developor studio (NWDS) trial version for EP 7.0 and Composition Enviroment  7.1. Can anyone send me the link to download it.
    Thanks in advance.
    SG

    Hi,
    Check this document for the location and installation steps:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/50289b6a-5373-2910-91bd-b8196737c026
    you can directly download it from:
    https://websmp103.sap-ag.de/swdc --> Search For all categories --> Search for NW Developer Studio
    i don't think you get a trial version for NWDS.....maybe i am wrong here.
    regards,
    Abhishek.
    Edited by: abhishek salvi on Apr 27, 2009 1:26 PM

Maybe you are looking for

  • How can I change everything from my old account to my new one?

    I have had a shared account with my family for about 5 years, but now I am planning to make a new account just for myself. How can I move all my music, apps, books, movies, etc to my new account? Will I lose any items? How do I authorize my iphone to

  • BAPI_ACC_INVOICE_RECEIPT_POST creates document but doesnt apear in fb60

    I am working on putting together a program that will allow users to upload invoices from a spreadsheet into SAP using BAPI_ACC_INVOICE_RECEIPT_POST. The program seems to be working fine, the return table sends a message telling me the document XXXX h

  • Using dbms_xmlsave.insertXML

    Hi all, I am reading an XML data which has similar structure to: <dept> <name> department name </name> <loc> department location </loc> <emp> <fisrt> first name for first employee </first> <last> last name for first employee </last> </emp> <emp> <fir

  • Turning off the structure errors in JDeveloper 10.1.3.2

    Is there a way to turn off the structure errors in for .jsp pages in JDeveloper 10.1.3.2. Many of the pages show "Element blah not expected" or "attribute missing" The app I'm working on has lots of old code from a range of developers and I really do

  • Trouble with Iphone syncing

    My Iphone has trouble syncing. Its a hand-me down phone from another friend. I cannot sync my Iphone to another computer and when I try to sync with wifi, it says it is not able to sync and sync would resume when my "friends-pc" is available. The dev