Package net.sf.json

Examples of net.sf.json.JSONObject.accumulate()


        JSONArray servingsArray = new JSONArray();
        for (JawboneUpServingFacet serving : facet.getServings()) {
            JSONObject servingJSON = JSONObject.fromObject(serving.servingDetails);
            servingJSON.accumulate("deviceName", "Jawbone_UP");
            servingJSON.accumulate("channelName", "serving");
            servingJSON.accumulate("UID", serving.getId());
            servingJSON.accumulate("start", serving.start);
            if (servingJSON.has("image")&&!servingJSON.getString("image").equals(""))
                servingJSON.put("image", JawboneUpVOHelper.getImageURL(servingJSON.getString("image"), facet, settings.config));
            servingsArray.add(servingJSON);
        }
View Full Code Here


        for (JawboneUpServingFacet serving : facet.getServings()) {
            JSONObject servingJSON = JSONObject.fromObject(serving.servingDetails);
            servingJSON.accumulate("deviceName", "Jawbone_UP");
            servingJSON.accumulate("channelName", "serving");
            servingJSON.accumulate("UID", serving.getId());
            servingJSON.accumulate("start", serving.start);
            if (servingJSON.has("image")&&!servingJSON.getString("image").equals(""))
                servingJSON.put("image", JawboneUpVOHelper.getImageURL(servingJSON.getString("image"), facet, settings.config));
            servingsArray.add(servingJSON);
        }
        servings = servingsArray.toString();
View Full Code Here

        Connector connector = Connector.getConnector(connectorName);
        Guest guest = AuthHelper.getGuest();
        final ApiKey apiKey = guestService.getApiKey(guest.getId(), connector);
        final ApiUpdate lastSuccessfulUpdate = connectorUpdateService.getLastSuccessfulUpdate(apiKey);
        JSONObject response = new JSONObject();
        response.accumulate("lastSuccessfulUpdate", lastSuccessfulUpdate!=null
            ? fmt.print(lastSuccessfulUpdate.ts) : "never");
        return Response.ok(response.toString()).build();
    }

    @POST
View Full Code Here

        Connector connector = Connector.getConnector(connectorName);
        Guest guest = AuthHelper.getGuest();
        final ApiKey apiKey = guestService.getApiKey(guest.getId(), connector);
        final ApiUpdate lastUpdate = connectorUpdateService.getLastUpdate(apiKey);
        JSONObject response = new JSONObject();
        response.accumulate("lastUpdate", lastUpdate!=null
                                                    ? fmt.print(lastUpdate.ts) : "never");
        return Response.ok(response.toString()).build();
    }

}
View Full Code Here

        final ApiKey apiKey = guestService.getApiKey(apiKeyId);
        ConnectorInfo connectorInfo = sysService.getConnectorInfo(apiKey.getConnector().getName());
        JSONObject renewInfo = new JSONObject();
        final String renewTokensUrlTemplate = connectorInfo.renewTokensUrlTemplate;
        final String renewTokensUrl = String.format(renewTokensUrlTemplate, apiKey.getId());
        renewInfo.accumulate("redirectTo", env.get("homeBaseUrl") + renewTokensUrl);
        return renewInfo.toString();
    }

    @GET
    @Path("/installed")
View Full Code Here

                                      @ApiParam(value="Bit mask of the connector's object types", required=true) @FormParam("objectTypes") int objectTypes) {
        final long guestId = AuthHelper.getGuestId();
        final ApiKey apiKey = guestService.getApiKey(guestId, Connector.getConnector(connectorName));
        final boolean historyUpdateCompleted = connectorUpdateService.isHistoryUpdateCompleted(apiKey, objectTypes);
        JSONObject response = new JSONObject();
        response.accumulate("historyUpdateCompleted", historyUpdateCompleted);
        return Response.ok(response.toString()).build();
    }

    @ApiModel
    public class IsSynchingModel {
View Full Code Here

    public Response isSynching(@ApiParam(value="Connector name", required=true) @PathParam("connector") String connectorName) {
        final long guestId = AuthHelper.getGuestId();
        final ApiKey apiKey = guestService.getApiKey(guestId, Connector.getConnector(connectorName));
        final Collection<UpdateWorkerTask> scheduledUpdates = connectorUpdateService.getUpdatingUpdateTasks(apiKey);
        JSONObject response = new JSONObject();
        response.accumulate("synching", scheduledUpdates.size()>0);
        return Response.ok(response.toString()).build();
    }

    @ApiModel
    public class LastSuccessfulUpdateModel {
View Full Code Here

      list.add(file);
      file = null;
    }
    JSONObject jsonresult = new JSONObject();
    jsonresult.accumulate("list", list);
    String jsonList = JSONUtils.valueToString(jsonresult);
    System.out.println(jsonList);
    return jsonList;

  }
View Full Code Here

      list.add(file);
      file = null;
    }
    JSONObject jsonresult = new JSONObject();
    jsonresult.accumulate("list", list);
    String jsonList = JSONUtils.valueToString(jsonresult);
    System.out.println(jsonList);
    return jsonList;

  }
View Full Code Here

                ApiKey apiKey = guestService.getApiKey(userProfile.apiKeyId);
        connectorUpdateService.addApiNotification(connector(),
            apiKey.getGuestId(), updatesString);

        JSONObject jsonParams = new JSONObject();
        jsonParams.accumulate("date", dateString)
            .accumulate("ownerId", ownerId)
            .accumulate("subscriptionId", subscriptionId);

        logger.info("action=scheduleUpdate connector=fitbit collectionType="
            + collectionType);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.