Search in sources :

Example 1 with AttributeBooleanIF

use of com.runwaysdk.dataaccess.AttributeBooleanIF in project geoprism-registry by terraframe.

the class UserInfo method serializePage.

private static JSONObject serializePage(Integer pageSize, Integer pageNumber, JSONArray externalSystems, ValueQuery vQuery) {
    JSONArray results = new JSONArray();
    OIterator<ValueObject> it = vQuery.getIterator(pageSize, pageNumber);
    try {
        while (it.hasNext()) {
            ValueObject vObject = it.next();
            JSONObject result = new JSONObject();
            result.put(GeoprismUser.OID, vObject.getValue(GeoprismUser.OID));
            result.put(GeoprismUser.USERNAME, vObject.getValue(GeoprismUser.USERNAME));
            result.put(GeoprismUser.FIRSTNAME, vObject.getValue(GeoprismUser.FIRSTNAME));
            result.put(GeoprismUser.LASTNAME, vObject.getValue(GeoprismUser.LASTNAME));
            result.put(GeoprismUser.PHONENUMBER, vObject.getValue(GeoprismUser.PHONENUMBER));
            result.put(GeoprismUser.EMAIL, vObject.getValue(GeoprismUser.EMAIL));
            result.put(GeoprismUser.INACTIVE, AttributeBoolean.getBooleanValue((AttributeBooleanIF) vObject.getAttributeIF(GeoprismUser.INACTIVE)));
            result.put(UserInfo.ALTFIRSTNAME, vObject.getValue(UserInfo.ALTFIRSTNAME));
            result.put(UserInfo.ALTLASTNAME, vObject.getValue(UserInfo.ALTLASTNAME));
            result.put(UserInfo.ALTPHONENUMBER, vObject.getValue(UserInfo.ALTPHONENUMBER));
            result.put(UserInfo.POSITION, vObject.getValue(UserInfo.POSITION));
            result.put(UserInfo.EXTERNALSYSTEMOID, vObject.getValue(UserInfo.EXTERNALSYSTEMOID));
            results.put(result);
        }
    } finally {
        it.close();
    }
    JSONObject page = new JSONObject();
    page.put("resultSet", results);
    page.put("count", vQuery.getCount());
    page.put("pageNumber", pageNumber);
    page.put("pageSize", pageSize);
    page.put("externalSystems", externalSystems);
    return page;
}
Also used : JSONObject(org.json.JSONObject) AttributeBooleanIF(com.runwaysdk.dataaccess.AttributeBooleanIF) JSONArray(org.json.JSONArray) ValueObject(com.runwaysdk.dataaccess.ValueObject)

Aggregations

AttributeBooleanIF (com.runwaysdk.dataaccess.AttributeBooleanIF)1 ValueObject (com.runwaysdk.dataaccess.ValueObject)1 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1