Tuesday, December 6, 2011

LiveCycle DS , can't get the return...

Hi all!

I'm a have small problem , can any one help me? Please

I make a project which very similar to Product project(in
example).



1) Have Assembler class: I work correctly

package flex.samples.stock;



import java.util.List;

import java.util.Collection;

import java.util.Map;



import flex.data.DataSyncException;

import flex.data.assemblers.AbstractAssembler;



public class StockAssembler extends AbstractAssembler {



public Collection fill(List fillArgs) {

StockService service = new StockService();

System.out.print(fillArgs.size());

return service.getStocks();

}



public Object getItem(Map identity) {

StockService service = new StockService();

return service.getStock(((Integer)
identity.get(''StockId'')).intValue());

}



public void createItem(Object item) {

StockService service = new StockService();

service.create((Stock) item);

}



public void updateItem(Object newVersion, Object
prevVersion, List changes) {

StockService service = new StockService();

boolean success = service.update((Stock) newVersion);

if (!success) {

int stockId = ((Stock) newVersion).getStockId();

throw new DataSyncException(service.getStock(stockId),
changes);

}

}



public void deleteItem(Object item) {

StockService service = new StockService();

boolean success = service.delete((Stock) item);

if (!success) {

int stockId = ((Stock) item).getStockId();

throw new DataSyncException(service.getStock(stockId),
null);

}

}



}



some require class is ok.

2) I configure in data-management-config.xml

%26lt;destination id=''stockinventory''%26gt;



%26lt;adapter ref=''java-dao'' /%26gt;



%26lt;properties%26gt;


%26lt;source%26gt;flex.samples.stock.StockAssembler%26lt;/source%26gt;

%26lt;scope%26gt;application%26lt;/scope%26gt;



%26lt;metadata%26gt;

%26lt;identity property=''StockId''/%26gt;

%26lt;/metadata%26gt;



%26lt;network%26gt;

%26lt;session-timeout%26gt;20%26lt;/session-timeout%26gt;

%26lt;paging enabled=''false'' pageSize=''10'' /%26gt;

%26lt;throttle-inbound policy=''ERROR'' max-frequency=''500''/%26gt;

%26lt;throttle-outbound policy=''REPLACE''
max-frequency=''500''/%26gt;

%26lt;/network%26gt;



%26lt;/properties%26gt;

%26lt;/destination%26gt;





3) My client app:

I use :

....

%26lt;mx:ArrayCollection id=''stocks''/%26gt;

%26lt;mx:DataService id=''ds'' destination=''stockinventory''/%26gt;

......

ds.fill(stocks); --%26gt; Problem here

When I run this app, The StockAssembler on the server work
correctly (i use printout to debug) . But variable stocks can't get
the return value,it is a empty list.



Please help me!

No comments:

Post a Comment