return ServiceResponse.createSuccessResponse(Messages.get("success"));
}
@Override
public ServiceResponse movePage(Long pageId, Long refPageId, String type) {
PageEntity page = getPageBusiness().getById(pageId);
if (page == null) {
return ServiceResponse.createErrorResponse(
Messages.get("page.not_found", pageId));
}
if (page.isRoot()) {
return ServiceResponse.createErrorResponse(
Messages.get("page.move_root"));
}
PageEntity refPage = getPageBusiness().getById(refPageId);
if (refPage == null) {
return ServiceResponse.createErrorResponse(
Messages.get("page.not_found", refPageId));
}
if (type.equals("inside")) {
String url = getBaseURL(refPage.getFriendlyURL()) + "/" +
page.getPageFriendlyURL();
getPageBusiness().move(page,
getPageBusiness().makeUniquePageURL(url));
}
if (type.equals("after")) {
String url = getBaseURL(refPage.getParentFriendlyURL()) + "/" +
page.getPageFriendlyURL();
getPageBusiness().move(page,
getPageBusiness().makeUniquePageURL(url));
page = getPageBusiness().getById(pageId);
getPageBusiness().moveAfter(page, refPage);
}
if (type.equals("before")) {
String url = getBaseURL(refPage.getParentFriendlyURL()) + "/" +
page.getPageFriendlyURL();
getPageBusiness().move(page,
getPageBusiness().makeUniquePageURL(url));
page = getPageBusiness().getById(pageId);
getPageBusiness().moveBefore(page, refPage);