详细设计规约 - XLab-Tongji/KAOSer GitHub Wiki

详细设计规约


过程流设计

  1. 用户注册

process

  1. 绘制图形并编辑描述文档

process

  1. 打开现有文件,编辑文件并保存更改

process

  1. 保存KAOS文件到mongodb数据库

process

  1. 从现有模型生成需求文档模板,并下载保存到本地电脑

process


类设计

系统总体类图:

class


下面是部分重要类的描述:

(注:图形实体类部分见 概要设计规约-数据库设计 部分)

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