V1_0.java [src/java/m/rv/crm] Revision: default Date:
/*
* $Id$
*
* This file is part of the Cloud Services Integration Platform (CSIP),
* a Model-as-a-Service framework, API, and application suite.
*
* 2012-2022, OMSLab, Colorado State University.
*
* OMSLab licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*/
package m.rv.crm;
import csip.ModelDataService;
import csip.annotations.*;
import javax.ws.rs.Path;
import org.codehaus.jettison.json.JSONArray;
import rv.utils.CRMConnection;
/**
* CRM access.
*
* @version 1.0
* @author odavid
*/
@Name("CRM Access for Bamert Seed.")
@Path("m/crm/1.0")
@VersionInfo("$Id$")
@Gzip
public class V1_0 extends ModelDataService {
@Override
protected void doProcess() throws Exception {
String[] plantsymbols = parameter().getStringArray("plant_symbol");
CRMConnection s = new CRMConnection(LOG);
String[] products = s.getProductsList(plantsymbols, LOG);
for (int i = 0; i < products.length; i++) {
results().put(plantsymbols[i], new JSONArray(products[i]),
"Products for plant symbol " + plantsymbols[i]);
}
}
}