Search in sources :

Example 91 with SysSite

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();
        }
    }
}
Also used : SysSite(com.publiccms.entities.sys.SysSite) LogTask(com.publiccms.entities.log.LogTask) LinkedHashMap(java.util.LinkedHashMap)

Example 92 with SysSite

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();
        }
    }
}
Also used : SysRole(com.publiccms.entities.sys.SysRole) SysSite(com.publiccms.entities.sys.SysSite) LinkedHashMap(java.util.LinkedHashMap)

Example 93 with SysSite

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();
        }
    }
}
Also used : SysTask(com.publiccms.entities.sys.SysTask) SysSite(com.publiccms.entities.sys.SysSite) LinkedHashMap(java.util.LinkedHashMap)

Example 94 with SysSite

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();
    }
}
Also used : SysConfigData(com.publiccms.entities.sys.SysConfigData) SysConfigDataId(com.publiccms.entities.sys.SysConfigDataId) HashMap(java.util.HashMap) Map(java.util.Map) SysSite(com.publiccms.entities.sys.SysSite)

Example 95 with SysSite

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;
}
Also used : SysSite(com.publiccms.entities.sys.SysSite)

Aggregations

SysSite (com.publiccms.entities.sys.SysSite)175 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)135 LogOperate (com.publiccms.entities.log.LogOperate)117 IOException (java.io.IOException)33 SysUser (com.publiccms.entities.sys.SysUser)21 LinkedHashMap (java.util.LinkedHashMap)19 TemplateException (freemarker.template.TemplateException)15 File (java.io.File)14 CmsContent (com.publiccms.entities.cms.CmsContent)12 CmsCategory (com.publiccms.entities.cms.CmsCategory)11 MultipartFile (org.springframework.web.multipart.MultipartFile)10 SysTask (com.publiccms.entities.sys.SysTask)9 HashMap (java.util.HashMap)8 LogUpload (com.publiccms.entities.log.LogUpload)7 SysDept (com.publiccms.entities.sys.SysDept)7 SysUserToken (com.publiccms.entities.sys.SysUserToken)7 CmsPlaceMetadata (com.publiccms.views.pojo.entities.CmsPlaceMetadata)7 CmsPageMetadata (com.publiccms.views.pojo.entities.CmsPageMetadata)6 CmsPlace (com.publiccms.entities.cms.CmsPlace)5 SysDomain (com.publiccms.entities.sys.SysDomain)5