EntityNoName
- 目录
- 概述
- 需求:
- 设计思路
- 实现思路分析
- 1.code:
- 2.code2:
- 3.FLows
- 4.frm
- 5.code3:
- code4:
- EntityTreeAttr
- EntitiesNoName
- enum:
- JUmp way
- 参考资料和推荐阅读
Survive by day and develop by night.
talk for import biz , show your perfect code,full busy,skip hardness,make a better result,wait for change,challenge Survive.
happy for hardess to solve denpendies.
目录
概述
需求:
设计思路
实现思路分析
1.code:
package bp.wf.admin;
import bp.da.*;
import bp.en.Map;
import bp.port.*;
import bp.en.*;
import bp.web.*;
import bp.sys.*;
import bp.wf.data.*;
import bp.wf.template.frm.*;
/**
流程
*/
public class Flow extends EntityNoName
{
///#region 属性.
/**
存储表
*/
public final String getPTable()
{
return this.GetValStringByKey(FlowAttr.PTable);
}
public final void setPTable(String value)
{
this.SetValByKey(FlowAttr.PTable, value);
}
/**
流程类别
*/
public final String getFKFlowSort()
{
return this.GetValStringByKey(FlowAttr.FK_FlowSort);
}
public final void setFKFlowSort(String value)
{
this.SetValByKey(FlowAttr.FK_FlowSort, value);
}
/**
是否可以独立启动
*/
public final boolean isCanStart()
{
return this.GetValBooleanByKey(FlowAttr.IsCanStart);
}
public final void setCanStart(boolean value)
{
this.SetValByKey(FlowAttr.IsCanStart, value);
}
/**
流程事件实体
*/
public final String getFlowEventEntity()
{
return this.GetValStringByKey(FlowAttr.FlowEventEntity);
}
public final void setFlowEventEntity(String value)
{
this.SetValByKey(FlowAttr.FlowEventEntity, value);
}
///#endregion 属性.
///#region 构造方法
/**
UI界面上的访问控制
*/
@Override
public UAC getHisUAC()
{
UAC uac = new UAC();
if (WebUser.getIsAdmin() == false)
{
throw new RuntimeException("err@管理员登录用户信息丢失,当前会话[" + WebUser.getNo() + "," + WebUser.getName() + "]");
}
uac.IsUpdate = true;
uac.IsDelete = false;
uac.IsInsert = false;
return uac;
}
/**
流程
*/
public Flow()
{
}
/**
重写基类方法
*/
@Override
public Map getEnMap()
{
if (this.get_enMap() != null)
{
return this.get_enMap();
}
Map map = new Map("WF_Flow", "流程模版");
///#region 基本属性。
//处理流程类别.
String sql = "";
if (bp.difference.SystemConfig.getCCBPMRunModel() == CCBPMRunModel.Single)
{
map.AddDDLEntities(FlowAttr.FK_FlowSort, null, "类别", new FlowSorts(), true);
}
else
{
sql = "SELECT No,Name FROM WF_FlowSort WHERE OrgNo='@WebUser.OrgNo' ORDER BY No,Idx";
map.AddDDLSQL(FlowAttr.FK_FlowSort, null, "类别", sql, true);
map.AddTBString(FlowAttr.OrgNo, null, "组织编号", false, false, 0, 50, 10, false);
map.AddHidden(FlowAttr.OrgNo, " = ", bp.web.WebUser.getOrgNo());
}
map.AddTBStringPK(FlowAttr.No, null, "编号", true, true, 1, 4, 3);
map.SetHelperUrl(FlowAttr.No, "https://gitee.com/opencc/JFlow/wikis/pages/preview?sort_id=3661868&doc_id=31094"); //使用alert的方式显示帮助信息.
map.AddTBString(FlowAttr.Name, null, "名称", true, false, 0, 50, 300);
//add 2013-08-30.
map.AddTBString(FlowAttr.BillNoFormat, null, "单号格式", true, false, 0, 50, 10, false);
map.SetHelperUrl(FlowAttr.BillNoFormat, "https://gitee.com/opencc/JFlow/wikis/pages/preview?sort_id=3953012&doc_id=31094");
map.AddTBString(FlowAttr.FlowEventEntity, null, "事件实体", true, true, 0, 150, 30);
map.SetHelperUrl(FlowAttr.FlowEventEntity, "https://gitee.com/opencc/JFlow/wikis/pages/preview?sort_id=3661871&doc_id=31094");
map.AddTBString(FlowAttr.PTable, null, "存储表", true, false, 0, 30, 10);
map.SetHelperUrl(FlowAttr.PTable, "https://gitee.com/opencc/JFlow/wikis/pages/preview?sort_id=4000827&doc_id=31094");
// add 2013-02-05.
map.AddTBString(FlowAttr.TitleRole, null, "标题生成规则", true, false, 0, 150, 10, true);
map.SetHelperUrl(FlowAttr.TitleRole, "https://gitee.com/opencc/JFlow/wikis/pages/preview?sort_id=3661872&doc_id=31094");
map.AddBoolean(FlowAttr.IsCanStart, true, "独立启动?", true, true);
//map.AddBoolean(FlowAttr.IsCanStart, true, "可以独立启动否?(独立启动的流程可以显示在发起流程列表里)", true, true, true);
//map.SetHelperUrl(FlowAttr.IsCanStart, "https://gitee.com/opencc/JFlow/wikis/pages/preview?sort_id=3661874&doc_id=31094");
// // 草稿
map.AddDDLSysEnum(FlowAttr.Draft, 0, "草稿规则", true, true, FlowAttr.Draft, "@0=无(不设草稿)@1=保存到待办@2=保存到草稿箱");
map.SetHelperUrl(FlowAttr.Draft, "https://gitee.com/opencc/JFlow/wikis/pages/preview?sort_id=3661878&doc_id=31094");
///#endregion 基本属性。
map.AddTBDateTime(FlowAttr.DesignTime, null, "创建时间", true, true);
map.AddTBString(FlowAttr.OrgNo, null, "组织编号", false, false, 0, 50, 10, false);
//查询.
map.AddSearchAttr(FlowAttr.FK_FlowSort);
///#region 流程模版管理.
RefMethod rm = new RefMethod();
rm.Title = "流程模版";
rm.Icon = "../../WF/Img/undo.png";
rm.ClassMethodName = this.toString() + ".DoExps()";
rm.refMethodType = RefMethodType.RightFrameOpen;
rm.Icon = "icon-paper-plane";
map.AddRefMethod(rm);
rm = new RefMethod();
rm.Icon = "../../WF/Img/Btn/DTS.gif";
rm.Title = "重生成报表数据"; // "删除数据";
rm.Warning = "您确定要执行吗? 注意:此方法耗费资源。"; // "您确定要执行删除流程数据吗?";
rm.ClassMethodName = this.toString() + ".DoReloadRptData";
rm.GroupName = "流程维护";
rm.Icon = "icon-briefcase";
map.AddRefMethod(rm);
rm = new RefMethod();
rm.Title = "重生成流程标题";
rm.Icon = "../../WF/Img/Btn/DTS.gif";
rm.ClassMethodName = this.toString() + ".DoGenerTitle()";
//设置相关字段.
//rm.RefAttrKey = FlowAttr.TitleRole;
rm.RefAttrLinkLabel = "重新生成流程标题";
rm.refMethodType = RefMethodType.Func;
rm.Target = "_blank";
rm.Warning = "您确定要根据新的规则重新产生标题吗?";
rm.GroupName = "流程维护";
rm.Icon = "icon-briefcase";
map.AddRefMethod(rm);
rm = new RefMethod();
rm.Title = "重生成FlowEmps字段";
rm.Icon = "../../WF/Img/Btn/DTS.gif";
rm.ClassMethodName = this.toString() + ".DoGenerFlowEmps()";
rm.RefAttrLinkLabel = "补充修复emps字段,包括wf_generworkflow,NDxxxRpt字段.";
rm.refMethodType = RefMethodType.Func;
rm.Target = "_blank";
rm.Warning = "您确定要重新生成吗?";
rm.GroupName = "流程维护";
rm.Icon = "icon-briefcase";
map.AddRefMethod(rm);
//带有参数的方法.
rm = new RefMethod();
rm.GroupName = "流程维护";
rm.Title = "删除指定日期范围内的流程";
rm.Warning = "您确定要删除吗?";
rm.Icon = "../../WF/Img/Btn/Delete.gif";
rm.getHisAttrs().AddTBDateTime("DTFrom", null, "时间从", true, false);
rm.getHisAttrs().AddTBDateTime("DTTo", null, "时间到", true, false);
rm.getHisAttrs().AddBoolen("thisFlowOnly", true, "仅仅当前流程");
rm.Icon = "icon-briefcase";
rm.ClassMethodName = this.toString() + ".DoDelFlows";
map.AddRefMethod(rm);
rm = new RefMethod();
rm.Icon = "../../WF/Img/Btn/Delete.gif";
rm.Title = "按工作ID删除"; // this.ToE("DelFlowData", "删除数据"); // "删除数据";
rm.GroupName = "流程维护";
rm.ClassMethodName = this.toString() + ".DoDelDataOne";
rm.getHisAttrs().AddTBInt("WorkID", 0, "输入工作ID", true, false);
rm.getHisAttrs().AddTBString("beizhu", null, "删除备注", true, false, 0, 100, 100);
rm.Icon = "icon-briefcase";
map.AddRefMethod(rm);
//带有参数的方法.
rm = new RefMethod();
rm.GroupName = "流程维护";
rm.Title = "强制设置接收人";
rm.getHisAttrs().AddTBInt("WorkID", 0, "输入工作ID", true, false);
rm.getHisAttrs().AddTBInt("NodeID", 0, "节点ID", true, false);
rm.getHisAttrs().AddTBString("Worker", null, "接受人编号", true, false, 0, 100, 100);
rm.Icon = "icon-briefcase";
rm.ClassMethodName = this.toString() + ".DoSetTodoEmps";
map.AddRefMethod(rm);
rm = new RefMethod();
rm.Title = "按工作ID强制结束"; // this.ToE("DelFlowData", "删除数据"); // "删除数据";
rm.GroupName = "流程维护";
rm.ClassMethodName = this.toString() + ".DoStopFlow";
rm.getHisAttrs().AddTBInt("WorkID", 0, "输入工作ID", true, false);
rm.Icon = "icon-briefcase";
rm.getHisAttrs().AddTBString("beizhu", null, "备注", true, false, 0, 100, 100);
map.AddRefMethod(rm);
rm = new RefMethod();
rm.Title = "回滚流程";
rm.Icon = "../../WF/Img/Btn/Back.png";
rm.ClassMethodName = this.toString() + ".DoRebackFlowData()";
// rm.Warning = "您确定要回滚它吗?";
rm.getHisAttrs().AddTBInt("workid", 0, "请输入要会滚WorkID", true, false);
rm.getHisAttrs().AddTBInt("nodeid", 0, "回滚到的节点ID", true, false);
rm.getHisAttrs().AddTBString("note", null, "回滚原因", true, false, 0, 600, 200);
rm.Icon = "icon-briefcase";
rm.GroupName = "流程维护";
map.AddRefMethod(rm);
///#endregion 流程运行维护.
this.set_enMap(map);
return this.get_enMap();
}
///#endregion
public final String DoExps()
{
return "../../Admin/AttrFlow/Exp.htm?FK_Flow=" + this.getNo() + "&Lang=CH";
}
}
2.code2:
package bp.wf.admin;
import bp.da.*;
import bp.port.*;
import bp.en.*;
import bp.web.*;
import bp.sys.*;
import bp.wf.data.*;
import bp.wf.template.frm.*;
import java.util.*;
public class FlowAttr extends bp.wf.template.FlowAttr
{
}
3.FLows
4.frm
package bp.wf.admin;
import bp.da.*;
import bp.en.Map;
import bp.port.*;
import bp.en.*;
import bp.web.*;
import bp.sys.*;
import bp.wf.data.*;
import bp.wf.template.frm.*;
import java.util.*;
/**
流程
*/
public class Frm extends EntityNoName
{
///#region 属性.
/**
存储表
*/
public final String getPTable()
{
return this.GetValStringByKey(FrmAttr.PTable);
}
public final void setPTable(String value)
{
this.SetValByKey(FrmAttr.PTable, value);
}
///#endregion 属性.
///#region 构造方法
/**
UI界面上的访问控制
*/
@Override
public UAC getHisUAC()
{
UAC uac = new UAC();
if (WebUser.getIsAdmin() == false)
{
throw new RuntimeException("err@管理员登录用户信息丢失,当前会话[" + WebUser.getNo() + "," + WebUser.getName() + "]");
}
uac.IsUpdate = true;
uac.IsDelete = false;
uac.IsInsert = false;
return uac;
}
/**
流程
*/
public Frm()
{
}
/**
重写基类方法
*/
@Override
public Map getEnMap()
{
if (this.get_enMap() != null)
{
return this.get_enMap();
}
Map map = new Map("Sys_MapData", "傻瓜表单属性");
///#region 基本属性.
map.AddTBStringPK(MapDataAttr.No, null, "表单编号", true, true, 1, 190, 20);
if (bp.wf.Glo.getCCBPMRunModel() == CCBPMRunModel.SAAS)
{
map.AddTBString(MapDataAttr.PTable, null, "存储表", false, false, 0, 100, 20);
}
else
{
map.AddTBString(MapDataAttr.PTable, null, "存储表", true, false, 0, 100, 20);
String msg = "提示:";
msg += "\t\n1. 该表单把数据存储到那个表里.";
msg += "\t\n2. 该表必须有一个int64未的OID列作为主键..";
msg += "\t\n3. 如果指定了一个不存在的表,系统就会自动创建上.";
map.SetHelperAlert(MapDataAttr.PTable, msg);
}
map.AddTBString(MapDataAttr.Name, null, "名称", true, false, 0, 500, 20, true);
map.AddTBInt(MapDataAttr.TableCol, 0, "显示列数", false, false);
map.AddTBInt(MapDataAttr.FrmW, 900, "表单宽度", true, false);
if (bp.wf.Glo.getCCBPMRunModel() == CCBPMRunModel.SAAS)
{
}
else
{
map.AddTBString(MapDataAttr.DBSrc, null, "数据源", false, false, 0, 500, 20);
map.AddDDLEntities(MapDataAttr.FK_FormTree, "01", "目录", new FrmSorts(), true);
}
//表单的运行类型.
map.AddDDLSysEnum(MapDataAttr.FrmType, FrmType.FoolForm.getValue(), "表单类型", true, true, MapDataAttr.FrmType);
//表单解析 0 普通 1 页签展示
map.AddDDLSysEnum(MapDataAttr.FrmShowType, 0, "表单展示方式", true, true, "表单展示方式", "@0=普通方式@1=页签方式");
map.AddTBString(MapDataAttr.Icon, "icon-doc", "图标", true, false, 0, 100, 100);
map.AddBoolean("IsEnableJs", false, "是否启用自定义js函数?", true, true, true);
///#endregion 基本属性.
///#region 设计者信息.
map.AddTBString(MapDataAttr.Designer, null, "设计者", true, false, 0, 500, 20);
map.AddTBString(MapDataAttr.DesignerContact, null, "联系方式", true, false, 0, 500, 20);
map.AddTBString(MapDataAttr.DesignerUnit, null, "单位", true, false, 0, 500, 20, true);
map.AddTBString(MapDataAttr.GUID, null, "GUID", true, true, 0, 128, 20, false);
map.AddTBString(MapDataAttr.Ver, null, "版本号", true, true, 0, 30, 20);
map.AddTBString(MapDataAttr.Note, null, "备注", true, false, 0, 400, 100, true);
//增加参数字段.
map.AddTBAtParas(4000);
map.AddTBInt(MapDataAttr.Idx, 100, "顺序号", false, false);
///#endregion 设计者信息.
map.AddSearchAttr(MapDataAttr.FK_FormTree);
this.set_enMap(map);
return this.get_enMap();
}
///#endregion
}
5.code3:
package bp.wf.admin;
import bp.da.*;
import bp.port.*;
import bp.en.*;
import bp.web.*;
import bp.sys.*;
import bp.wf.data.*;
import bp.wf.template.frm.*;
import java.util.*;
/**
流程集合
*/
public class Frms extends EntitiesNoName
{
///#region 构造方法
/**
工作流程
*/
public Frms()
{
}
///#endregion
///#region 得到实体
/**
得到它的 Entity
*/
@Override
public Entity getGetNewEntity()
{
return new Frm();
}
///#endregion
///#region 为了适应自动翻译成java的需要,把实体转换成List.
/**
转化成 java list,C#不能调用.
@return List
*/
public final List<Frm> ToJavaList()
{
return (List<Frm>)(Object)this;
}
/**
转化成list
@return List
*/
public final ArrayList<Frm> Tolist()
{
ArrayList<Frm> list = new ArrayList<Frm>();
for (int i = 0; i < this.size(); i++)
{
list.add((Frm)this.get(i));
}
return list;
}
///#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
code4:
package bp.wf.admin;
import bp.da.*;
import bp.en.*;
import bp.en.Map;
import bp.port.*;
import bp.sys.*;
import java.util.*;
/**
表单目录
*/
public class FrmSort extends EntityNoName
{
///#region 属性.
/**
组织编号
*/
public final String getOrgNo()
{
return this.GetValStrByKey(FrmSortAttr.OrgNo);
}
public final void setOrgNo(String value)
{
this.SetValByKey(FrmSortAttr.OrgNo, value);
}
public final String getDomain()
{
return this.GetValStrByKey(FrmSortAttr.Domain);
}
public final void setDomain(String value)
{
this.SetValByKey(FrmSortAttr.Domain, value);
}
public final String getParentNo()
{
return this.GetValStrByKey(FrmSortAttr.ParentNo);
}
public final void setParentNo(String value)
{
this.SetValByKey(FrmSortAttr.ParentNo, value);
}
///#endregion 属性.
///#region 构造方法
/**
表单目录
*/
public FrmSort()
{
}
/**
表单目录
@param _No
*/
public FrmSort(String _No)
{
super(_No);
}
@Override
public UAC getHisUAC()
{
UAC uac = new UAC();
uac.IsDelete = false;
uac.IsInsert = false;
uac.IsUpdate = true;
return uac;
}
///#endregion
/**
表单目录Map
*/
@Override
public Map getEnMap()
{
if (this.get_enMap() != null)
{
return this.get_enMap();
}
Map map = new Map("Sys_FormTree", "表单目录");
map.AddTBStringPK(FrmSortAttr.No, null, "编号", false, false, 1, 100, 20);
map.AddTBString(FrmSortAttr.ParentNo, null, "父节点No", false, false, 0, 100, 30);
map.AddTBString(FrmSortAttr.Name, null, "名称", true, false, 0, 200, 30, true);
map.AddTBString(FrmSortAttr.ShortName, null, "简称", true, false, 0, 200, 30, true);
map.AddTBString(FrmSortAttr.OrgNo, "0", "组织编号(0为系统组织)", false, false, 0, 150, 30);
map.SetHelperAlert(FrmSortAttr.OrgNo, "用于区分不同组织的的流程,比如:一个集团有多个子公司,每个子公司都有自己的业务流程.");
map.AddTBString(FrmSortAttr.Domain, null, "域/系统编号", true, false, 0, 100, 30);
map.SetHelperAlert(FrmSortAttr.Domain, "用于区分不同系统的流程,比如:一个集团有多个子系统每个子系统都有自己的流程,就需要标记那些流程是那个子系统的.");
map.AddTBInt(FrmSortAttr.Idx, 0, "Idx", false, false);
this.set_enMap(map);
return this.get_enMap();
}
/**
创建的时候,给他增加一个OrgNo。
@return
*/
@Override
protected boolean beforeInsert() throws Exception {
if (bp.wf.Glo.getCCBPMRunModel() != CCBPMRunModel.Single)
{
this.setOrgNo(bp.web.WebUser.getOrgNo());
}
return super.beforeInsert();
}
/**
删除之前的逻辑
@return
*/
@Override
protected boolean beforeDelete() throws Exception {
String sql = "SELECT COUNT(*) as Num FROM Sys_MapData WHERE FK_FormTree='" + this.getNo() + "'";
int num = DBAccess.RunSQLReturnValInt(sql);
if (num != 0)
{
throw new RuntimeException("err@您不能删除该目录,下面有表单。");
}
return super.beforeDelete();
}
}
EntityTreeAttr
package bp.wf.admin;
import bp.da.*;
import bp.en.*;
import bp.port.*;
import bp.sys.*;
import java.util.*;
/**
表单目录属性
*/
public class FrmSortAttr extends EntityTreeAttr
{
/**
组织编号
*/
public static final String OrgNo = "OrgNo";
/**
简称
*/
public static final String ShortName = "ShortName";
/**
域/系统编号
*/
public static final String Domain = "Domain";
}
EntitiesNoName
package bp.wf.admin;
import bp.da.*;
import bp.en.*;
import bp.port.*;
import bp.sys.*;
import java.util.*;
/**
表单目录
*/
public class FrmSorts extends EntitiesNoName
{
///#region 构造.
/**
表单目录s
*/
public FrmSorts()
{
}
/**
得到它的 Entity
*/
@Override
public Entity getGetNewEntity()
{
return new FrmSort();
}
/**
@return
*/
@Override
public int RetrieveAll() throws Exception {
if (bp.wf.Glo.getCCBPMRunModel() != CCBPMRunModel.Single)
{
return this.Retrieve(FrmSortAttr.OrgNo, bp.web.WebUser.getOrgNo(), FrmSortAttr.Idx);
}
QueryObject qo = new QueryObject(this);
qo.AddWhere(FrmSortAttr.ParentNo, "!=", "0");
qo.addOrderBy("Idx");
int i = qo.DoQuery();
if (i == 0)
{
FrmSort fs = new FrmSort();
fs.setName("流程树");
fs.setNo("100");
fs.setParentNo("0");
fs.Insert();
fs = new FrmSort();
fs.setName("公文类");
fs.setNo("01");
fs.setParentNo("100");
fs.Insert();
fs = new FrmSort();
fs.setName("办公类");
fs.setNo("02");
fs.setParentNo("100");
fs.Insert();
qo = new QueryObject(this);
qo.AddWhere(FrmSortAttr.ParentNo, "!=", "");
qo.addOrderBy("Idx");
i = qo.DoQuery();
}
return i;
}
///#endregion 构造.
///#region 为了适应自动翻译成java的需要,把实体转换成List.
/**
转化成 java list,C#不能调用.
@return List
*/
public final List<FrmSort> ToJavaList()
{
return (List<FrmSort>)(Object)this;
}
/**
转化成list
@return List
*/
public final ArrayList<FrmSort> Tolist()
{
ArrayList<FrmSort> list = new ArrayList<FrmSort>();
for (int i = 0; i < this.size(); i++)
{
list.add((FrmSort)this.get(i));
}
return list;
}
///#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
enum:
在这里插入代码片
JUmp way
在这里插入代码片
参考资料和推荐阅读
- 爬虫框架的设计与实现之JAVA篇.
- 主流爬虫框架的基本介绍.
- 高拓展性的Java多线程爬虫框架reptile.
欢迎阅读,各位老铁,如果对你有帮助,点个赞加个关注呗!~