Search in sources :

Example 1 with PhasingOnly

use of org.xel.AccountRestrictions.PhasingOnly in project elastic-core-maven by OrdinaryDude.

the class GetAllPhasingOnlyControls method processRequest.

@Override
protected JSONStreamAware processRequest(HttpServletRequest req) throws ParameterException {
    int firstIndex = ParameterParser.getFirstIndex(req);
    int lastIndex = ParameterParser.getLastIndex(req);
    JSONObject response = new JSONObject();
    JSONArray jsonArray = new JSONArray();
    try (DbIterator<PhasingOnly> iterator = PhasingOnly.getAll(firstIndex, lastIndex)) {
        for (PhasingOnly phasingOnly : iterator) {
            jsonArray.add(JSONData.phasingOnly(phasingOnly));
        }
    }
    response.put("phasingOnlyControls", jsonArray);
    return response;
}
Also used : PhasingOnly(org.xel.AccountRestrictions.PhasingOnly) JSONObject(org.json.simple.JSONObject) JSONArray(org.json.simple.JSONArray)

Example 2 with PhasingOnly

use of org.xel.AccountRestrictions.PhasingOnly in project elastic-core-maven by OrdinaryDude.

the class GetPhasingOnlyControl method processRequest.

@Override
protected JSONStreamAware processRequest(HttpServletRequest req) throws ParameterException {
    long accountId = ParameterParser.getAccountId(req, true);
    PhasingOnly phasingOnly = PhasingOnly.get(accountId);
    return phasingOnly == null ? JSON.emptyJSON : JSONData.phasingOnly(phasingOnly);
}
Also used : PhasingOnly(org.xel.AccountRestrictions.PhasingOnly)

Aggregations

PhasingOnly (org.xel.AccountRestrictions.PhasingOnly)2 JSONArray (org.json.simple.JSONArray)1 JSONObject (org.json.simple.JSONObject)1