Hi,

I am working on a sample application with flex (and LCDS
data services) and have
been experimenting with directly calling the fill method
(extending AbstractAssembler) as a way of poking data into a
server-side DB. Every time I try to run my test case fill is not
getting called . I'd appreciate any pointers as to where I'm going
wrong...

I am directly using the lcds-sample.war, in that testdrive-dataservice code 
Sorry for the lengthy code attach.

my mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*" 
backgroundColor="#FFFFFF">

    
    <mx:ArrayCollection id="products"/> 
    <mx:DataService id="ds" destination="inventory"/>
    <Product/>
    
    <mx:DataGrid dataProvider="{products}" editable="true" width="100%" 
height="100%">

        <mx:columns>
            <mx:DataGridColumn dataField="name" headerText="Name"/>
            <mx:DataGridColumn dataField="category" headerText="Category"/>

            <mx:DataGridColumn dataField="price" headerText="Price"/>
            <mx:DataGridColumn dataField="image" headerText="Image"/>
            <mx:DataGridColumn dataField="description" 
headerText="Description"/>

        </mx:columns>
    </mx:DataGrid>
    
    <mx:Button label="Get Data" click="ds.fill(products)"/> 
    
</mx:Application>

ProductAssembler.java extends AbstractAssembler

********************************************************

package flex.samples.product;

import java.util.List;
import java.util.Collection;
import java.util.Map;


import flex.data.assemblers.AbstractAssembler;


public class ProductAssembler extends AbstractAssembler {

    public Collection fill(List fillArgs)  {

        List list = new ArrayList();    
        System.out.println(" in service");

        return list;
        
    }

    

    public void createItem(Object item)  {
    
    }

    
    
}

********************************************************************

Product.as

package
{
    [Managed]
    [RemoteClass(alias="flex.samples.product.Product")]
    public class Product
    {
        public function Product()
        {
        }


        public var productId:int; 

        public var name:String;

        public var description:String;

        public var image:String;

        public var category:String;

        public var price:Number;


        public var qtyInStock:int;

    }
}
*************************************************

package flex.samples.product;
import java.io.Serializable;

public class Product implements Serializable {


    static final long serialVersionUID = 103844514947365244L;
    
    private int productId;
    private String name;
    private String description;
    private String image;
    private String category;

    private double price;
    private int qtyInStock;
    
    public Product() {
        
    }
    
   
public Product(int productId, String name, String description, String
image, String category, double price, int qtyInStock) {

        this.productId = productId;
        this.name = name;
        this.description = description;
        this.image = image;
        this.category = category;
        this.price = price;

        this.qtyInStock = qtyInStock;
    }

    public String getCategory() {
        return category;
    }
    public void setCategory(String category) {
        this.category = category;
    }

    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getImage() {

        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {

        this.name = name;
    }
    public double getPrice() {
        return price;
    }
    public void setPrice(double price) {
        this.price = price;
    }

    public int getProductId() {
        return productId;
    }
    public void setProductId(int productId) {
        this.productId = productId;
    }
    public int getQtyInStock() {
        return qtyInStock;

    }
    public void setQtyInStock(int qtyInStock) {
        this.qtyInStock = qtyInStock;
    }

}
*********************************************************************
data-management-config.xml 


 <destination id="inventory">

        <properties>
            <source>flex.samples.product.ProductAssembler</source>
            <scope>application</scope>


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

            <network>
                <paging enabled="false" pageSize="10" />

            </network>
            <item-class>flex.samples.product.Product</item-class>
        </properties>
    </destination>


      

Reply via email to