/* ==================================================================
* 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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.Transient;
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> XFormTemplate.java </p>
* <p> Xform模板 </p>
*
* @author Jon.King 2008/04/14
*
* 唯一索引:entityCode, code
*/
@Entity
@Table(name = "component_dyn_xformTemplate", uniqueConstraints = {
@UniqueConstraint(name="MULTI_CODE_XFORM_TEMPLATE", columnNames = { "entityCode", "code" }),
@UniqueConstraint(name="MULTI_NAME_XFORM_TEMPLATE", columnNames = { "entityCode", "name" })
})
@SequenceGenerator(name = "dyn_xt_sequence", sequenceName = "dyn_xt_sequence", initialValue = 1000, allocationSize = 10)
public class XFormTemplate implements IEntity, IXForm, ITreeNode{
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "dyn_xt_sequence")
private Long id;
private String name; //Xform模板的名称
private String entityCode; //对应的DynableEntity
private String code; //同个entityCode下唯一,用于唯一指定动态实体的一组Xform表单
private String isQueryForm = "0"; //查询方式 0:实体编辑表单 1:查询输入表单
@Transient
private List<XFormTemplateTab> tabs = new ArrayList<XFormTemplateTab>(); //属于该XForm模板的所有tab页
public List<XFormTemplateTab> getTabs() {
return this.tabs;
}
public TreeAttributesMap getAttributes() {
TreeAttributesMap map = new TreeAttributesMap(id, name);
map.put("isQueryForm", this.isQueryForm);
map.put("entityCode", this.entityCode);
map.put("code", this.code);
map.put("type", DynConstants.XFORM_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("code", this.code);
map.put("entityCode", this.entityCode);
map.put("isQueryForm", this.isQueryForm);
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 getIsQueryForm() {
return isQueryForm;
}
public void setIsQueryForm(String isQueryForm) {
this.isQueryForm = isQueryForm;
}
public void setTabs(List<XFormTemplateTab> tabs) {
this.tabs = tabs;
}
}