/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package messerviceframeworkri;

import com.essar.mes.services.InventoryService;
import com.essar.mes.services.inventory.SAPInventory;
import com.essar.mes.services.inventory.SAPInventoryResult;
import com.essar.mes.services.inventory.SAPMaterial;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author dhaval
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("/messerviceframeworkri/service-config.xml");
        InventoryService inventoryService = (InventoryService) ctx.getBean("inventoryService");

        SAPInventory inventory = new SAPInventory();
        inventory.setId("INVE-1");
        inventory.setGrade("GRADE1");
        inventory.setEdgeCondition("U");
        inventory.setThickness(1.1f);
        inventory.setWidth(1.11f);

        SAPMaterial material = new SAPMaterial();
        material.setId("MAT-1");

        inventory.setMaterial(material);

        SAPInventoryResult result = inventoryService.saveInventory(inventory);
        System.out.println(result);
    }

}
