Package cn.edu.pku.dr.requirement.elicitation.data

Examples of cn.edu.pku.dr.requirement.elicitation.data.Problemreason


    public StringBuffer createSolution(HttpServletRequest request,
            HttpServletResponse response) throws EasyJException {
        Long problemId = new Long(request.getParameter("problemId"));
        SingleDataProxy sdp = SingleDataProxy.getInstance();
        Problemreason problemreason = new Problemreason();
        ProblemreasonSolution prs = new ProblemreasonSolution();
        problemreason.setProblemId(problemId);
        String solution = "无解决方案";
        ArrayList problemreasons = sdp.query(problemreason);

        StringBuffer buffer = new StringBuffer();
        buffer
                .append("<meta http-equiv=\"Expires\" content=\"0\"><meta http-equiv=\"Pragma\" content=\"no-cache\"><meta http-equiv=\"Cache-Control\" content=\"no-cache\">");
        buffer
                .append("<link href=\"/css/iknow1_1.css\" rel=\"stylesheet\" type=\"text/css\">");
        buffer
                .append("<link href=\"/css/table.css\" rel=\"stylesheet\" type=\"text/css\">");
        buffer
                .append("<link href=\"/css/pattern.css\" rel=\"stylesheet\" type=\"text/css\">");
        buffer
                .append("<link href=\"/css/scenario.css\" rel=\"stylesheet\" type=\"text/css\">");
        buffer
                .append("<script language=\"javascript\" src=\"/js/ProblemsolutionReply.js\"></script>");
        buffer
                .append("<form name=\"form2\" id=\"form2\" method=\"post\" action=\"\" type=\"enter2tab\"><div id=\"newSolution\"></div>");

        buffer.append("<div id=\"center2\"   ><div class=\"bai\">");
        buffer
                .append("<div class=\"mb12 bai\" id=\"solution_more\" ><div class=\"rr_1\"></div><div class=\"rr_2\"></div><div class=\"rr_3\"></div><div class=\"rr\">");
        buffer
                .append("<div class=\"t1\"><div class=\"ico\"><div class=\"ianswer\"></div></div>发表新的解决方案</div>");
        buffer.append("<div class=\"bc0\" style=\"padding:0px 0pt;\">");
        // 产生标题
        buffer
                .append("<div class=\"t2\"><TABLE style=\"MARGIN-TOP: 8px; MARGIN-BOTTOM: 8px\" cellSpacing=0 cellPadding=0 width=\"100%\" align=center border=0><TBODY></TBODY></TABLE><TABLE class=f9 id=newsTable cellSpacing=0 cellPadding=0 width=\"100%\" align=center bgColor=#ffffff border=0><TBODY>");
        buffer
                .append("<TR bgColor=#f3f3f3><TD class=tdline28 noWrap width=\"5%\"></TD><TD class=tdline28 width=\"14%\" height=30><b>序号</b></TD><TD class=tdline28 width=\"1%\">&nbsp;</TD><TD class=tdline28><B>原因概要</B></TD><TD class=tdline28 width=\"15%\"><B>&nbsp;</B></TD></TR>");
        // 产生所有的原因,供选择
        if (problemreasons != null) {
            for (int i = 0; i < problemreasons.size(); i++) {
                solution = "无解决方案";
                // 原因简写部分
                problemreason = (Problemreason) problemreasons.get(i);
                buffer.append("<TR id=trBG" + i + ">");
                buffer
                        .append("<TD class=tdline28 noWrap align=left ><INPUT onclick=\"Problemsolution.changeTRbg(this,'trBG"
                                + i
                                + "')\" type=\"checkbox\" value=\""
                                + problemreason.getProblemreasonId()
                                + "\" name=\"choose_reason\"></TD>");
                buffer.append("<TD class=tdline28 align=left>" + (i + 1)
                        + "</TD>");
                buffer.append("<TD class=tdline28 align=right>&nbsp;</TD>");

                if (problemreason.getProblemreasonContent().length() > 10) {
                    buffer.append("<TD class=tdline28 align=left title="
                            + problemreason.getProblemreasonContent()
                            + ">"
                            + problemreason.getProblemreasonContent()
                                    .subSequence(0, 9) + "...</TD>");
                } else {
                    buffer
                            .append("<TD class=tdline28 align=left title="
                                    + problemreason.getProblemreasonContent()
                                    + ">"
                                    + problemreason.getProblemreasonContent()
                                    + "</TD>");
                }

                buffer
                        .append("<TD class=tdline28 noWrap align=left><A class=\"bluelink\" onclick=; href=\"javascript:Problemsolution.newsShowHide('news"
                                + i + "');\">查看该原因以及解决方案</A></TD></TR>");
                // 原因主要内容(隐藏)
                prs.setProblemreasonId(problemreason.getProblemreasonId());
                ArrayList prss = sdp.query(prs);
                if (prss.size() > 0) {
                    solution = "";
                    for (int j = 0; j < prss.size(); j++) {
                        prs = (ProblemreasonSolution) prss.get(j);
                        solution = solution + prs.getProblemsolutionId();
                    }
                }
                buffer
                        .append("<TR><TD class=tdline28 id=news"
                                + i
                                + " style=\"DISPLAY: none\" noWrap align=left colSpan=5><BR>");
                buffer
                        .append("<TABLE class=zh cellSpacing=0 cellPadding=0 width=\"96%\" align=center border=0><TBODY><TR>");
                buffer.append("<TD><DIV id=MSGcontent" + i
                        + "><div id=\"Lg\"></div>");
                buffer
                        .append("<div class=\"f14 p90 pl10\" class=\"answer_content\" ><span style=\"color:#FF0000\">该原因的详细内容是:"
                                + problemreason.getProblemreasonContent()
                                + "</span></div>");
                buffer.append("<div id=\"Lg\"></div>");
                buffer
                        .append("<div class=\"f14 p90 pl10\" class=\"answer_content\" ><span style=\"color:#FF0000\">原因解决状态:</span>针对该原因的解决方案有<span style=\"color:#FF0000\">"
                                + solution + "</span></div>");
View Full Code Here


    public void getProblemreason() throws EasyJException, IOException {
        ProblemReasonImpl targetObject = new ProblemReasonImpl();
        ProblemReasonInterface problemreasonInterface = null;
        Object proxy = ProblemReasonProxyFactory.getProxy(targetObject);
        problemreasonInterface = (ProblemReasonInterface) proxy;
        Problemreason problemreason = new Problemreason();
        problemreason = (Problemreason) object;
        try {
            response.getWriter().println(
                    problemreasonInterface.getProblemreason(problemreason,
                            this.request, false).toString());
View Full Code Here

    public void creatingProblemReason() throws EasyJException, IOException {
        ProblemReasonImpl targetObject = new ProblemReasonImpl();
        ProblemReasonInterface problemreasonInterface = null;
        Object proxy = ProblemReasonProxyFactory.getProxy(targetObject);
        problemreasonInterface = (ProblemReasonInterface) proxy;
        Problemreason problemreason = new Problemreason();
        problemreason = (Problemreason) object;
        returnMessage = problemreasonInterface.creatingProblemReason(
                problemreason, this.request, response);

    }
View Full Code Here

    public void viewAllProblemreason() throws EasyJException, IOException {
        ProblemReasonImpl targetObject = new ProblemReasonImpl();
        ProblemReasonInterface problemreasonInterface = null;
        Object proxy = ProblemReasonProxyFactory.getProxy(targetObject);
        problemreasonInterface = (ProblemReasonInterface) proxy;
        Problemreason problemreason = new Problemreason();
        problemreason = (Problemreason) object;
        try {
            response.getWriter().println(
                    problemreasonInterface.viewAllProblemreason(problemreason,
                            this.request).toString());
View Full Code Here

            throws EasyJException, IOException {
        String confirm;
        String overdue;
        CompositeDataProxy cdp = CompositeDataProxy.getInstance();
        SingleDataProxy sdp = SingleDataProxy.getInstance();
        Problemreason pr = new Problemreason();
        pr.setProblemreasonId(pre.getProblemreasonId());
        pr = (Problemreason) cdp.get(pr);
        StringBuffer xml = new StringBuffer("<result>");
        try {
            if (request.getParameter("flower") != null) {

                pr.setGoodNum(new Long(pr.getGoodNum().intValue() + 1));
                cdp.update(pr);
                pre.setIsGood("Y");
                sdp.create(pre);
                xml
                        .append("<message>success</message><choose>flower</choose><problemreasonId>"
                                + pre.getProblemreasonId()
                                + "</problemreasonId></result>");

            }
        } catch (EasyJException e) {
            xml.append("<message>failure</message></result>");
        }
        try {
            if (request.getParameter("badegg") != null) {
                pr.setBadNum(new Long(pr.getBadNum().intValue() + 1));
                cdp.update(pr);
                pre.setIsGood("N");
                sdp.create(pre);
                xml
                        .append("<message>success</message><choose>badegg</choose><problemreasonId>"
                                + pre.getProblemreasonId()
                                + "</problemreasonId></result>");

            }

        } catch (EasyJException e) {
            xml.append("<message>failure</message></result>");
        }

        // 对于确认的处理,暂时只是设置一下用户的选择,以后如果peoblem_version建立之后会有改动,要增加确认对应的版本信息

        if (request.getParameter("confirm") != null) {
            if (request.getParameter("confirm").equals("y")) {
                pr.setProblemChange("C");
                try {
                    cdp.update(pr);
                    xml
                            .append("<message>success</message><choose>confirm</choose><problemreasonId>"
                                    + pre.getProblemreasonId()
                                    + "</problemreasonId></result>");

                } catch (EasyJException e) {
                    xml.append("<message>failure</message></result>");
                }

            } else {
                pr.setProblemChange("D");
                try {

                    cdp.update(pr);
                    xml
                            .append("<message>success</message><choose>reject</choose><problemreasonId>"
                                    + pre.getProblemreasonId()
                                    + "</problemreasonId></result>");

                } catch (EasyJException e) {
                    xml.append("<message>failure</message></result>");
                }

            }
        }
        try {
            if (request.getParameter("overdue") != null) {
                ProblemVersion problemversion = new ProblemVersion();
                problemversion.setProblemId(pr.getProblemId());
                Long problemversioncount = sdp.getCount(problemversion);
                pr.setProblemreasonOverdueVersion(problemversioncount);

                pr.setIsoverdue("Y");
                cdp.update(pr);
                xml
                        .append("<message>success</message><choose>overdue</choose><problemreasonId>"
                                + pre.getProblemreasonId()
                                + "</problemreasonId></result>");
View Full Code Here

    public String getProblemreasonNotByGroup(Long userId,
            ArrayList problemreasons) throws EasyJException {
        StringBuffer buffer = new StringBuffer();
        ProblemreasonEvaluation pre = new ProblemreasonEvaluation();
        Problemreason pr = new Problemreason();
        SingleDataProxy sdp = SingleDataProxy.getInstance();
        ProblemreasonSolution prs = new ProblemreasonSolution();
        ProblemreasonSolution prs2 = new ProblemreasonSolution();
        buffer.append("<div class=\"bc0\" style=\"padding:0px 0pt;\">");
        String solution = "";
        if (problemreasons.size() > 0) {
            for (int i = 0; i < problemreasons.size(); i++) {
                pr = (Problemreason) problemreasons.get(i);
                prs.setProblemreasonId(pr.getProblemreasonId());
                ArrayList prss = sdp.query(prs);
                if (prss.size() > 0) {
                    for (int j = 0; j < prss.size(); j++) {
                        prs2 = (ProblemreasonSolution) prss.get(j);
                        solution = solution + ","
                                + prs2.getProblemreasonSolutionId();
                    }
                    buffer
                            .append("<div class=\"f14 p90 pl10\" class=\"answer_content\">"
                                    + pr.getProblemreasonContent() + "</div>");
                    buffer.append("<p></p>共有" + sdp.getCount(prs)
                            + "个解决方案,对应的解决方案为" + solution + "<p></p>");
                    solution = "";

                } else {
                    buffer
                            .append("<div id=\"Lg\" ></div><div class=\"f14 p90 pl10\" class=\"answer_content\">"
                                    + pr.getProblemreasonContent()
                                    + "</div><p></p>目前无该原因的解决方案,<A class=brown12  href=\"javascript:Problemsolution.loadNewSolution("
                                    + pr.getProblemId()
                                    + ")\">添加一个?</A><p></p>");

                }

                boolean flag = true;
                int j = 0;
                ArrayList pres = pr.getProblemreasonEvaluations();
                while (flag == true && j < pres.size()) {
                    pre = (ProblemreasonEvaluation) pres.get(j);
                    if (pre.getCreatorId().intValue() == userId.intValue()) {
                        flag = false;

                    }
                    j++;
                }
                if (userId.intValue() != pr.getCreatorId().intValue()
                        && pr.getIsoverdue().equals("N") && flag) {
                    // 登陆者不是这个problemreason的作者,且没有评价过,且这个problemreason还没有过期
                    buffer
                            .append("<IMG src=\"/image/flower.gif\"> <A class=brown12 id=\"problemreason_flower"
                                    + pr.getProblemreasonId()
                                    + "\" href=\"javascript:Problem.problemreasonFlower("
                                    + pr.getProblemId()
                                    + ","
                                    + pr.getProblemreasonId()
                                    + ","
                                    + userId
                                    + ")\">送鲜花</A>(得<SPAN id=\"problemreason_flowernum"
                                    + pr.getProblemreasonId()
                                    + "\">"
                                    + pr.getGoodNum() + "</SPAN>支)");
                    buffer
                            .append("<IMG height=15 src=\"/image/badegg.gif\" width=16><A id=\"problemreason_badegg"
                                    + pr.getProblemreasonId()
                                    + "\"class=brown12  href=\"javascript:Problem.problemreasonBadegg("
                                    + pr.getProblemId()
                                    + ","
                                    + pr.getProblemreasonId()
                                    + ","
                                    + userId
                                    + ")\">扔鸡蛋</A>(得<SPAN class=orange12 id=\"problemreason_badeggnum"
                                    + pr.getProblemreasonId()
                                    + "\">"
                                    + pr.getBadNum() + "</SPAN>个)");
                } else {
                    buffer.append("<IMG src=\"/image/flower.gif\"> (得<SPAN>"
                            + pr.getGoodNum() + "</SPAN>支)");
                    buffer
                            .append("<IMG height=15 src=\"/image/badegg.gif\" width=16>(得<SPAN class=orange12>"
                                    + pr.getBadNum() + "</SPAN>个)");
                }

                if (pr.getIsoverdue().equals("N")
                        && userId.intValue() == pr.getCreatorId().intValue()) {
                    // 只有是作者且还没有失效的时候才会出现实效按钮
                    buffer
                            .append("<br><IMG height=15 src=\"/image/assoc_delete.gif\" width=16><A id=\"problemreason_overdue"
                                    + pr.getProblemreasonId()
                                    + "\" class=brown12  href=\"javascript:Problem.problemreasonOverdue("
                                    + pr.getProblemId()
                                    + ","
                                    + pr.getProblemreasonId()
                                    + ","
                                    + userId
                                    + ")\">失效</A><div id=\"problemreason_overdue2"
                                    + pr.getProblemreasonId()
                                    + "\" style=\"display:none\">您已设置该回复失效</div>");
                } else if (pr.getIsoverdue().equals("Y")
                        && userId.intValue() == pr.getCreatorId().intValue()) {
                    buffer
                            .append("<br><IMG height=15 src=\"/image/assoc_delete.gif\" width=16>您已设置该回复失效");
                } else if (pr.getIsoverdue().equals("Y")
                        && userId.intValue() != pr.getCreatorId().intValue()) {
                    buffer
                            .append("<br><IMG height=15 src=\"/image/assoc_delete.gif\" width=16>该作者已设置该回复失效");
                }

                if (userId.intValue() == pr.getCreatorId().intValue()
                        && pr.getProblemChange().equals("Y")) {
                    buffer
                            .append("<br><IMG height=15 src=\"/image/agree.gif\" width=16><A id=\"problemreason_confirm1"
                                    + pr.getProblemreasonId()
                                    + "\" class=brown12  href=\"javascript:Problem.problemreasonConfirm("
                                    + pr.getProblemId()
                                    + ","
                                    + pr.getProblemreasonId()
                                    + ","
                                    + userId
                                    + ")\">确认</A>&nbsp;&nbsp;<A id=\"problemreason_reject1"
                                    + pr.getProblemreasonId()
                                    + "\" class=brown12  href=\"javascript:Problem.problemreasonReject("
                                    + pr.getProblemId()
                                    + ","
                                    + pr.getProblemreasonId()
                                    + ","
                                    + userId
                                    + ")\">拒绝</A><div id=\"problemreason_confirm2"
                                    + pr.getProblemreasonId()
                                    + "\" style=\"display:none\">您已确认</div><div id=\"problemreason_reject2"
                                    + pr.getProblemreasonId()
                                    + "\" style=\"display:none\">您已拒绝</div>");
                    // 只有是作者
                } else if (pr.getProblemChange().equals("C")
                        && userId.intValue() == pr.getCreatorId().intValue()) {
                    buffer
                            .append("<br><IMG height=15 src=\"/image/agree.gif\" width=16>您已确认");
                } else if (pr.getProblemChange().equals("C")
                        && userId.intValue() != pr.getCreatorId().intValue()) {
                    buffer
                            .append("<br><IMG height=15 src=\"/image/agree.gif\" width=16>该文章作者已确认");
                } else if (pr.getProblemChange().equals("D")
                        && userId.intValue() == pr.getCreatorId().intValue()) {
                    buffer
                            .append("<br><IMG height=15 src=\"/image/agree.gif\" width=16>您已拒绝");
                } else if (pr.getProblemChange().equals("D")
                        && userId.intValue() != pr.getCreatorId().intValue()) {
                    buffer
                            .append("<br><IMG height=15 src=\"/image/agree.gif\" width=16>该文章作者已拒绝");
                }

                buffer
                        .append("<div align=\"right\" style=\"margin: 5px 5px 8px;\" id=\"comment_info\"><span class=\"gray\">评论者:"
                                + pr.getUserName()
                                + " 时间"
                                + pr.getBuildTime()
                                + "</span></div>");
                /*
                 * if(i<problemreasons.size()-1){ buffer.append("<div
                 * id=\"Lg\" ></div>"); }
                 */
 
View Full Code Here

TOP

Related Classes of cn.edu.pku.dr.requirement.elicitation.data.Problemreason

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.