use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class LogTaskDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Long id = handler.getLong("id");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(id)) {
LogTask 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<LogTask> entityList = service.getEntitys(ids);
Map<String, LogTask> map = new LinkedHashMap<>();
for (LogTask 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 SysRoleDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Integer id = handler.getInteger("id");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(id)) {
SysRole 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<SysRole> entityList = service.getEntitys(ids);
Map<String, SysRole> map = new LinkedHashMap<>();
for (SysRole 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 SysTaskDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
Integer id = handler.getInteger("id");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(id)) {
SysTask 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<SysTask> entityList = service.getEntitys(ids);
Map<String, SysTask> map = new LinkedHashMap<>();
for (SysTask 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 SysConfigDataDirective method execute.
@Override
public void execute(RenderHandler handler) throws IOException, Exception {
String code = handler.getString("code");
String[] codes = handler.getStringArray("codes");
SysSite site = getSite(handler);
if (CommonUtils.notEmpty(code)) {
SysConfigData entity = service.getEntity(new SysConfigDataId(site.getId(), code));
if (null != entity) {
handler.put("object", ExtendUtils.getExtendMap(entity.getData())).render();
}
} else if (CommonUtils.notEmpty(codes)) {
SysConfigDataId[] ids = new SysConfigDataId[codes.length];
int i = 0;
for (String s : codes) {
if (CommonUtils.notEmpty(s)) {
ids[i++] = new SysConfigDataId(site.getId(), s);
}
}
Map<String, Map<String, String>> map = new HashMap<>();
for (SysConfigData entity : service.getEntitys(ids)) {
map.put(entity.getId().getCode(), ExtendUtils.getExtendMap(entity.getData()));
}
handler.put("map", map).render();
}
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class SiteComponent method getSite.
/**
* @param serverName
* @return site
*/
public SysSite getSite(String serverName) {
SysSite site = siteCache.get(serverName);
if (null == site) {
site = sysSiteService.getEntity(getDomain(serverName).getSiteId());
siteCache.put(serverName, site);
}
return site;
}
Aggregations