Package org.glassfish.jersey.examples.oauth2.googleclient.model

Examples of org.glassfish.jersey.examples.oauth2.googleclient.model.TaskModel


        for (final TaskListBean taskListBean : taskRootBean.getItems()) {
            final List<TaskModel> taskList = new ArrayList<TaskModel>();
            final WebTarget listTarget = baseTarget.path("lists/{tasklist}/tasks")
                    .resolveTemplate("tasklist", taskListBean.getId());

            final TaskListBean fullTaskListBean = listTarget.request().get(TaskListBean.class);
            for (final TaskBean taskBean : fullTaskListBean.getTasks()) {
                taskList.add(new TaskModel(taskBean.getTitle()));
            }
            final TaskListModel listModel = new TaskListModel(taskListBean == null ? "No tasks were found. Define some tasks."
                    : taskListBean.getTitle(), taskList);
            listOfTaskLists.add(listModel);
View Full Code Here


    private static AllTaskListsModel getTasks(final Client client) {
        client.register(JacksonFeature.class);
        final WebTarget baseTarget = client.target(GOOGLE_TASKS_BASE_URI);
        final Response response = baseTarget.path("users/@me/lists").request().get();

        final TaskRootBean taskRootBean = response.readEntity(TaskRootBean.class);

        final List<TaskListModel> listOfTaskLists = new ArrayList<TaskListModel>();
        for (final TaskListBean taskListBean : taskRootBean.getItems()) {
            final List<TaskModel> taskList = new ArrayList<TaskModel>();
            final WebTarget listTarget = baseTarget.path("lists/{tasklist}/tasks")
                    .resolveTemplate("tasklist", taskListBean.getId());

            final TaskListBean fullTaskListBean = listTarget.request().get(TaskListBean.class);
View Full Code Here

            // redirect user to Google Authorization URI.
            return Response.seeOther(UriBuilder.fromUri(googleAuthURI).build()).build();
        }
        // We have already an access token. Query the data from Google API.
        final Client client = SimpleOAuthService.getFlow().getAuthorizedClient();
        final AllTaskListsModel allTaskListsModel = getTasks(client);
        return Response.ok(allTaskListsModel).type(MediaType.TEXT_HTML_TYPE).build();
    }
View Full Code Here

            final TaskListModel listModel = new TaskListModel(taskListBean == null ? "No tasks were found. Define some tasks."
                    : taskListBean.getTitle(), taskList);
            listOfTaskLists.add(listModel);

        }
        return new AllTaskListsModel(listOfTaskLists);
    }
View Full Code Here

            final TaskListBean fullTaskListBean = listTarget.request().get(TaskListBean.class);
            for (final TaskBean taskBean : fullTaskListBean.getTasks()) {
                taskList.add(new TaskModel(taskBean.getTitle()));
            }
            final TaskListModel listModel = new TaskListModel(taskListBean == null ? "No tasks were found. Define some tasks."
                    : taskListBean.getTitle(), taskList);
            listOfTaskLists.add(listModel);

        }
        return new AllTaskListsModel(listOfTaskLists);
View Full Code Here

            final WebTarget listTarget = baseTarget.path("lists/{tasklist}/tasks")
                    .resolveTemplate("tasklist", taskListBean.getId());

            final TaskListBean fullTaskListBean = listTarget.request().get(TaskListBean.class);
            for (final TaskBean taskBean : fullTaskListBean.getTasks()) {
                taskList.add(new TaskModel(taskBean.getTitle()));
            }
            final TaskListModel listModel = new TaskListModel(taskListBean == null ? "No tasks were found. Define some tasks."
                    : taskListBean.getTitle(), taskList);
            listOfTaskLists.add(listModel);
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.examples.oauth2.googleclient.model.TaskModel

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.