Search in sources :

Example 6 with ArchiveEntry

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

the class GetArchiveEntriesResponse method fromJson.

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

Example 7 with ArchiveEntry

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

the class GetPostsRequest 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("includePostContents")) {
        JsonElement jsonIncludePostContents = jsonObject.get("includePostContents");
        if (jsonIncludePostContents != null) {
            includePostContents = Boolean.valueOf(jsonIncludePostContents.getAsBoolean());
        }
    }
    if (jsonObject.has("tag")) {
        JsonElement jsonTag = jsonObject.get("tag");
        if (jsonTag != null) {
            tag = jsonTag.getAsString();
        }
    }
    if (jsonObject.has("archiveEntry")) {
        JsonElement jsonArchiveEntry = jsonObject.get("archiveEntry");
        if (jsonArchiveEntry != null) {
            archiveEntry = new ArchiveEntry();
            archiveEntry.fromJson(jsonArchiveEntry.getAsJsonObject());
        }
    }
    if (jsonObject.has("query")) {
        JsonElement jsonQuery = jsonObject.get("query");
        if (jsonQuery != null) {
            query = jsonQuery.getAsString();
        }
    }
    if (jsonObject.has("showAll")) {
        JsonElement jsonShowAll = jsonObject.get("showAll");
        if (jsonShowAll != null) {
            showAll = Boolean.valueOf(jsonShowAll.getAsBoolean());
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Pager(com.willshex.blogwt.shared.api.Pager) ArchiveEntry(com.willshex.blogwt.shared.api.datatype.ArchiveEntry)

Aggregations

ArchiveEntry (com.willshex.blogwt.shared.api.datatype.ArchiveEntry)7 Post (com.willshex.blogwt.shared.api.datatype.Post)3 JsonElement (com.google.gson.JsonElement)2 Key (com.googlecode.objectify.Key)2 Pager (com.willshex.blogwt.shared.api.Pager)2 Calendar (java.util.Calendar)2 Work (com.googlecode.objectify.Work)1 InputValidationException (com.willshex.gson.web.service.server.InputValidationException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1