use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.
the class StaticPage method appendPage.
/* (non-Javadoc)
*
* @see com.willshex.blogwt.server.page.StaticTemplate#appendPage(java.lang.
* StringBuffer) */
@Override
protected void appendPage(StringBuffer markup) {
Page page = ensurePage();
if (page != null && page.posts != null) {
for (Post post : page.posts) {
if (post.content != null && post.content.body != null) {
markup.append("<a name=\"!");
markup.append(page.slug);
markup.append("/");
markup.append(post.slug);
markup.append("\"></a>");
markup.append("<section><div>");
markup.append(process(post.content.body));
markup.append("</div></section>");
}
}
} else {
markup.append("Page not found.");
}
}
use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.
the class StaticPage method lookupPage.
private void lookupPage() {
GetPageRequest input = input(GetPageRequest.class).includePosts(Boolean.TRUE).page(new Page().slug(slug));
output = (new GetPageActionHandler()).handle(input);
}
use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.
the class StaticTemplate method appendNavigationLinks.
private void appendNavigationLinks(StringBuffer markup) {
List<Page> pages = PageServiceProvider.provide().getPages(Boolean.FALSE, Integer.valueOf(0), null, PageSortType.PageSortTypePriority, null);
if (pages != null) {
markup.append("<ul>");
for (Page page : pages) {
markup.append("<li><a href=\"/#!").append(page.slug).append("\" >").append(page.title).append("</a></li>");
}
markup.append("</ul>");
}
}
use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.
the class PageService method search.
/* (non-Javadoc)
*
* @see com.willshex.blogwt.server.service.search.ISearch#search(java.lang.
* String, java.lang.Integer, java.lang.Integer, java.lang.String,
* com.willshex.blogwt.shared.api.SortDirectionType) */
@Override
public List<Page> search(String query, Integer start, Integer count, String sortBy, SortDirectionType direction) {
Results<ScoredDocument> matches = SearchHelper.getIndex().search(query);
List<Page> pages = new ArrayList<Page>();
String id;
Page page;
int limit = count;
final String pageServiceName = getName();
for (ScoredDocument scoredDocument : matches) {
if (limit == 0) {
break;
}
if ((id = scoredDocument.getId()).startsWith(getName())) {
page = getPage(Long.valueOf(id.replace(pageServiceName, "")));
if (page != null) {
pages.add(page);
}
}
limit--;
}
return pages;
}
use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.
the class PageService method addPage.
@Override
public Page addPage(Page page) {
if (page.created == null) {
page.created = new Date();
}
page.ownerKey = Key.create(page.owner);
page.postKeys = new ArrayList<Key<Post>>();
for (Post post : page.posts) {
page.postKeys.add(Key.create(post));
}
if (page.parent != null) {
page.parentKey = Key.create(page.parent);
}
Key<Page> key = provide().save().entity(page).now();
page.id = keyToId(key);
SearchHelper.queueToIndex(getName(), page.id);
return page;
}
Aggregations