Search in sources :

Example 1 with AttributeBoolean

use of life.genny.qwanda.attribute.AttributeBoolean in project rulesservice by genny-project.

the class QRules method sendAllOwners.

// Search and send all the Owners
public void sendAllOwners(String searchBeCode) throws ClientProtocolException, IOException {
    println("Get All Drivers - The search BE is  :: " + searchBeCode);
    BaseEntity searchBE = new BaseEntity(searchBeCode, "Get All Owners");
    JsonArray columnsArray = new JsonArray();
    JsonObject columns = new JsonObject();
    AttributeText attributeTextImage = new AttributeText("COL_PRI_IMAGE_URL", "Image");
    JsonObject image = new JsonObject();
    image.put("code", "PRI_IMAGE_URL");
    columnsArray.add(image);
    AttributeText attributeTextUserName = new AttributeText("COL_PRI_USERNAME", "User Name");
    JsonObject userName = new JsonObject();
    userName.put("code", "PRI_USERNAME");
    columnsArray.add(userName);
    AttributeText attributeTextFirstName = new AttributeText("COL_PRI_FIRSTNAME", "First Name");
    JsonObject firstName = new JsonObject();
    firstName.put("code", "PRI_FIRSTNAME");
    columnsArray.add(firstName);
    AttributeText attributeTextLastName = new AttributeText("COL_PRI_LASTNAME", "Last Name");
    JsonObject lastName = new JsonObject();
    lastName.put("code", "PRI_LASTNAME");
    columnsArray.add(lastName);
    AttributeText attributeTextMobile = new AttributeText("COL_PRI_MOBILE", "Mobile Number");
    JsonObject mobile = new JsonObject();
    mobile.put("code", "PRI_MOBILE");
    columnsArray.add(mobile);
    AttributeText attributeTextEmail = new AttributeText("COL_PRI_EMAIL", "Email");
    JsonObject email = new JsonObject();
    email.put("code", "PRI_EMAIL");
    columnsArray.add(email);
    println("The columnsArray is ::" + columnsArray);
    // Sort Attribute
    AttributeText attributeTextSortFirstName = new AttributeText("SRT_PRI_FIRSTNAME", "Sort By FirstName");
    AttributeBoolean attributeIsDriver = new AttributeBoolean("PRI_OWNER", "=");
    // Pagination Attribute
    AttributeInteger attributePageStart = new AttributeInteger("SCH_PAGE_START", "PageStart");
    AttributeInteger attributePageSize = new AttributeInteger("SCH_PAGE_SIZE", "PageSize");
    try {
        searchBE.addAttribute(attributeTextImage, 10.0);
        searchBE.addAttribute(attributeTextUserName, 9.0);
        searchBE.addAttribute(attributeTextFirstName, 8.0);
        searchBE.addAttribute(attributeTextLastName, 7.0);
        searchBE.addAttribute(attributeTextMobile, 6.0);
        searchBE.addAttribute(attributeTextEmail, 5.0);
        searchBE.addAttribute(attributeTextSortFirstName, 4.0, "ASC");
        searchBE.addAttribute(attributeIsDriver, 3.0, "TRUE");
        searchBE.addAttribute(attributePageStart, 3.0, "0");
        searchBE.addAttribute(attributePageSize, 2.0, "20");
    } catch (BadDataException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    // println("The search BE is  :: " + JsonUtils.toJson(searchBE));
    String jsonSearchBE = JsonUtils.toJson(searchBE);
    String result = QwandaUtils.apiPostEntity(qwandaServiceUrl + "/qwanda/baseentitys/search", jsonSearchBE, getToken());
    System.out.println("The result   ::  " + result);
    publishData(new JsonObject(result));
    sendTableViewWithHeaders("SBE_GET_ALL_OWNERS", columnsArray);
}
Also used : JsonArray(io.vertx.core.json.JsonArray) BadDataException(life.genny.qwanda.exception.BadDataException) AttributeText(life.genny.qwanda.attribute.AttributeText) BaseEntity(life.genny.qwanda.entity.BaseEntity) AttributeBoolean(life.genny.qwanda.attribute.AttributeBoolean) JsonObject(io.vertx.core.json.JsonObject) AttributeInteger(life.genny.qwanda.attribute.AttributeInteger)

Example 2 with AttributeBoolean

use of life.genny.qwanda.attribute.AttributeBoolean in project rulesservice by genny-project.

the class QRules method sendAllDrivers.

// Search and send all the Drivers
public void sendAllDrivers(String searchBeCode) throws ClientProtocolException, IOException {
    println("Get All Drivers - The search BE is  :: " + searchBeCode);
    // createBaseEntityByCode2(searchBeCode,
    BaseEntity searchBE = new BaseEntity(searchBeCode, "Get All Drivers");
    // "Get All Users");
    JsonArray columnsArray = new JsonArray();
    JsonObject columns = new JsonObject();
    // if( getBaseEntityByCode(searchBeCode) == null ) {
    // searchBE = createBaseEntityByCode2(searchBeCode, "Get All Users");
    AttributeText attributeTextImage = new AttributeText("COL_PRI_IMAGE_URL", "Image");
    JsonObject image = new JsonObject();
    image.put("code", "PRI_IMAGE_URL");
    columnsArray.add(image);
    AttributeText attributeTextUserName = new AttributeText("COL_PRI_USERNAME", "User Name");
    JsonObject userName = new JsonObject();
    userName.put("code", "PRI_USERNAME");
    columnsArray.add(userName);
    AttributeText attributeTextFirstName = new AttributeText("COL_PRI_FIRSTNAME", "First Name");
    JsonObject firstName = new JsonObject();
    firstName.put("code", "PRI_FIRSTNAME");
    columnsArray.add(firstName);
    AttributeText attributeTextLastName = new AttributeText("COL_PRI_LASTNAME", "Last Name");
    JsonObject lastName = new JsonObject();
    lastName.put("code", "PRI_LASTNAME");
    columnsArray.add(lastName);
    AttributeText attributeTextMobile = new AttributeText("COL_PRI_MOBILE", "Mobile Number");
    JsonObject mobile = new JsonObject();
    mobile.put("code", "PRI_MOBILE");
    columnsArray.add(mobile);
    AttributeText attributeTextEmail = new AttributeText("COL_PRI_EMAIL", "Email");
    JsonObject email = new JsonObject();
    email.put("code", "PRI_EMAIL");
    columnsArray.add(email);
    println("The columnsArray is ::" + columnsArray);
    // Sort Attribute
    AttributeText attributeTextSortFirstName = new AttributeText("SRT_PRI_FIRSTNAME", "Sort By FirstName");
    AttributeBoolean attributeIsDriver = new AttributeBoolean("PRI_DRIVER", "=");
    // Pagination Attribute
    AttributeInteger attributePageStart = new AttributeInteger("SCH_PAGE_START", "PageStart");
    AttributeInteger attributePageSize = new AttributeInteger("SCH_PAGE_SIZE", "PageSize");
    try {
        searchBE.addAttribute(attributeTextImage, 10.0);
        searchBE.addAttribute(attributeTextUserName, 9.0);
        searchBE.addAttribute(attributeTextFirstName, 8.0);
        searchBE.addAttribute(attributeTextLastName, 7.0);
        searchBE.addAttribute(attributeTextMobile, 6.0);
        searchBE.addAttribute(attributeTextEmail, 5.0);
        searchBE.addAttribute(attributeTextSortFirstName, 4.0, "ASC");
        searchBE.addAttribute(attributeIsDriver, 3.0, "TRUE");
        searchBE.addAttribute(attributePageStart, 3.0, "0");
        searchBE.addAttribute(attributePageSize, 2.0, "20");
    } catch (BadDataException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    // }else {
    // searchBE = getBaseEntityByCodeWithAttributes(searchBeCode);
    // }
    // println("The search BE is  :: " + JsonUtils.toJson(searchBE));
    String jsonSearchBE = JsonUtils.toJson(searchBE);
    String result = QwandaUtils.apiPostEntity(qwandaServiceUrl + "/qwanda/baseentitys/search", jsonSearchBE, getToken());
    System.out.println("The result   ::  " + result);
    publishData(new JsonObject(result));
    sendTableViewWithHeaders("SBE_GET_ALL_DRIVERS", columnsArray);
// sendCmdView("TABLE_VIEW", "SBE_GET_ALL_USERS" );
// publishCmd(result, grpCode, "LNK_CORE");
}
Also used : JsonArray(io.vertx.core.json.JsonArray) BadDataException(life.genny.qwanda.exception.BadDataException) AttributeText(life.genny.qwanda.attribute.AttributeText) BaseEntity(life.genny.qwanda.entity.BaseEntity) AttributeBoolean(life.genny.qwanda.attribute.AttributeBoolean) JsonObject(io.vertx.core.json.JsonObject) AttributeInteger(life.genny.qwanda.attribute.AttributeInteger)

Aggregations

JsonArray (io.vertx.core.json.JsonArray)2 JsonObject (io.vertx.core.json.JsonObject)2 AttributeBoolean (life.genny.qwanda.attribute.AttributeBoolean)2 AttributeInteger (life.genny.qwanda.attribute.AttributeInteger)2 AttributeText (life.genny.qwanda.attribute.AttributeText)2 BaseEntity (life.genny.qwanda.entity.BaseEntity)2 BadDataException (life.genny.qwanda.exception.BadDataException)2