Hello
I am using Model Driven Development, however all of my data insertion is not going to happen via the forms. There may be a background process that may pull the data from some where and insert into the database table, I am trying to use the existing assembler e.g, CurrencyAssembler to fetch all data or create a new item into it. How can I do it? I tried to instantiate CurrencyAssembler in my java class and call createItem(Currency) but I get null pointer exception, If I call the fill() on it, it needs PropertySpecifier object which is not allowed to be created outside its package. How do I use these assemblers for my non-form push and pull?
thanks
RK
Solved! Go to Solution.
Views
Replies
Total Likes
From my response in a different thread: You should pass the destination name to DST. And it is called <ModelName>.<NameOfEntity>.
With respect to PropertySpecifiers:
You should use the PropertySpecifier.getPropertySpecifier(String destName, List properties, boolean includeDefault [, isUpdate]) factory method. It is described here: http://help.adobe.com/en_US/enterpriseplatform/10.0/AEPDeveloperGuide/WSc3ff6d0ea77859461172e0811f00...
Rohit
Views
Replies
Total Likes
There are a couple of things you can do here: either you can simply notify data services of the change made via the separate process. This will allow the changes to be pushed out to clients and on the cluster. Alternately you can have the data services assembler itself persist changes from Java.
The way to do this is via the DataServiceTransaction API. This is only available from the webapp in which the message broker itself is running. Calling createItem()/updateItem()/deleteItem() on the DST will cause messages to be sent out to registered clients. If you set sendChangesToAdapter to true, it will also handle the actual persistence for you.
You can create an instance of DataServiceTransaction using begin() or use getCurrentDataServiceTransaction() to get the current DST if one already exists. Please make sure you call rollback() or commit() as appropriate when done with the DST.
Thanks for the response.. I still have some issues and doubts
I am calling the method doSomething() from flex client using flash remoting. Inside this, I am testing the DataServiceTransaction. Eventually there would be another thread in the webapp that will do the database updates.
public class MyApiMgr {
public void doSomething() {
DataServiceTransaction dtx = DataServiceTransaction.begin(false);
//DataServiceTransaction dtx = DataServiceTransaction.getCurrentDataServiceTransaction(); < -- this results in null pointer exception
dtx.setSendChangesToAdapter(true);
Currency c1 = new Currency();
c1.setCurrencyCode("ABC");
c1.setCurrencyName("Dummy Currency");
c1.setCurrencyLastUpdated(new Date());
dtx.createItem("currencyService", c1); <-- this results in the exception below
dtx.commit();
}
}
[RPC Fault faultString="No destination with id 'currencyService' is registered with the DataService." faultCode="Server.Processing" faultDetail="null"]
For model driven development, the LCDS manual explains not to configure any destination in the data-management-config.xml file, it is configured automatically so how do we send information back to the client, no db insertion is happening either.
pls help.
Views
Replies
Total Likes
From my response in a different thread: You should pass the destination name to DST. And it is called <ModelName>.<NameOfEntity>.
With respect to PropertySpecifiers:
You should use the PropertySpecifier.getPropertySpecifier(String destName, List properties, boolean includeDefault [, isUpdate]) factory method. It is described here: http://help.adobe.com/en_US/enterpriseplatform/10.0/AEPDeveloperGuide/WSc3ff6d0ea77859461172e0811f00...
Rohit
Views
Replies
Total Likes
As a follow up on this thread, when the updates are sent to the client (using the DataServiceTransaction.commit()), which function gets called in the mxml file. I want to catch those events in the client and act on them accordingly. Currently they are being silently written to grid on my screen...
Views
Replies
Total Likes
The ActionScript files that are generated from the model implement the service calls for the client. You can override the functions to add debug logic.
_Super_Servicename.as is a superclass....do not modify this file, it gets overwritten every time you save the model
Servicename.as extends the superclass. Edit this file, it will not get overwrittin. Override the superclass functions as required.
scott
Views
Replies
Total Likes
Scott
Thanks for the response but which method from that file gets called when a response is received from the server..
I checked the file SuperServicename.as and it has the Fill methods and the ones to create/update an item etc..
Thanks
RK
Views
Replies
Total Likes
Rupak,
I believe if you register a listener on the ArrayCollection you get as a result of the fill, you will get an event CollectionEvent.COLLECTION_CHANGE on data coming in from the server.
Regards,
Ashish Vashisht
Views
Replies
Total Likes
Ok, to cut the chase, all I want to do is to display on the top of the grid the newly added items to the grid (basically keep the table sorted, latest event always on the top). I am getting these items to be displayed in real time by server side push.
How do I achieve this..I am using advancedDataGrid but I can use DataGrid Too if that helps…
Views
Replies
Total Likes
All DataService CRUD methods return an AsyncToken. You can add a TokenResponder to this token with you callback function specificed.
Hope this helps,
Pam Colwell
DataServices Team
Views
Replies
Total Likes
> all I want to do is to display on the top of the grid the newly added items to the grid
In the implementing assembler, in the refreshFill() method return PREPEND_TO_FILL
Is this getting you closer?
Pam Colwell
DataServices Team
Views
Replies
Total Likes
Pam
I think so but am still not there.. I am using the following code to push the entry from the server. How do I specify PREPEND_TO_FILL.
public void doSomething() {
DataServiceTransaction dtx = DataServiceTransaction.begin(false);
dtx.setSendChangesToAdapter(true);
Currency c1 = new Currency();
c1.setCurrencyCode("ABC");
c1.setCurrencyName("Dummy Currency");
c1.setCurrencyLastUpdated(new Date());
dtx.createItem("currencyService", c1); <-- this results in the exception below
dtx.commit();
}
thanks
Rupak
Views
Replies
Total Likes
You can also register an eventListener on the DataService on the client side. This will receive server side push events.
Views
Replies
Total Likes
Pam
I like the PREPEND approach but not sure if it can be used with code snippet I am using..
If you are referring to registering an eventListener on DataService as in :-
<services:AlarmService id="alarmService" fault="alarmFaultHandler(event)" result="alarmResultHandler(event)" />
then the alarmResultHandler() doesnot get called when the data is pushed from the server using DataServiceTransaction. It gets called when I launch the screen and it calls Fill() to populate the grid..
pls advise
thanks
Views
Replies
Total Likes
> DataServiceWrapper that I can add an event listener on MessageEvent.MESSAGE but when I tried it, the handler never gets called when a service side push is performed on this service...Checking again,, I dont even see this event in the reference anymore
DataServiceWrapper has a serviceControl property that isa DataService
You can add your event listener to this property
Views
Likes
Replies
Views
Likes
Replies