String name[] = request.getParameterValues("overdue_ambiguity");
CompositeDataProxy cdp = CompositeDataProxy.getInstance();
// 将所有的Ambiguity的ProblemChange设置为Y,将所有的AmbiguityEvaluationType中的设置use_state设置为N
try {
ProblemVersion pv = new ProblemVersion();
pv.setProblemId(problem.getProblemId());
SingleDataProxy sdp = SingleDataProxy.getInstance();
// todo:需要判定是否有overdue_ambiguity,即name是否为空
if (name != null) {
for (int i = 0; i < name.length; i++) {
Ambiguity ambiguity = new Ambiguity();
ambiguity.setAmbiguityId(new Long(name[i]));
ambiguity = (Ambiguity) cdp.get(ambiguity);
ambiguity.setProblemChange("Y");
ambiguity.setSolvePendingVersion(sdp.getCount(pv));
cdp.update(ambiguity);
}
}
AmbiguityTypeValue atv = new AmbiguityTypeValue();
atv.setProblemId(problem.getProblemId());
ArrayList atvs = cdp.query(atv);
for (int j = 0; j < atvs.size(); j++) {
atv = (AmbiguityTypeValue) atvs.get(j);
atv.setProblemId(problem.getProblemId());
atv.setUseState("N");
dp.update(atv);
}
ProblemvalueTypeValue pvtv = new ProblemvalueTypeValue();
pvtv.setProblemId(problem.getProblemId());
ArrayList pvtvs = cdp.query(pvtv);
for (int j = 0; j < pvtvs.size(); j++) {
pvtv = (ProblemvalueTypeValue) pvtvs.get(j);
pvtv.setProblemId(problem.getProblemId());
pvtv.setUseState("N");
dp.update(pvtv);
}
String problemcontent = request.getParameter("problemContent");
pv.setProblemContent(problemcontent);
pv.setCreatorId(userId);
dp.create(pv);
returnMessage = "modify_problem_success**" + problemcontent;
} catch (EasyJException e) {
returnMessage = "modify_problem_failure**";