|
Hi Jeremy,
In FDS, there is two ways you can use it. To manage a
single item or a collection of items. So far
in case I've used it to manage a single item and here is how I've handled
it.
Single Items
In my case I am managing a consumer record. So I have a
SaveConsumerCmd command that is used to create and save any changes to
existing consumer record. It implements the IResponder interface (result, fault)
I haven't needed conflit or any of that for now. Nothing special is needed when
instatiating the DataService, but with every call to commit(), getItem() or
createItem() I call the addResponder() method on the AsyncToken returned by
those method calls to tell it who is going to handle the results/fault for that
DataService method event. See example below:
public class MyCommand implements Command, IResponder
{
public function execute():void {
var token:AsyncToken =
ds.commit();
token.addResponder( this
);
}
public function results( event:ResultEvent ):void {
... do things here...
}
}
Collection of Items
Now for a collection of items things are bit different. You
could also use the AsyncToken returned by the fill() method, but if you want
something more dynamic, an instance of some class needs to exist for the
lifetime of the app. So what I would do is as follows
#1) Create a class ConsumerDSHandler which will implement
and handle all the result, fault, confilt and message
DS events
#2) Create on instance of the ConsumerDSHandler
class
#3) Tie the DS events to call the various methods on this
class
Sample code would look like this:
public class ConsumerModel {
private var
handler:ConsumerDSHandler;
public function someInitMethod():void
{
handler = new
ConsumerDSHandler();
consumerDS.addEventListener( ResultEvent.RESULT, handler.handleResult
);
consumerDS.addEventListener( DataServiceFaultEvent.FAULT,
handler.handleFault );
...
}
}
Now remember, I havent actually used this, but thats how I
would do it. And hopefully other people share
their thoughts as well.
Hope that helps :)
Dimitrios
Gianninas
RIA
Developer
Optimal
Payments Inc.
One last ditch attempt in the hopes that someone who has worked
with Cairngorm, or one of the Cairngorm developers might see this.
please.
jeremy
--- In [EMAIL PROTECTED]ups.com,
"laidezmon" <[EMAIL PROTECTED]..> wrote: > > Wow. Nothing?
> > I implemented IResponder on the command class, and passed that
into > the delegate, and now I can fire the result method. So for some
reason > that works, although IResponder is supposed to only work on RPC
calls, > and Data Managed services are not supposed to actually be RPC
calls, > as I understand it. So when the command fires the delegate, and
the > delegate creates the service and runs the call to the
dataServices > fill method, I get an alert when result comes back.
> > However I generated a RuntimeException on the assembler Fill
method in > java, to see if the fault catching works, and it does not. So
despite > the result working, fault does not function. > > I
did do somewhat of a fix for it to catch the exception and not > actually
break the app. I created a public function on the Model, and > on the
services.mxml file I declared a model, and when I created the >
DataService object on the services.mxml file I also set a fault event >
handler there. I pass into that the models fault handler method and I >
get the alert when I am supposed to. > > However this is a poor
way of doing this. Granted there is probably a > better way, I am sure,
but I dont really know what it is, because I > dont understand what
changes were really implemented in the cairgorm 2.1. > > Is
anyone out there using this? In the old 2.0 model did anyone > attempt to
use DataServices with Cairngorm? I read an article between > Dimitrios
Gianninas and Steven Webster one of the co-creators of > Cairngorm, and he
mentioned something about he "created a > DataServicesResponder
interface". I dont know how to do this, or see > any examples of it.
> > You can look at the article here: > > http://www.mail-archive.com/flexcoders@yahoogroups.com/msg33771.html >
> Please help! > > Jeremy > > --- In [EMAIL PROTECTED]ups.com,
"laidezmon" <laidezmon@> wrote: > > > > Thanks for the
reply. > > > > Basically I already understand how to declare
a result and a fault on > > the dataService object when I declare it on
the view .mxml file that > > is instantiating it. But using Cairngorm
2.0 or 2.1 the services are > > not actually called on the view that is
accessing the data. The view > > calls an actionscript function that
creates an event, then the event > > is fired, sent to the controller,
the controller sends the event to > > the command, a command calls a
delegate which grabs an instance of > > your services declaration,
where you actually declare the DataManaged > > service. So the problem
is, if I call the DataManaged service through > > that model, the
actual service will have no idea how to pass back to > > the command,
the fault or result event. > > > > > >
Jeremy. > > > > --- In [EMAIL PROTECTED]ups.com,
Douglas McCarroll > > <org.yahoo_primary.001@>
wrote: > > > > > > Laidezmon, > > > >
> > I'm working on the same thing but am not much (any?) further
along > than > > > you are. > > > > >
> But hope to be making progress in the coming days and weeks! > >
> > > > I'm taking the approach of getting the server-side
connection set up > > > first. I'm using Data Management
Services and Hibernate. I've > > downloaded > > > the
MySQL Sakila sample database, and used HibernateTools in > Eclipse to
> > > generate a bunch of Java files, Hibernate mapping files, and
the > > > Hibernate config file. Now I'm trying to adapt Marcel
Boucher's > > > Flex/Hibernate example to connect to one table in
it. I haven't > > > succeeded yet, but hope to do so soon. Once I
do I'd be happy to > zip up > > > the entire webApp and send
it to you. Note that the client side isn't > > > Cairngorm-based
yet - that will be my next step - to renovate the > > client >
> > to a Cairngorm architecture... > > > > >
> Douglas > > > > > > > > > >
> > > > > laidezmon wrote: > > > > >
> > > Anyone? Anyone at all? > > > > > > >
> --- In [EMAIL PROTECTED]ups.com
> > > > <mailto:flexcoders%40yahoogroups.com>,
"laidezmon" <laidezmon@ ..> > > wrote: > > > >
> > > > > > Are there any examples out there on using
Cairngorm and cairngorm > > > > > events with the MVC and
such, and using Data Manager. I heard at > > max, > > >
> > that using Cairngorm with DMS is possible, but there dont seem >
to be > > > > > any examples of its use out there. >
> > > > > > > > > The reason I ask is because I
understand with pointing grids and > > such > > > > >
at the model, as the dataprovider, how that works, and I >
understand > > > > > calling an event which calls the data
service indirectly, but > where > > > > > would the
model come into play logically, when DMS is handling > > so
much > > > > > of the work directly from the grid? >
> > > > > > > > > So any help would be
appreciated. > > > > > > > > > > >
> > > > > > > >
|
AVIS
IMPORTANT
|
WARNING
|
|
Ce message électronique et ses pièces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun privilège ou à aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pièces jointes, de votre système. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pièces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient être illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur.
|
This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender.
|
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
__,_._,___
|