use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class CmsCategoryTypeDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Integer id = handler.getInteger("id");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(id)) {
CmsCategoryType entity = service.getEntity(id);
if (null != entity && site.getId() == entity.getSiteId()) {
handler.put("object", entity).render();
}
} else {
Integer[] ids = handler.getIntegerArray("ids");
if (CommonUtils.notEmpty(ids)) {
List<CmsCategoryType> entityList = service.getEntitys(ids);
Map<String, CmsCategoryType> map = new LinkedHashMap<>();
for (CmsCategoryType entity : entityList) {
if (site.getId() == entity.getSiteId()) {
map.put(String.valueOf(entity.getId()), entity);
}
}
handler.put("map", map).render();
}
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class CmsFacetSearchDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
String word = handler.getString("word");
Long[] tagIds = handler.getLongArray("tagId");
if (CommonUtils.notEmpty(word) || CommonUtils.notEmpty(tagIds)) {
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(word)) {
statisticsComponent.search(site.getId(), word);
}
if (CommonUtils.notEmpty(tagIds)) {
for (Long tagId : tagIds) {
statisticsComponent.searchTag(tagId);
}
}
PageHandler page;
Integer pageIndex = handler.getInteger("pageIndex", 1);
Integer count = handler.getInteger("count", 30);
try {
page = service.facetQuery(site.getId(), handler.getStringArray("categoryId"), handler.getStringArray("modelId"), word, tagIds, handler.getDate("startPublishDate"), handler.getDate("endPublishDate", CommonUtils.getDate()), pageIndex, count);
} catch (Exception e) {
page = new FacetPageHandler(pageIndex, count, 0, null);
}
handler.put("page", page).render();
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class CmsModelDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
String id = handler.getString("id");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(id)) {
CmsModel entity = modelComponent.getMap(site).get(id);
if (null != entity) {
handler.put("object", entity).render();
}
} else {
String[] ids = handler.getStringArray("ids");
if (CommonUtils.notEmpty(ids)) {
Map<String, CmsModel> modelMap = modelComponent.getMap(site);
Map<String, CmsModel> map = new LinkedHashMap<>();
for (String modelId : ids) {
map.put(modelId, modelMap.get(modelId));
}
handler.put("map", map).render();
}
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class CmsPlaceDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Long id = handler.getLong("id");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(id)) {
CmsPlace entity = service.getEntity(id);
if (null != entity && site.getId() == entity.getSiteId()) {
handler.put("object", entity).render();
}
} else {
Long[] ids = handler.getLongArray("ids");
if (CommonUtils.notEmpty(ids)) {
List<CmsPlace> entityList = service.getEntitys(ids);
Map<String, CmsPlace> map = new LinkedHashMap<>();
for (CmsPlace entity : entityList) {
if (site.getId() == entity.getSiteId()) {
map.put(String.valueOf(entity.getId()), entity);
}
}
handler.put("map", map).render();
}
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class LogOperateDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Long id = handler.getLong("id");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(id)) {
LogOperate entity = service.getEntity(id);
if (null != entity && site.getId() == entity.getSiteId()) {
handler.put("object", entity).render();
}
} else {
Long[] ids = handler.getLongArray("ids");
if (CommonUtils.notEmpty(ids)) {
List<LogOperate> entityList = service.getEntitys(ids);
Map<String, LogOperate> map = new LinkedHashMap<>();
for (LogOperate entity : entityList) {
if (site.getId() == entity.getSiteId()) {
map.put(String.valueOf(entity.getId()), entity);
}
}
handler.put("map", map).render();
}
}
}
Aggregations