use of life.genny.qwanda.attribute.AttributeMoney in project rulesservice by genny-project.
the class QRules method sendAllLoads.
/* Get All the jobs */
public void sendAllLoads(String searchBeCode) throws ClientProtocolException, IOException {
// println("Get all Loads - The search BE is :: "+searchBeCode );
BaseEntity searchBE = new BaseEntity(searchBeCode, "Get All Loads");
// BaseEntity searchBE;
JsonArray columnsArray = new JsonArray();
JsonObject columns = new JsonObject();
// Creating attributes
AttributeText attributeBECode = new AttributeText("PRI_CODE", "LIKE");
JsonObject beCode = new JsonObject();
beCode.put("code", "PRI_CODE");
AttributeText attributeTextName = new AttributeText("COL_PRI_NAME", "Load Name");
JsonObject name = new JsonObject();
name.put("code", "PRI_NAME");
columnsArray.add(name);
AttributeText attributeTextJobId = new AttributeText("COL_PRI_JOB_ID", "Job ID");
JsonObject description = new JsonObject();
description.put("code", "PRI_JOB_ID");
columnsArray.add(description);
AttributeText attributeTextPickupAddress = new AttributeText("COL_PRI_PICKUP_ADDRESS_FULL", "Pickup Address");
JsonObject pickUpAddress = new JsonObject();
pickUpAddress.put("code", "PRI_PICKUP_ADDRESS_FULL");
columnsArray.add(pickUpAddress);
AttributeMoney attributeDescription = new AttributeMoney("COL_PRI_DESCRIPTION", "Description");
JsonObject ownerPrice = new JsonObject();
ownerPrice.put("code", "PRI_DESCRIPTION");
columnsArray.add(ownerPrice);
// Sort Attribute
AttributeText attributeTextSortName = new AttributeText("SRT_PRI_NAME", "Sort By Name");
// Pagination Attribute
AttributeInteger attributePageStart = new AttributeInteger("SCH_PAGE_START", "PageStart");
AttributeInteger attributePageSize = new AttributeInteger("SCH_PAGE_SIZE", "PageSize");
try {
searchBE.addAttribute(attributeBECode, 10.0, "BEG_%%");
searchBE.addAttribute(attributeTextName, 9.0);
searchBE.addAttribute(attributeTextJobId, 8.0);
searchBE.addAttribute(attributeTextPickupAddress, 7.0);
// searchBE.addAttribute(attributeTextDropOffAddress, 6.0);
searchBE.addAttribute(attributeDescription, 5.0);
// searchBE.addAttribute(attributeDriverPrice, 4.0);
searchBE.addAttribute(attributeTextSortName, 3.0, "ASC");
searchBE.addAttribute(attributePageStart, 2.0, "0");
searchBE.addAttribute(attributePageSize, 1.0, "500");
} catch (BadDataException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// println("The search BE is :: "+JsonUtils.toJson(searchBE));
String jsonSearchBE = JsonUtils.toJson(searchBE);
String loadsList = QwandaUtils.apiPostEntity(qwandaServiceUrl + "/qwanda/baseentitys/search", jsonSearchBE, getToken());
// System.out.println("The result :: "+loadsList);
publishData(new JsonObject(loadsList));
sendTableViewWithHeaders("SBE_GET_ALL_LOADS", columnsArray);
}
Aggregations