/* ==================================================================
* 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.dynproperty.entity;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import com.jinhe.tss.component.dynproperty.DynConstants;
import com.jinhe.tss.core.persistence.IEntity;
import com.jinhe.tss.core.web.dispaly.tree.ITreeNode;
import com.jinhe.tss.core.web.dispaly.tree.TreeAttributesMap;
import com.jinhe.tss.core.web.dispaly.xform.IXForm;
/**
* <p> GridTemplate.java </p>
*
* @author Jon.King 2008/04/14 10:18:10
*
* 唯一索引:entityCode, code
*/
@Entity
@Table(name = "component_dyn_gridTemplate", uniqueConstraints = {
@UniqueConstraint(name="MULTI_CODE_GRID_TEMPLATE", columnNames = { "entityCode", "code" }),
@UniqueConstraint(name="MULTI_NAME_GRID_TEMPLATE", columnNames = { "entityCode", "name" })
})
@SequenceGenerator(name = "dyn_gt_sequence", sequenceName = "dyn_def_sequence", initialValue = 1000, allocationSize = 10)
public class GridTemplate implements IEntity, IXForm, ITreeNode{
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "dyn_gt_sequence")
private Long id;
private String name; // Grid模板的名称
private String entityCode; // 对应的DynableEntity
private String code; // 同个entityCode下唯一,用于唯一指定动态实体的一组Grid模板
@Column(length = 4000)
private String declare; // 生成的Grid 模板<declare/>节点 VARCHAR2(4000)
@Column(length = 2000)
private String requiredProperties; //必选的属性列表,以","隔开
public TreeAttributesMap getAttributes() {
TreeAttributesMap map = new TreeAttributesMap(id, name);
map.put("entityCode", this.entityCode);
map.put("code", this.code);
map.put("type", "" + DynConstants.GRID_TEMPLATE_TYPE);
return map;
}
public Map<String, Object> getAttributesForXForm() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", this.id);
map.put("name", this.name);
map.put("declare", this.declare);
map.put("code", this.code);
map.put("entityCode", this.entityCode);
map.put("requiredProperties", this.requiredProperties);
return map;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEntityCode() {
return entityCode;
}
public void setEntityCode(String entityCode) {
this.entityCode = entityCode;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDeclare() {
return declare;
}
public void setDeclare(String declare) {
this.declare = declare;
}
public String getRequiredProperties() {
return requiredProperties;
}
public void setRequiredProperties(String requiredProperties) {
this.requiredProperties = requiredProperties;
}
}