Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

need design hints for Managed class

Avatar

Avatar
Validate 1
Level 1
Steve_Pruitt
Level 1

Likes

0 likes

Total Posts

17 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Steve_Pruitt
Level 1

Likes

0 likes

Total Posts

17 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Steve_Pruitt
Level 1

03-08-2010

I need help understanding the underlying LCDS mechanisms when a complex object hierarchy is managed in LCDS.  I have a custom Assembler because I have specialized persistence requirements.  My object hierarchy is basically the following:

Document

    Chapter

        Page

            Text

Document is the [Managed] class.  When a new Document is created, it is initialized with a Chapter.  Pages and Text are created when the document is edited.  I create new instance of Document and initialize it with an instance of Chapter.  On the client, I invoke the DataService using the createItem method.  My custom Assembler is called, I do the necessary persistence operation and return.  Back on the client I receive the ItemReference containing the AS Document.  This all works ok.  I am now faced with the runtime operations when the user starts creating Chapters, Pages and entering text.

Given that I start the editing session with a single ItemReference, I don't understand how to handle the Document sub-tree.  The LCDS documentation says the purpose of the [Managed] class tag is so the entire object tree does not need to be transmitted when a property changes on a child object.  Its the responsibility of the sub class to keep the remote object in sync.  But, I don't know the best way to go about doing this.

The [Managed] annotation makes the properties of the managed class bindable.  I can add an event listener to the ItemReference to handle property changes on the Document, but what about the rest of the object tree?    Do I explicitly make the properties of the child objects bindable?  Do I make each parent object an event listener for its child object properties and propagate the event up the tree?

Any suggestions or patterns to make this a little more understandable would be greatly appreciated.

View Entire Topic

Avatar

Avatar
Validate 1
Level 1
Steve_Pruitt
Level 1

Likes

0 likes

Total Posts

17 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Steve_Pruitt
Level 1

Likes

0 likes

Total Posts

17 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Steve_Pruitt
Level 1

05-08-2010

Some progress...

I have made each object a Managed class with a destination / assembler for each one.  I configured one to many relations for Document -> Chapter, Chapter -> Page.  The create operation works as expected.  When the Document assembler is called, the Chapter and Page assemblers have done their thing.

I now working on getting Documents with a fill operation.  Its working, but I am still not clear on how to sync changes across multiple clients.  In an earlier small prototype, the way I found to sync across clients is each client does a getItem which returns an ItemReference.  When the editing client makes a change, then the client does an updateItem and the other clients get the update.  It seems beyond tedious to turn around  and call getItem for each editable item so updates change be sync'd across each client.  Presumably each client has to do the same thing to see any changes updated by the "editing" client.  There must be a better way to do this.  I would thing LCDS can do this automatically, but its not obvious to me how.