0 Replies Latest reply on Oct 31, 2007 8:18 PM by Steven Tran

    LiveCycle DS , can't get the return value of fill( arg) from Assembler class

    Steven Tran
      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
      <destination id="stockinventory">

      <adapter ref="java-dao" />

      <properties>
      <source>flex.samples.stock.StockAssembler</source>
      <scope>application</scope>

      <metadata>
      <identity property="StockId"/>
      </metadata>

      <network>
      <session-timeout>20</session-timeout>
      <paging enabled="false" pageSize="10" />
      <throttle-inbound policy="ERROR" max-frequency="500"/>
      <throttle-outbound policy="REPLACE" max-frequency="500"/>
      </network>

      </properties>
      </destination>


      3) My client app:
      I use :
      ....
      <mx:ArrayCollection id="stocks"/>
      <mx:DataService id="ds" destination="stockinventory"/>
      ......
      ds.fill(stocks); --> 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!