Remark remark = (Remark) object;
dp.delete(remark);
}
public void saveDescriptionVersion() throws EasyJException {
Description description = (Description) object;
description.setRoleId(userCache.getUser().getUserId());
Scenario scenario = new Scenario();
scenario.setScenarioId(description.getScenarioId());
String datas = "", participants = "", observers = "", communicators = "", descriptions = "";
scenario = (Scenario) cdp.get(scenario);
ArrayList dataList = scenario.getDatas();
ArrayList roleList = scenario.getRoles();
ArrayList descriptionList = scenario.getDescriptions();
for (int i = 0; i < dataList.size(); i++) {
ScenarioDataRelation data = (ScenarioDataRelation) dataList.get(i);
if (i != dataList.size() - 1)
datas += data.getDataId() + ",";
else
datas += data.getDataId();
}
for (int i = 0; i < descriptionList.size(); i++) {
Description descriptionVersion = (Description) descriptionList
.get(i);
if (i != dataList.size() - 1)
descriptions += descriptionVersion.getDescriptionId() + ",";
else
descriptions += descriptionVersion.getDescriptionId();
}
for (int i = 0; i < roleList.size(); i++) {
ScenarioRoleRelation role = (ScenarioRoleRelation) roleList.get(i);
if ("participant".equals(role.getRoleType()))
participants += role.getRoleId() + ",";
if ("observer".equals(role.getRoleType()))
observers += role.getRoleId() + ",";
if ("communicator".equals(role.getRoleType()))
communicators += role.getRoleId() + ",";
}
ScenarioVersion version = new ScenarioVersion();
version.setScenarioId(description.getScenarioId());
version.setCommunicators(communicators);
version.setParticipants(participants);
version.setObservers(observers);
version.setDatas(datas);
version.setCreatorId(userId);
version.setDescriptions(descriptions);
version.setBuildTime(new java.sql.Date(System.currentTimeMillis()));
version.setUpdateTime(new java.sql.Date(System.currentTimeMillis()));
version.setModifyMark("description");
dp.create(version);
String changeContent = description.getDescriptionContent();
String oriDescriptionContent = request.getParameter("cleanContent");
description.setDescriptionContent(oriDescriptionContent);
if (description.getDescriptionId() == null) {
dp.create(description);
returnMessage = "descriptionId=" + description.getDescriptionId()
+ "<message>保存成功";
} else {
dp.update(description);
returnMessage = "保存成功";
}
DescriptionVersion descriptionVersion = new DescriptionVersion();
descriptionVersion.setBuildTime(new java.sql.Date(System
.currentTimeMillis()));
descriptionVersion.setUpdateTime(new java.sql.Date(System
.currentTimeMillis()));
descriptionVersion.setCreatorId(userId);
descriptionVersion.setScenarioVersionId(version.getScenarioVersionId());
descriptionVersion.setDescriptionId(description.getDescriptionId());
descriptionVersion.setDescriptionVersionContent(changeContent);
dp.create(descriptionVersion);
}