Package easyJ.business.proxy

Examples of easyJ.business.proxy.CompositeDataProxy


                .getAttribute(Globals.SYS_USER_CACHE);
        Long userId = userCache.getUser().getUserId();

        // 这个方法输出问题的价值界面
        StringBuffer buffer = new StringBuffer();
        CompositeDataProxy cdp = CompositeDataProxy.getInstance();
        ArrayList problemreasons = cdp.query(problemreason);
        // 用problemvalue或者ambiguity那样用session求也可以
        // 标题
        buffer
                .append("<div class=\"t1\"><div class=\"ico\"><div class=\"icomment\"></div></div>");
        buffer.append("针对问题的价值现有<span style=\"color:#FF0000\">"
                + problemreasons.size() + "</span>个讨论</div>");
        // 下面是用户讨论的页面
        buffer.append("<div class=\"bc0\" style=\"padding:0px 0pt;\">");
        buffer.append("<div class=\"t2\">对于问题存在原因的讨论:</div>");
        buffer
                .append("<a  id=\"problemreason_order2\"  href=\"javascript:Problem.problemreasonOrderByGoodNum("
                        + problemreason.getProblemId()
                        + ")\"  style=\"padding:5px 10px 5px 10px!important;padding:4px 10px 4px 10px;height:1px;border:1px solid#7AA9DF;background-color:#EAF3FC;font-size:12px \">按好评升序</a>");
        buffer
                .append("<div id=\"problemreason_order22\" style=\"display:none\">false</div>");
        buffer.append("<div id=\"viewAllProblemreason\">");
        String good_num = "false";
        Problem problem = new Problem();
        problem.setProblemId(problemreason.getProblemId());
        problem = (Problem) cdp.get(problem);
        ArrayList problemreasons2 = problem.getProblemreasons();
        if (good_num.equals("true")) {
            Collections.sort(problemreasons2);
        }
        String content = "";
View Full Code Here


    public StringBuffer problemreasonUpdate(ProblemreasonEvaluation pre,
            HttpServletRequest request, HttpServletResponse response)
            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

                        .append("<div id=\"viewAllProblemreason\" style=\"display:block\">");

            }
        }
        String good_num = request.getParameter("good_num");
        CompositeDataProxy cdp = CompositeDataProxy.getInstance();
        Problem problem = new Problem();
        problem.setProblemId(problemreason.getProblemId());
        problem = (Problem) cdp.get(problem);
        ArrayList problemreasons = problem.getProblemreasons();
        if (good_num.equals("true")) {
            Collections.sort(problemreasons);
        }
        String content = "";
View Full Code Here

         * src=\"http://localhost:8080/image/arrow_right.gif\">");
         * buffer.append("</TD></TR></TBODY></TABLE>"); return buffer;
         */

        // 问题主体部分
        CompositeDataProxy cdp = CompositeDataProxy.getInstance();

        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("<div id=\"center2\" ><div class=\"bai\" >");
        buffer
                .append("<div class=\"mb12 bai\"  style=\"display:none\" id=\"problem_main\"> <div class=\"rg_1\"></div><div class=\"rg_2\"></div><div class=\"rg_3\"></div><div class=\"rg\" id=\"problem\">");
        Problem result = new Problem();
        // ArrayList results = cdp.query(problem);
        result = (Problem) cdp.get(problem);
        ArrayList solutions = result.getSolutions();
        if (result.getProblemStatus().equals("最终解决方案征集中")) {
            buffer
                    .append("<div class=\"t1\" id=\"question_status\"><div class=\"ico\"><div class=\"iwhy\"></div></div>问题状态:"
                            + result.getProblemStatus() + " </div>");

        } else {
            buffer
                    .append("<div class=\"t1\" id=\"question_status\"><div class=\"ico\"><div class=\"iok\"></div></div>问题状态:"
                            + result.getProblemStatus() + " </div>");

        }
        // 读取中该问题的解决方案的总数和正在投票中的解决方案的数目
        int total_num = solutions.size();
        int voting_num = 0;
        Solution solution = new Solution();
        for (int i = 0; i < solutions.size(); i++) {
            solution = (Solution) solutions.get(i);
            if (solution.getIsVoting().equals("Y")) {
                voting_num++;
            }
        }
        buffer
                .append("<div class =\"t1\" id=\"solution_status\">现共有<span style=\"color:#FF0099\">"
                        + total_num
                        + "</span>个解决方案,其中<span style=\"color:#FF0099\">"
                        + voting_num + "</span>个解决方案在投票中</div>");
        // buffer.append("<div class =\"t1\" id=\"solution_status\"><A
        // class=\"bluelink\" onclick=;
        // href=\"javascript:showProblem(<%=problemId%>);\">查看所有评论</A> </div>");
        // 取出消息的主体
        buffer.append("<div class=\"bc0\"><div class=\"p90\">");
        // 标题
        buffer
                .append("<div class=\"f14 B wr\" id=\"question_title\"> <cq>问题标题: <br>  "
                        + result.getProblemTitle() + "</cq></div>");
        // 悬赏分
        buffer
                .append("<div class=\"wr\" id=\"question_info\"><span class=\"award\"></span><span class=\"red\">悬赏分:"
                        + result.getProblemAward() + "</span> </div>");
        // 问题内容
        ProblemVersion problemversion = new ProblemVersion();
        problemversion.setProblemId(result.getProblemId());

        ArrayList problemversions = cdp.query(problemversion);
        problemversion = (ProblemVersion) problemversions.get(0);
        buffer.append("<div class=\"f14 wr\" id=\"question_content\"><cd>"
                + problemversion.getProblemContent() + "</cd></div>");
        // 嵌入两个div,modify_problem和ambiguity_list用于修改问题
        buffer.append("<div class=\"f14 wr\" id=\"modify_problem\"></div>");
