use of com.willshex.blogwt.shared.api.Pager in project blogwt by billy1380.
the class PageService method indexAll.
/* (non-Javadoc)
*
* @see com.willshex.blogwt.server.service.search.IIndex#indexAll() */
@Override
public void indexAll() {
Pager pager = PagerHelper.createDefaultPager();
List<Page> pages = null;
do {
pages = getPages(Boolean.FALSE, pager.start, pager.count, null, null);
for (Page page : pages) {
SearchHelper.queueToIndex(getName(), page.id);
}
PagerHelper.moveForward(pager);
} while (pages != null && pages.size() >= pager.count.intValue());
}
use of com.willshex.blogwt.shared.api.Pager in project blogwt by billy1380.
the class PostService method indexAll.
/* (non-Javadoc)
*
* @see com.willshex.blogwt.server.service.search.IIndex#indexAll() */
@Override
public void indexAll() {
Pager pager = PagerHelper.createDefaultPager();
List<Post> posts = null;
do {
posts = getPosts(Boolean.FALSE, Boolean.FALSE, pager.start, pager.count, null, null);
for (Post post : posts) {
SearchHelper.queueToIndex(getName(), post.id);
}
PagerHelper.moveForward(pager);
} while (posts != null && posts.size() >= pager.count.intValue());
}
use of com.willshex.blogwt.shared.api.Pager in project blogwt by billy1380.
the class PostService method clearLinks.
/* (non-Javadoc)
*
* @see com.willshex.blogwt.server.service.post.IPostService#clearLinks() */
@Override
public void clearLinks() {
Pager pager = PagerHelper.createDefaultPager();
List<Post> posts = null;
do {
posts = getPosts(Boolean.FALSE, Boolean.FALSE, pager.start, pager.count, PostSortType.PostSortTypePublished, SortDirectionType.SortDirectionTypeDescending);
if (posts != null) {
for (Post post : posts) {
post.nextSlug = null;
post.previousSlug = null;
}
provide().save().entities(posts).now();
}
PagerHelper.moveForward(pager);
} while (posts != null && posts.size() >= pager.count.intValue());
}
use of com.willshex.blogwt.shared.api.Pager in project blogwt by billy1380.
the class TagService method generateTags.
/* (non-Javadoc)
*
* @see com.willshex.blogwt.server.service.tag.ITagService#generateTags() */
@Override
public void generateTags() {
Map<String, Tag> tagLookup = new HashMap<String, Tag>();
List<Post> posts;
Tag tag;
Pager pager = PagerHelper.createDefaultPager();
do {
posts = PostServiceProvider.provide().getPosts(Boolean.FALSE, Boolean.FALSE, pager.start, pager.count, PostSortType.PostSortTypePublished, SortDirectionType.SortDirectionTypeDescending);
if (posts != null) {
PagerHelper.moveForward(pager);
for (Post post : posts) {
if (post.tags != null) {
for (String postTag : post.tags) {
tag = tagLookup.get(postTag.toLowerCase());
if (tag == null) {
tag = new Tag().name(postTag.toLowerCase()).posts(new ArrayList<Post>());
tagLookup.put(tag.name, tag);
}
tag.posts.add(post);
}
}
}
}
} while (posts != null && posts.size() >= pager.count.intValue());
if (tagLookup.size() > 0) {
addTagBatch(tagLookup.values());
}
}
use of com.willshex.blogwt.shared.api.Pager 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());
}
}
}
Aggregations