/* ================================================================== * Created [2009-4-27 下午11:32:55] by Jon.King * ================================================================== * TSS * ================================================================== * mailTo:jinpujun@hotmail.com * Copyright (c) Jon.King, 2009-2012 * ================================================================== */ package com.jinhe.tss.component.recycle; import org.dom4j.Element; import com.jinhe.tss.core.util.BeanUtil; import com.jinhe.tss.core.web.dispaly.tree.ILevelTreeNode; import com.jinhe.tss.core.web.dispaly.tree.ITreeNode; import com.jinhe.tss.core.web.dispaly.tree.TreeAttributesMap; /** * <p> RecycleResource.java </p> * 回收站的垃圾资源类型,通常为一个实体类对应一种类型,比如用户类型。 * 通常的配置如下: * <resource id="21" entity="com.jinhe.tss.cms.entity.Channel" name="站点栏目" toRecycle="1" /> * * @author Jon.King 2008/04/14 10:28:03 */ public class RecycleResource implements ITreeNode { //基本属性 private Integer id; private String entity; // 实体类路径 private String name; // 实体名稱描述 private String beanId; // 執行刪除的dao bean private Integer toRecycle; // 是否执行回收站操作。 1:执行 0:不执行,直接执行正常的物理删除 public RecycleResource(Element resourceNode){ this.id = Integer.valueOf(resourceNode.attributeValue("id")); this.entity = resourceNode.attributeValue("entity"); this.name = resourceNode.attributeValue("name"); this.beanId = resourceNode.attributeValue("beanId"); this.toRecycle = Integer.valueOf(resourceNode.attributeValue("toRecycle")); } public Integer getId() { return id; } public String getName() { return name; } public String getEntity() { return entity; } public Integer getToRecycle() { return toRecycle; } public String getBeanId() { return beanId; } public TreeAttributesMap getAttributes() { return new TreeAttributesMap(id, name); } /** * 判断实体是不是多层结构的 * @param entityName 全路径名 * @return */ public boolean isMultiLayer(){ return BeanUtil.newInstanceByName(entity) instanceof ILevelTreeNode; } }