Paragraph title = new Paragraph();
title.add(new Chunk(uc.getUseCaseName().trim()));
title.setAlignment(1);
document.add(title);
RtfCell useCaseID = new RtfCell("用况编号:");
useCaseID.setBorders(normal);
RtfCell useCaseIDC = new RtfCell(uc.getUseCaseId()
.toString());
useCaseIDC.setBorders(normal);
RtfCell useCaseName = new RtfCell("用况名称:");
useCaseName.setBorders(normal);
RtfCell useCaseNameC = new RtfCell(uc.getUseCaseName());
useCaseNameC.setBorders(normal);
RtfCell useCaseDescription = new RtfCell("用况描述:");
useCaseDescription.setBorders(normal);
RtfCell useCaseDescriptionC = new RtfCell(uc
.getUseCaseDescription());
useCaseDescriptionC.setBorders(normal);
RtfCell useCasePriority = new RtfCell("用况优先级:");
useCasePriority.setBorders(normal);
RtfCell useCasePriorityC = null;
if (uc.getUseCasePriority() != null) {
useCasePriorityC = new RtfCell(uc
.getUseCasePriority().toString());
} else {
useCasePriorityC = new RtfCell("");
}
useCasePriorityC.setBorders(normal);
RtfCell specialRequirement = new RtfCell("特殊要求:");
specialRequirement.setBorders(normal);
RtfCell specialRequirementC = new RtfCell(uc
.getUseCaseSpecialRequirement());
specialRequirementC.setColspan(3);
specialRequirementC.setBorders(normal);
RtfCell preCondition = new RtfCell("前置条件:");
preCondition.setBorders(normal);
RtfCell preConditionC = new RtfCell(uc
.getUseCasePreconditions());
preConditionC.setColspan(3);
preConditionC.setBorders(normal);
RtfCell fireCondition = new RtfCell("触发条件:");
fireCondition.setBorders(normal);
RtfCell fireConditionC = new RtfCell(uc
.getUseCaseTrigger());
fireConditionC.setColspan(3);
fireConditionC.setBorders(normal);
RtfCell postCondition = new RtfCell("后置条件:");
postCondition.setBorders(normal);
RtfCell postConditionC = new RtfCell(uc
.getUseCasePostConditions());
postConditionC.setColspan(3);
postConditionC.setBorders(normal);
RtfCell failedEndCondition = new RtfCell("失败情况:");
failedEndCondition.setBorders(normal);
RtfCell failedEndConditionC = new RtfCell(uc
.getUseCaseFailedEndCondition());
failedEndConditionC.setColspan(3);
failedEndConditionC.setBorders(normal);
Table table = new Table(4);
table.addCell(useCaseID);
table.addCell(useCaseIDC);
table.addCell(useCaseName);
table.addCell(useCaseNameC);
table.addCell(useCaseDescription);
table.addCell(useCaseDescriptionC);
table.addCell(useCasePriority);
table.addCell(useCasePriorityC);
table.addCell(fireCondition);
table.addCell(fireConditionC);
table.addCell(preCondition);
table.addCell(preConditionC);
table.addCell(failedEndCondition);
table.addCell(failedEndConditionC);
table.addCell(postCondition);
table.addCell(postConditionC);
table.addCell(specialRequirement);
table.addCell(specialRequirementC);
// 生成Use Case具体描述的标题
RtfCell userOperation = new RtfCell("用户操作");
userOperation.setBorders(normal);
RtfCell systemOperation = new RtfCell("系统操作");
systemOperation.setBorders(normal);
RtfCell systemOutput = new RtfCell("系统输出");
systemOutput.setBorders(normal);
Table table2 = new Table(3);
table2.addCell(userOperation);
table2.addCell(systemOperation);
table2.addCell(systemOutput);
// 生成Use Case具体描述的内容
ArrayList ucis = new ArrayList();
UseCaseInteraction uci = new UseCaseInteraction();
uci.setUseCaseId(uc.getUseCaseId());
OrderRule orderule = new OrderRule();
orderule.setOrderColumn("sequence");
orderule.setOrderDirection(OrderDirection.ASC);
OrderRule[] orderRules = { orderule };
String temp;
ucis = cdp.query(uci, orderRules);
if (ucis.size() > 0) {
for (int k = 0; k < ucis.size(); k++) {
temp = ((UseCaseInteraction) ucis.get(k))
.getOperatorAction();
temp = removeHtml(temp);
RtfCell userOperationC = new RtfCell(temp);
userOperationC.setBorders(normal);
temp = ((UseCaseInteraction) ucis.get(k))
.getSystemAction();
temp = removeHtml(temp);
RtfCell systemOperationC = new RtfCell(temp);
systemOperationC.setBorders(normal);
temp = ((UseCaseInteraction) ucis.get(k))
.getSystemOutput();
temp = removeHtml(temp);
RtfCell systemOutputC = new RtfCell(temp);
systemOutputC.setBorders(normal);
table2.addCell(userOperationC);
table2.addCell(systemOperationC);
table2.addCell(systemOutputC);
}