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());
}
}
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;
}
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;
}
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;
}
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);
}
}
}
}
Aggregations