Search in sources :

Example 6 with CmsContent

use of com.publiccms.entities.cms.CmsContent in project PublicCMS-preview by sanluan.

the class CmsContentBridge method set.

@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
    CmsContent content = (CmsContent) value;
    CmsContentAttribute entity = BeanComponent.getContentAttributeService().getEntity(content.getId());
    if (null != entity) {
        content.setDescription(content.getDescription() + entity.getText());
    }
}
Also used : CmsContent(com.publiccms.entities.cms.CmsContent) CmsContentAttribute(com.publiccms.entities.cms.CmsContentAttribute)

Example 7 with CmsContent

use of com.publiccms.entities.cms.CmsContent in project PublicCMS-preview by sanluan.

the class CmsContentService method updateUrl.

/**
 * @param id
 * @param url
 * @param hasStatic
 * @return result
 */
public CmsContent updateUrl(Serializable id, String url, boolean hasStatic) {
    CmsContent entity = getEntity(id);
    if (null != entity) {
        entity.setUrl(url);
        entity.setHasStatic(hasStatic);
    }
    return entity;
}
Also used : CmsContent(com.publiccms.entities.cms.CmsContent)

Example 8 with CmsContent

use of com.publiccms.entities.cms.CmsContent in project PublicCMS-preview by sanluan.

the class CmsContentService method delete.

/**
 * @param siteId
 * @param ids
 * @return list of data deleted
 */
@SuppressWarnings("unchecked")
public List<CmsContent> delete(short siteId, Serializable[] ids) {
    List<CmsContent> entityList = new ArrayList<>();
    for (CmsContent entity : getEntitys(ids)) {
        if (siteId == entity.getSiteId() && !entity.isDisabled()) {
            if (0 < entity.getChilds()) {
                for (CmsContent child : (List<CmsContent>) getPage(new CmsContentQuery(siteId, null, null, null, null, null, entity.getId(), null, null, null, null, null, null, null, null), null, null, null, null, null).getList()) {
                    child.setDisabled(true);
                    entityList.add(child);
                }
            }
            entity.setDisabled(true);
            entityList.add(entity);
        }
    }
    return entityList;
}
Also used : CmsContent(com.publiccms.entities.cms.CmsContent) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CmsContentQuery(com.publiccms.views.pojo.query.CmsContentQuery)

Example 9 with CmsContent

use of com.publiccms.entities.cms.CmsContent in project PublicCMS-preview by sanluan.

the class CmsContentService method uncheck.

/**
 * @param siteId
 * @param userId
 * @param ids
 * @return results list
 */
public List<CmsContent> uncheck(short siteId, Long userId, Serializable[] ids) {
    List<CmsContent> entityList = new ArrayList<>();
    for (CmsContent entity : getEntitys(ids)) {
        if (null != entity && siteId == entity.getSiteId() && STATUS_NORMAL == entity.getStatus()) {
            entity.setStatus(STATUS_PEND);
            entityList.add(entity);
        }
    }
    return entityList;
}
Also used : CmsContent(com.publiccms.entities.cms.CmsContent) ArrayList(java.util.ArrayList)

Example 10 with CmsContent

use of com.publiccms.entities.cms.CmsContent in project PublicCMS-preview by sanluan.

the class CmsContentService method refresh.

/**
 * @param siteId
 * @param ids
 */
public void refresh(short siteId, Serializable[] ids) {
    List<CmsContent> list = getEntitys(ids);
    Collections.reverse(list);
    for (CmsContent entity : list) {
        if (null != entity && STATUS_NORMAL == entity.getStatus() && siteId == entity.getSiteId()) {
            Date now = CommonUtils.getDate();
            if (now.after(entity.getPublishDate())) {
                entity.setPublishDate(now);
            }
        }
    }
}
Also used : CmsContent(com.publiccms.entities.cms.CmsContent) Date(java.util.Date)

Aggregations

CmsContent (com.publiccms.entities.cms.CmsContent)20 SysSite (com.publiccms.entities.sys.SysSite)12 LogOperate (com.publiccms.entities.log.LogOperate)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9 CmsCategory (com.publiccms.entities.cms.CmsCategory)6 ArrayList (java.util.ArrayList)4 SysUser (com.publiccms.entities.sys.SysUser)3 Date (java.util.Date)3 CmsCategoryModel (com.publiccms.entities.cms.CmsCategoryModel)2 CmsCategoryModelId (com.publiccms.entities.cms.CmsCategoryModelId)2 SysExtendField (com.publiccms.entities.sys.SysExtendField)2 CmsModel (com.publiccms.views.pojo.entities.CmsModel)2 ExtendField (com.publiccms.views.pojo.entities.ExtendField)2 CmsContentQuery (com.publiccms.views.pojo.query.CmsContentQuery)2 HashSet (java.util.HashSet)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 CmsContentAttribute (com.publiccms.entities.cms.CmsContentAttribute)1 SysDept (com.publiccms.entities.sys.SysDept)1 SysDeptCategoryId (com.publiccms.entities.sys.SysDeptCategoryId)1