详细设计规约 - XLab-Tongji/KAOSer GitHub Wiki
详细设计规约
过程流设计
- 用户注册
- 绘制图形并编辑描述文档
- 打开现有文件,编辑文件并保存更改
- 保存KAOS文件到mongodb数据库
- 从现有模型生成需求文档模板,并下载保存到本地电脑
类设计
系统总体类图:
下面是部分重要类的描述:
(注:图形实体类部分见 概要设计规约-数据库设计 部分)
HoverIcons
_public class HoverIcons
UI界面中图形侧边的选项按钮
Fields
Modifier and Type | Field | Description |
---|---|---|
private DOM | arrowUp | 向上克隆图形 |
private DOM | arrowRight | 向右克隆图形 |
private DOM | arrowDown | 向下克隆图形 |
private DOM | arrowLeft | 向左克隆图形 |
private DOM | myTableGoal | 显示/隐藏Goal的详细信息 |
private DOM | myTableRequirement | 显示/隐藏Requirement的详细信息 |
private DOM | myTableOthers | 显示/隐藏其他图形的详细信息 |
Constructors
无
Methods
init()
初始化
returns
无
parameters
无
throws
GeneralExpection
createArrow(img,tooltip)
绘制选项按钮div
returns
DOM元素
parameters
- img: icon图片
- tooltip: 鼠标悬浮时图形备注
throws
GeneralExpection
setDisplay(display)
设置按钮显示/隐藏的状态
returns
无
parameters
- display: 按钮状态
throws
GeneralExpection
repaint()
由于界面的改动而重新确定按钮的位置
returns
无
parameters
无
throws
GeneralExpection
Action
_public class Action
各种选项的功能实现
Fields
无
Constructors
无
Methods
init()
初始化,在其中定义各种活动 (新增文件存储至Mongodb和文档Template生成下载操作)
returns
无
parameters
无
throws
GeneralExpection
Template()
生成需求文档模板 (新增文件存储至Mongodb和文档Template生成下载操作)
returns
无
parameters
无
throws
GeneralExpection
Mongo()
将KAOS文件保存到Mongodb数据库
returns
无
parameters
无
throws
GeneralExpection
Menus
_public class Menus
操作选项
Fields
Modifier and Type | Field | Description |
---|---|---|
private DOM | MongoDB | 保存至mongodb选项 |
private DOM | Template | 生成文档模板选项 |
Constructors
无
Methods
init()
初始化,在其中定义各种活动 (新增文件存储至Mongodb和文档Template生成下载操作)
returns
无
parameters
无
throws
GeneralExpection
Format
_public class Format
图形样式绘制侧边栏
Fields
Modifier and Type | Field | Description |
---|---|---|
private DOM | editorUi | 整个UI界面 |
private DOM | container | 绘图的容器 |
Constructors
无
Methods
this.editorUi.toolbar.addMenuFunctionInContainer()
修改lineEnd选项框,定制化为kaos的lineEnd 删除其他用不到的选项
returns
无
parameters
无
throws
GeneralExpection
mxMarker
_public class mxMarker
表示连接线的实例
Fields
无
Constructors
无
Methods
addMarker(String,function)
定制出一套KAOS的连接线
returns
无
parameters
- String: 连接线名称
- function: 连接线的绘制方法
throws
GeneralExpection
mxUtils
_public class mxUtils
前端界面中的UI图形类
Fields
无
Methods
extend(function,mxActor)
定制出一套KAOS的图形样式
parameters
- function:图形的构造方法
- mxActor:图形数组,用来系统UI中的图形
returns
无
throws
GeneralExpection
Sidebar
_public class Sidebar
侧边图形栏
Fields
无
Methods
Sidebar.prototype.createVertexTemplateEntry = function(style, width, height, value, title, showLabel, showTitle, tags)
添加侧边图形
parameters
- style:图形样式
- width:图形宽度
- height:图形高度
- value:图形文本内容
- title:标题
- showLabel:显示的标签
- showTitle:显示的标题
- tags:标识
returns
无
throws
GeneralExpection
KaoserFile
_public class KaoserFile
系统中KAOS模型文件的实例
Fields
Modifier and Type | Field | Description |
---|---|---|
private String | id | KAOS文件id |
private string | name | KAOS文件名 |
private string | JsonStr | KAOS文件内容 |
Constructors
无
Methods
getId
- public String getId() *
获取文件ID
returns
文件ID
parameters
无
throws
GeneralExpection
getName
public String getName()
获取文件名
returns
文件名
parameters
无
throws
GeneralExpection
getJsonStr
public String getJsonStr()
获取文件内容
returns
文件内容
parameters
无
throws
GeneralExpection
DownLoadController
_public class KaoserFile
后端生成需求文档模板的控制器
Fields
无
Constructors
无
Methods
getResults
public void getResults(HttpServletRequest request, HttpServletResponse response)
获取前端传来的Json数据内容并转化为文本
returns
无
parameters
- HttpServletRequest request:后端从前端接收的数据
- HttpServletResponse response:后端返回给前端的数据
throws
- ServletException
- IOException
- TemplateException
WriteStringToFile
public void WriteStringToFile(String name,String result)
生成需求文档模板文件
returns
无
parameters
- name: 保存的文件名
- result:待写入的文件内容
throws
GeneralExpection
ServletDownload
_public class KaoserFile
后端生成需求文档模板的控制器
Fields
无
Constructors
public ServletDownload()
Methods
doDownload
public void doDownload(HttpServletRequest request, HttpServletResponse response)
下载已经生成的MarkDown需求文档模板
returns
无
parameters
- HttpServletRequest request:后端从前端接收的数据
- HttpServletResponse response:后端返回给前端的数据
throws
- ServletException
- IOException
doJsonDownload
public void doJsonDownload(HttpServletRequest request, HttpServletResponse response)
下载已经生成的JSON格式需求文档模板
returns
无
parameters
- HttpServletRequest request:后端从前端接收的数据
- HttpServletResponse response:后端返回给前端的数据
throws
- ServletException
- IOException
SaveToMongodbController
_public class SaveToMongodbController
后端生成需求文档模板的控制器
Fields
无
Constructors
无
Methods
save
public void save(HttpServletRequest request, HttpServletResponse response)
保存KAOS文件到Mongodb数据库
returns
无
parameters
- HttpServletRequest request:后端从前端接收的数据
- HttpServletResponse response:后端返回给前端的数据
throws
- ServletException
- IOException
findByName
public KaoerFile findByName(String name)
根据文件名查找KAOS文件
returns
KAOS文件
parameters
- name:KAOS文件名
throws
General Exception
对Drow.io的改动: 定制了一套KAOS图形 定制了一套KAOS图形样式表
前端方法
createGoalDiv
returns
返回一个包含Gaol描述表格的Div元素
parameters
none
throws
GeneralExpection
createRequirementDiv
returns
返回一个包含Requirement描述表格的Div元素
parameters
none
throws
GeneralExpection
createResourceDiv
returns
返回一个包含Resource描述表格的Div元素
parameters
none
throws
GeneralExpection
createAgentDiv
returns
返回一个包含Agent描述表格的Div元素
parameters
none
throws
GeneralExpection
createDomainPropertyDiv
returns
返回一个包含DomainProperty描述表格的Div元素
parameters
none
throws
GeneralExpection