Search in sources :

Example 31 with Pager

use of com.willshex.blogwt.shared.api.Pager in project blogwt by billy1380.

the class GetPostsResponse method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("posts")) {
        JsonElement jsonPosts = jsonObject.get("posts");
        if (jsonPosts != null) {
            posts = new ArrayList<Post>();
            Post item = null;
            for (int i = 0; i < jsonPosts.getAsJsonArray().size(); i++) {
                if (jsonPosts.getAsJsonArray().get(i) != null) {
                    (item = new Post()).fromJson(jsonPosts.getAsJsonArray().get(i).getAsJsonObject());
                    posts.add(item);
                }
            }
        }
    }
    if (jsonObject.has("pager")) {
        JsonElement jsonPager = jsonObject.get("pager");
        if (jsonPager != null) {
            pager = new Pager();
            pager.fromJson(jsonPager.getAsJsonObject());
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Post(com.willshex.blogwt.shared.api.datatype.Post) Pager(com.willshex.blogwt.shared.api.Pager)

Example 32 with Pager

use of com.willshex.blogwt.shared.api.Pager in project blogwt by billy1380.

the class GetRatingsRequest method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("by")) {
        JsonElement jsonBy = jsonObject.get("by");
        if (jsonBy != null) {
            by = new User();
            by.fromJson(jsonBy.getAsJsonObject());
        }
    }
    if (jsonObject.has("subjectId")) {
        JsonElement jsonSubjectId = jsonObject.get("subjectId");
        if (jsonSubjectId != null) {
            subjectId = Long.valueOf(jsonSubjectId.getAsLong());
        }
    }
    if (jsonObject.has("subjectType")) {
        JsonElement jsonSubjectType = jsonObject.get("subjectType");
        if (jsonSubjectType != null) {
            subjectType = jsonSubjectType.getAsString();
        }
    }
    if (jsonObject.has("pager")) {
        JsonElement jsonPager = jsonObject.get("pager");
        if (jsonPager != null) {
            pager = new Pager();
            pager.fromJson(jsonPager.getAsJsonObject());
        }
    }
}
Also used : User(com.willshex.blogwt.shared.api.datatype.User) JsonElement(com.google.gson.JsonElement) Pager(com.willshex.blogwt.shared.api.Pager)

Example 33 with Pager

use of com.willshex.blogwt.shared.api.Pager in project blogwt by billy1380.

the class GetRelatedPostsRequest method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("post")) {
        JsonElement jsonPost = jsonObject.get("post");
        if (jsonPost != null) {
            post = new Post();
            post.fromJson(jsonPost.getAsJsonObject());
        }
    }
    if (jsonObject.has("pager")) {
        JsonElement jsonPager = jsonObject.get("pager");
        if (jsonPager != null) {
            pager = new Pager();
            pager.fromJson(jsonPager.getAsJsonObject());
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Post(com.willshex.blogwt.shared.api.datatype.Post) Pager(com.willshex.blogwt.shared.api.Pager)

Example 34 with Pager

use of com.willshex.blogwt.shared.api.Pager in project blogwt by billy1380.

the class GetResourcesRequest method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("pager")) {
        JsonElement jsonPager = jsonObject.get("pager");
        if (jsonPager != null) {
            pager = new Pager();
            pager.fromJson(jsonPager.getAsJsonObject());
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Pager(com.willshex.blogwt.shared.api.Pager)

Example 35 with Pager

use of com.willshex.blogwt.shared.api.Pager in project blogwt by billy1380.

the class GetResourcesResponse method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("resources")) {
        JsonElement jsonResources = jsonObject.get("resources");
        if (jsonResources != null) {
            resources = new ArrayList<Resource>();
            Resource item = null;
            for (int i = 0; i < jsonResources.getAsJsonArray().size(); i++) {
                if (jsonResources.getAsJsonArray().get(i) != null) {
                    (item = new Resource()).fromJson(jsonResources.getAsJsonArray().get(i).getAsJsonObject());
                    resources.add(item);
                }
            }
        }
    }
    if (jsonObject.has("pager")) {
        JsonElement jsonPager = jsonObject.get("pager");
        if (jsonPager != null) {
            pager = new Pager();
            pager.fromJson(jsonPager.getAsJsonObject());
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Pager(com.willshex.blogwt.shared.api.Pager) Resource(com.willshex.blogwt.shared.api.datatype.Resource)

Aggregations

Pager (com.willshex.blogwt.shared.api.Pager)35 JsonElement (com.google.gson.JsonElement)26 Post (com.willshex.blogwt.shared.api.datatype.Post)10 User (com.willshex.blogwt.shared.api.datatype.User)6 Page (com.willshex.blogwt.shared.api.datatype.Page)3 ArrayList (java.util.ArrayList)3 ArchiveEntry (com.willshex.blogwt.shared.api.datatype.ArchiveEntry)2 HashMap (java.util.HashMap)2 SyndContent (com.rometools.rome.feed.synd.SyndContent)1 SyndContentImpl (com.rometools.rome.feed.synd.SyndContentImpl)1 SyndEntry (com.rometools.rome.feed.synd.SyndEntry)1 SyndEntryImpl (com.rometools.rome.feed.synd.SyndEntryImpl)1 SyndFeed (com.rometools.rome.feed.synd.SyndFeed)1 SyndFeedImpl (com.rometools.rome.feed.synd.SyndFeedImpl)1 GeneratedDownload (com.willshex.blogwt.shared.api.datatype.GeneratedDownload)1 MetaNotification (com.willshex.blogwt.shared.api.datatype.MetaNotification)1 Notification (com.willshex.blogwt.shared.api.datatype.Notification)1 NotificationSetting (com.willshex.blogwt.shared.api.datatype.NotificationSetting)1 Permission (com.willshex.blogwt.shared.api.datatype.Permission)1 Property (com.willshex.blogwt.shared.api.datatype.Property)1