Search in sources :

Example 16 with Pager

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

the class GetNotificationSettingsResponse 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());
        }
    }
    if (jsonObject.has("settings")) {
        JsonElement jsonSettings = jsonObject.get("settings");
        if (jsonSettings != null) {
            settings = new ArrayList<NotificationSetting>();
            NotificationSetting item = null;
            for (int i = 0; i < jsonSettings.getAsJsonArray().size(); i++) {
                if (jsonSettings.getAsJsonArray().get(i) != null) {
                    (item = new NotificationSetting()).fromJson(jsonSettings.getAsJsonArray().get(i).getAsJsonObject());
                    settings.add(item);
                }
            }
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Pager(com.willshex.blogwt.shared.api.Pager) NotificationSetting(com.willshex.blogwt.shared.api.datatype.NotificationSetting)

Example 17 with Pager

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

the class GetNotificationsRequest method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("user")) {
        JsonElement jsonUser = jsonObject.get("user");
        if (jsonUser != null) {
            user = new User();
            user.fromJson(jsonUser.getAsJsonObject());
        }
    }
    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 18 with Pager

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

the class GetNotificationsResponse method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("notifications")) {
        JsonElement jsonNotifications = jsonObject.get("notifications");
        if (jsonNotifications != null) {
            notifications = new ArrayList<Notification>();
            Notification item = null;
            for (int i = 0; i < jsonNotifications.getAsJsonArray().size(); i++) {
                if (jsonNotifications.getAsJsonArray().get(i) != null) {
                    (item = new Notification()).fromJson(jsonNotifications.getAsJsonArray().get(i).getAsJsonObject());
                    notifications.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) Notification(com.willshex.blogwt.shared.api.datatype.Notification)

Example 19 with Pager

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

the class GetPagesRequest method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("parent")) {
        JsonElement jsonParent = jsonObject.get("parent");
        if (jsonParent != null) {
            parent = new Page();
            parent.fromJson(jsonParent.getAsJsonObject());
        }
    }
    if (jsonObject.has("includePosts")) {
        JsonElement jsonIncludePosts = jsonObject.get("includePosts");
        if (jsonIncludePosts != null) {
            includePosts = Boolean.valueOf(jsonIncludePosts.getAsBoolean());
        }
    }
    if (jsonObject.has("pager")) {
        JsonElement jsonPager = jsonObject.get("pager");
        if (jsonPager != null) {
            pager = new Pager();
            pager.fromJson(jsonPager.getAsJsonObject());
        }
    }
    if (jsonObject.has("query")) {
        JsonElement jsonQuery = jsonObject.get("query");
        if (jsonQuery != null) {
            query = jsonQuery.getAsString();
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Pager(com.willshex.blogwt.shared.api.Pager) Page(com.willshex.blogwt.shared.api.datatype.Page)

Example 20 with Pager

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

the class GetPagesResponse method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("pages")) {
        JsonElement jsonPages = jsonObject.get("pages");
        if (jsonPages != null) {
            pages = new ArrayList<Page>();
            Page item = null;
            for (int i = 0; i < jsonPages.getAsJsonArray().size(); i++) {
                if (jsonPages.getAsJsonArray().get(i) != null) {
                    (item = new Page()).fromJson(jsonPages.getAsJsonArray().get(i).getAsJsonObject());
                    pages.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) Page(com.willshex.blogwt.shared.api.datatype.Page)

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