Package org.fluxtream.core.domain

Examples of org.fluxtream.core.domain.ApiKey


        boolean worked = false;
    try { testConnection(url); worked = true;}
    catch (Exception e) {}
    if (worked) {
            final Connector connector = Connector.getConnector("mymee");
            final ApiKey apiKey = guestService.createApiKey(guestId, connector);
      guestService.setApiKeyAttribute(apiKey,  "fetchURL", url);
            connectorUpdateService.updateConnector(apiKey, false);
      return mav;
    } else {
      request.setAttribute("errorMessage", "Sorry, the URL you provided did not work.\n" +
View Full Code Here


        // check that we're running locally
        if (!RequestUtils.isDev(request)) {
            response.setStatus(403);
        }
        final Guest guest = guestService.getGuest(username);
        ApiKey apiKey = guestService.getApiKey(guest.getId(), Connector.getConnector("fluxtream_capture"));
        if (apiKey == null) {
            apiKey = guestService.createApiKey(guest.getId(), Connector.getConnector("fluxtream_capture"));
        }
        guestService.setApiKeyAttribute(apiKey, "test", attValue);
        return "attribute was set";
View Full Code Here

        if (!RequestUtils.isDev(request)) {
            response.setStatus(403);
        }
        final Guest guest = guestService.getGuest(username);
        final Connector connector = Connector.getConnector(connectorName);
        ApiKey apiKey = guestService.getApiKey(guest.getId(), connector);
        connectorUpdateService.updateConnector(apiKey, true);
        return "updating connector " + connectorName + " for guest " + guest.username;
    }
View Full Code Here

                                         ObjectType objectType,
                                         List<String> dates) {
        List<AbstractFacet> facets = new ArrayList<AbstractFacet>();
        try {
            if (AuthHelper.isViewingGranted(connector.getName(), buddiesService)) {
                final ApiKey apiKey = guestService.getApiKey(AuthHelper.getVieweeId(), connector);
                facets = apiDataService.getApiDataFacets(apiKey, objectType,
                        dates);
                facets = buddiesService.filterFacets(AuthHelper.getGuestId(), apiKey.getId(), facets);
            }
        } catch (Throwable t) {
            t.printStackTrace();
        }
        return facets;
View Full Code Here

  public List<AbstractFacet> getFacets(Connector connector,
      ObjectType objectType, AbstractTimespanMetadata timespanMetadata) {
    List<AbstractFacet> facets = new ArrayList<AbstractFacet>();
    try {
            if (AuthHelper.isViewingGranted(connector.getName(), buddiesService)) {
                final ApiKey apiKey = guestService.getApiKey(AuthHelper.getVieweeId(), connector);
                facets = apiDataService.getApiDataFacets(apiKey, objectType, timespanMetadata.getTimeInterval());
                facets = buddiesService.filterFacets(AuthHelper.getGuestId(), apiKey.getId(), facets);
            }
    } catch (Throwable t) {
      t.printStackTrace();
    }
    return facets;
View Full Code Here

    public List<AbstractRepeatableFacet> getFacets(final Connector connector, final ObjectType objectType, final String startDate, final String endDate) {
        List<AbstractRepeatableFacet> facets = new ArrayList<AbstractRepeatableFacet>();
        try {
            if (AuthHelper.isViewingGranted(connector.getName(), buddiesService)) {
                final ApiKey apiKey = guestService.getApiKey(AuthHelper.getVieweeId(), connector);
                facets = apiDataService.getApiDataFacets(apiKey, objectType,
                        startDate, endDate);
                facets = buddiesService.filterFacets(AuthHelper.getGuestId(), apiKey.getId(), facets);
            }
        } catch (Throwable t) {
            t.printStackTrace();
        }
        return facets;
View Full Code Here

                String lastname = user.getLastName();
                guest = guestService.createGuest(user.getUsername(), firstname!=null?firstname:"",
                                                 lastname!=null?lastname:"",
                                                 null, user.getEmail(),
                                                 Guest.RegistrationMethod.REGISTRATION_METHOD_FACEBOOK, null);
                final ApiKey apiKey = guestService.createApiKey(guest.getId(), Connector.getConnector("facebook"));

                guestService.setApiKeyAttribute(apiKey, "accessToken", accessToken.getAccessToken());
                guestService.setApiKeyAttribute(apiKey, "expires", String.valueOf(accessToken.getExpires().getTime()));
                guestService.setApiKeyAttribute(apiKey, "me", me);
View Full Code Here

    @ApiOperation(value = "Share a connector with a buddy")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully added a connector ({username}/{connectorName})")})
    public Response addSharedConnector(@ApiParam(value="The buddy's username", required=true) @PathParam("username") String username,
                                       @ApiParam(value="A connector name", required=true) @PathParam("connector") String connectorName) {
        final SharedConnector sharedConnector = buddiesService.addSharedConnector(AuthHelper.getGuestId(), username, connectorName, "{}");
        final ApiKey apiKey = guestService.getApiKey(AuthHelper.getGuestId(), Connector.getConnector(connectorName));
        final Class<? extends AbstractUpdater> updaterClass = apiKey.getConnector().getUpdaterClass();
        if (SharedConnectorSettingsAwareUpdater.class.isAssignableFrom(updaterClass)) {
            final SharedConnectorSettingsAwareUpdater updater = (SharedConnectorSettingsAwareUpdater) beanFactory.getBean(updaterClass);
            updater.syncSharedConnectorSettings(apiKey.getId(), sharedConnector);
        }
        return Response.ok("Successfully added a connector (" + username + "/" + connectorName + ")").build();
    }
View Full Code Here

    @ApiOperation(value = "Specify sharing details for a given connector – the structure of the specification object is connector specific")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "Saved shared connector filter object")})
    public Response saveSharedConnectorSettingsFilter(@ApiParam(value="ID of a connector instance", required=true) @PathParam("apiKeyId") long apiKeyId,
                                                      @ApiParam(value="The buddy's username", required=true) @PathParam("username") String username,
                                                      @ApiParam(value="Custom connector sharing specification", required=true) @FormParam("json") String json) {
        final ApiKey apiKey = guestService.getApiKey(apiKeyId);
        final long guestId = AuthHelper.getGuestId();
        final long buddyId = guestService.getGuest(username).getId();
        try {
            if (apiKey.getGuestId()!=guestId)
                throw new RuntimeException("attempt to retrieve ApiKey from another guest!");
            final SharedConnector sharedConnector = buddiesService.getSharedConnector(apiKeyId, buddyId);
            buddiesService.setSharedConnectorFilter(sharedConnector.getId(), json);
        } catch (Throwable e) {
            return Response.serverError().entity(e.getMessage()).build();
View Full Code Here

        Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier);
        final String token = accessToken.getToken();

        Guest guest = AuthHelper.getGuest();
        final Connector connector = Connector.getConnector("runkeeper");
        ApiKey apiKey;
        if (request.getParameter("state")!=null) {
            long apiKeyId = Long.valueOf(request.getParameter("state"));
            apiKey = guestService.getApiKey(apiKeyId);
        } else
            apiKey = guestService.createApiKey(guest.getId(), connector);

        guestService.populateApiKey(apiKey.getId());
        guestService.setApiKeyAttribute(apiKey, "accessToken", token);
        request.getSession().removeAttribute(RUNKEEPER_SERVICE);
        if (request.getParameter("state")!=null)
            return "redirect:/app/tokenRenewed/runkeeper";
        return "redirect:/app/from/runkeeper";
View Full Code Here

TOP

Related Classes of org.fluxtream.core.domain.ApiKey

Copyright © 2018 www.massapicom. 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.