View Full Code Here

            throws EasyJException {

        String order = request.getParameter("order");
        String group = request.getParameter("group");
        StringBuffer buffer = new StringBuffer();
        CompositeDataProxy cdp = CompositeDataProxy.getInstance();
        Problem result = new Problem();
        result = (Problem) cdp.get(problem);
        ArrayList ambiguities = result.getAmbiguitiys();
        if (order.equals("time")) {
            // 原本就是按照时间排序的
        } else {
            Collections.sort(ambiguities);
View Full Code Here

                .getAttribute(Globals.SYS_USER_CACHE);
        Long userId = userCache.getUser().getUserId();

        this.dp = dp;
        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);
View Full Code Here

    public StringBuffer getProblemvalue(Problemvalue problemvalue,
            HttpServletRequest request, boolean vote) throws EasyJException {
        // 这个方法输出问题的价值界面
        ProblemvalueTypeValue pvtv = new ProblemvalueTypeValue();
        StringBuffer buffer = new StringBuffer();
        CompositeDataProxy cdp = CompositeDataProxy.getInstance();
        Object o = BeanUtil
                .getEmptyObject("cn.edu.pku.dr.requirement.elicitation.data.Problemvalue");
        Class clazz = o.getClass();
        SelectCommand scmd = DAOFactory.getSelectCommand(clazz);
        Long problemId = problemvalue.getProblemId();
        Filter filter = DAOFactory.getFilter("problemId", SQLOperator.EQUAL,
                problemId);
        scmd.setFilter(filter);
        Session session = SessionFactory.openSession();
        ArrayList problemvalues = session.query(scmd);
        // 标题
        buffer
                .append("<div class=\"t1\"><div class=\"ico\"><div class=\"icomment\"></div></div>");
        buffer.append("对于问题的价值现有<span style=\"color:#FF0000\">"
                + problemvalues.size() + "</span>个讨论</div>");
        // 投票面板,先从缓存中得到目前用户的信息,然后查看ProblemvalueTypeValue表,是否已经投过票了,这里更高的效率应该是用主子表查询
        SysUserCache userCache = (SysUserCache) request.getSession()
                .getAttribute(Globals.SYS_USER_CACHE);
        Long userId = userCache.getUser().getUserId();
        pvtv.setProblemId(problemvalue.getProblemId());
        // evaluation所有人的关于这个问题可理解行的没有过期的投票结果。
        ArrayList evaluation_num = cdp.query(pvtv);
        pvtv.setCreatorId(userId);
        // 当前登陆者关于这个问题可理解行的没有过期的投票结果。
        ArrayList myevaluation = cdp.query(pvtv);
        o = BeanUtil
                .getEmptyObject("cn.edu.pku.dr.requirement.elicitation.data.ProblemvalueTypeValue");
        clazz = o.getClass();
        scmd = DAOFactory.getSelectCommand(clazz);
        Filter filter2 = DAOFactory.getFilter("creatorId", SQLOperator.EQUAL,
                userId);
        scmd.setFilter(filter2);
        // 查询当前用户是否有或者有过评论
        ArrayList myallevaluation = session.query(scmd);
        session.close();
        // todo:有没有问题应该是针对problem版本的,现在是针problemId,以后需要修改
        if (myallevaluation.size() > 0) {
            if (myevaluation.size() == 0) {
                buffer
                        .append("<div class=\"bc0\" style=\"padding:0px 0pt;\" id=\"notyetvoting\"><div class=\"t2\">问题已修改,请重新投票&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"f12 gray\" style=\"font-weight:normal\">目前有 "
                                + evaluation_num.size() + "个人投票</span>");

                // 已经有过评论,当前评论对应着当前版本。如果版本变化,会对ProblemvalueTypeValue中problemId选到的所有的项的use_state置位为N
                buffer.append(displayProblemvalueTypeEvaluating(myevaluation,
                        evaluation_num, problemvalue, userId).toString());
            } else {
                buffer.append(displayProblemvalueTypeEvaluation(myevaluation,
                        evaluation_num, userId).toString());
                // 已有评论,但是当前版本已经过期
            }
        } else {
            // 目前还没有评论
            buffer
                    .append("<div class=\"bc0\" style=\"padding:0px 0pt;\" id=\"notyetvoting\"><div class=\"t2\">您觉得这个问题的价值有多大,请投票&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"f12 gray\" style=\"font-weight:normal\">目前有 "
                            + evaluation_num.size() + "个人投票</span>");

            buffer.append(displayProblemvalueTypeEvaluating(myevaluation,
                    evaluation_num, problemvalue, userId).toString());
        }

        // 下面是用户讨论的页面
        buffer.append("<div class=\"t2\">对于问题具有价值多少的讨论:</div>");
        buffer
                .append("<a  id=\"problemvalue_order1\" href=\"javascript:Problem.problemvalueOrderByGroup("
                        + problemvalue.getProblemId()
                        + ") \"  style=\"padding :5px 10px 5px 10px!important;padding:4px 10px 4px 10px;height:1px;border:1px solid#7AA9DF;background-color:#EAF3FC;font-size:12px \">按分类排序</a>");
        buffer
                .append("<div id=\"problemvalue_order11\" style=\"display:none\">false</div>");
        buffer
                .append("<a  id=\"problemvalue_order2\"  href=\"javascript:Problem.problemvalueOrderByGoodNum("
                        + problemvalue.getProblemId()
                        + ")\"  style=\"padding:5px 10px 5px 10px!important;padding:4px 10px 4px 10px;height:1px;border:1px solid#7AA9DF;background-color:#EAF3FC;font-size:12px \">按好评升序</a>");
        buffer
                .append("<div id=\"problemvalue_order22\" style=\"display:none\">false</div>");
        buffer.append("<div id=\"viewAllProblemvalue\">");
        String group = "false";
        String good_num = "false";
        Problem problem = new Problem();
        problem.setProblemId(problemvalue.getProblemId());
        problem = (Problem) cdp.get(problem);
        ArrayList problemvalues2 = problem.getProblemvalues();
        if (good_num.equals("true")) {
            Collections.sort(problemvalues2);
        }
        String content = "";
View Full Code Here

    public StringBuffer problemvalueUpdate(ProblemvalueEvaluation pve,
            HttpServletRequest request, HttpServletResponse response)
            throws EasyJException, IOException {
        String confirm;
        String overdue;
        CompositeDataProxy cdp = CompositeDataProxy.getInstance();
        SingleDataProxy sdp = SingleDataProxy.getInstance();
        Problemvalue pv = new Problemvalue();
        pv.setProblemvalueId(pve.getProblemvalueId());
        pv = (Problemvalue) cdp.get(pv);
        StringBuffer xml = new StringBuffer("<result>");
        try {
            if (request.getParameter("flower") != null) {

                pv.setGoodNum(new Long(pv.getGoodNum().intValue() + 1));
                cdp.update(pv);
                pve.setIsGood("Y");
                sdp.create(pve);
                xml
                        .append("<message>success</message><choose>flower</choose><problemvalueId>"
                                + pve.getProblemvalueId()
                                + "</problemvalueId></result>");

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

            }

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

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

        if (request.getParameter("confirm") != null) {
            if (request.getParameter("confirm").equals("y")) {
                pv.setProblemChange("C");
                try {
                    cdp.update(pv);
                    xml
                            .append("<message>success</message><choose>confirm</choose><problemvalueId>"
                                    + pve.getProblemvalueId()
                                    + "</problemvalueId></result>");

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

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

                    cdp.update(pv);
                    xml
                            .append("<message>success</message><choose>reject</choose><problemvalueId>"
                                    + pve.getProblemvalueId()
                                    + "</problemvalueId></result>");

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

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

                pv.setIsoverdue("Y");
                cdp.update(pv);
                xml
                        .append("<message>success</message><choose>overdue</choose><problemvalueId>"
                                + pve.getProblemvalueId()
                                + "</problemvalueId></result>");
View Full Code Here

            }
        }
        String group = request.getParameter("group");
        String good_num = request.getParameter("good_num");
        CompositeDataProxy cdp = CompositeDataProxy.getInstance();
        Problem problem = new Problem();
        problem.setProblemId(problemvalue.getProblemId());
        problem = (Problem) cdp.get(problem);
        ArrayList problemvalues = problem.getProblemvalues();
        if (good_num.equals("true")) {
            Collections.sort(problemvalues);
        }
        String content = "";
View Full Code Here

    private static int i = 0;

    public boolean[] judgeProblem(Problem problem) throws EasyJException {
        boolean[] judgeresult = new boolean[2];
        CompositeDataProxy cdp = CompositeDataProxy.getInstance();
        Problem result = new Problem();
        result = (Problem) cdp.get(problem);
        ArrayList solutions = result.getSolutions();
        // 0为判断是否有修改问题的权限,即判定是不是有正在投票的solution,目前是有问题正在投票就没有修改权限,false是没有修改权限,true是有修改权限
        judgeresult[0] = true;
        Solution solution = new Solution();
        if (solutions.size() > 0) {
View Full Code Here

TOP

Related Classes of easyJ.business.proxy.CompositeDataProxy

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.