use of com.willshex.blogwt.shared.api.datatype.Post in project blogwt by billy1380.
the class TagService method addTag.
@Override
public Tag addTag(Tag tag) {
if (tag.created == null) {
tag.created = new Date();
}
tag.name = tag.name.toLowerCase();
tag.slug = PostHelper.slugify(tag.name);
if (tag.posts != null) {
for (Post post : tag.posts) {
if (tag.postKeys == null) {
tag.postKeys = new ArrayList<Key<Post>>();
}
tag.postKeys.add(Key.create(post));
}
}
Key<Tag> key = provide().save().entity(tag).now();
tag.id = keyToId(key);
return tag;
}
use of com.willshex.blogwt.shared.api.datatype.Post in project blogwt by billy1380.
the class CreatePostResponse 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());
}
}
}
use of com.willshex.blogwt.shared.api.datatype.Post in project blogwt by billy1380.
the class DeletePostRequest 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());
}
}
}
use of com.willshex.blogwt.shared.api.datatype.Post in project blogwt by billy1380.
the class GetPostRequest 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());
}
}
}
use of com.willshex.blogwt.shared.api.datatype.Post 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());
}
}
}
Aggregations