I'm creating an adapter in java, and i wonder if it is possible to return the object ProductVO to the adapter js, or first i need to convert the object to JSON String and return?
ProductAdapter-impl.js
function getProductByBarCode(barCode){
var productTest = new com.ciss.mobile.cissmarttax.service.ProductTest();
return {
result: productTest.getProductByBarCode(barCode,0)
};
}
ProductTest.java
package com.ciss.mobile.cissmarttax.service;
public class ProductTest {
private final static Logger logger = Logger.getLogger(ProductTest.class.getName());
public ProductVO getProductByBarCode(String barcode, Integer offset){
//logger.info("getProductByBarCode invoked");
ProductFacade productFacade = new ProductImpl();
try {
List<ProductVO> products = productFacade.getProductByBarCode(barcode);
if(products != null)
return (ProductVO) products.get(0);
} catch (SystemException e) {
e.printStackTrace();
}
return null;
}
}