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

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


    public TestCompositeData() {}

    public static void main(String[] args) {
        try {
            CompositeDataFacade cdf = new CompositeDataFacade();
            Scenario scenario = new Scenario();
            scenario.setScenarioId(new Long(1));
            scenario = (Scenario) cdf.get(scenario);
            int a = 0;
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here


    SingleDataProxy sdp = SingleDataProxy.getInstance();
    Project p = new Project();
    p.setProjectName(projectName);
    p = (Project) sdp.get(p);
    // 得到该项目的所有的场景
    Scenario s = new Scenario();
    s.setProjectId(p.getProjectId());
    scenarios = cdp.query(s);
    if (scenarios.size() > 0) {
      for (int i = 0; i < scenarios.size(); i++) {
        s = (Scenario) scenarios.get(i);
        document.add(new Paragraph(""));
        // 加场景名
        document.add(new Paragraph("场景" + (i + 1) + ": "
            + s.getScenarioName().toString(),
            RtfParagraphStyle.STYLE_HEADING_1));
        // TODO 加用况
        UseCase uc = new UseCase();
        uc.setScenarioId(s.getScenarioId());
        ArrayList ucs = cdp.query(uc);
        if (ucs.size() > 0) {
          for (int j = 0; j < ucs.size(); j++) {

            uc = (UseCase) ucs.get(j);
View Full Code Here

       
        //得到用户参与的场景,如果是owner,则应该得到所有此项目的场景,否则
        //找出所有此用户拥有权限的场景,包括两部分,一部分是他作为某个角色的拥有者参与了场景的讨论,另一种是他作为场景的查看者
        //可以查看场景,这个数据是从UserScenarioRelation中得到。 将这两部分数据统一转换为Scenario类型的
        if(context.getProjectRole()==DictionaryConstant.OWNER) {
            Scenario scenario=new Scenario();
            sourceList=dp.query(scenario);
        }else {
            String roles=user.getRoleIds();
            if(!GenericValidator.isBlankOrNull(roles)) {
                roles=roles.substring(1,roles.length()-1);
               
                SelectCommand scmd = DAOFactory.getSelectCommand(ScenarioRoleRelation.class);
               
                String[] rolesArr=roles.split(",");
                Long[] primaryKeysLong = new Long[rolesArr.length];
                for (int i = 0; i < rolesArr.length; i++)
                    primaryKeysLong[i] = new Long(rolesArr[i]);
                Filter filter=DAOFactory.getFilter("roleId",SQLOperator.IN,primaryKeysLong);
                Filter topFilter=DAOFactory.getFilter();
                topFilter.addFilter(filter);
                scmd.setFilter(topFilter);
                ArrayList relationList=dp.query(scmd);
               
                for(int i=0;i<relationList.size();i++) {
                    ScenarioRoleRelation relation=(ScenarioRoleRelation)relationList.get(i);
                    Scenario scenario=new Scenario();
                    scenario.setScenarioId(relation.getScenarioId());
                    scenario.setScenarioName(relation.getScenarioName());
                    sourceList.add(scenario);
                }
            }
            //得到用户可以查看的场景
           
            UserScenarioRelation relation=new UserScenarioRelation();
            relation.setUserId(userId);
            ArrayList relationList=dp.query(relation);
            for(int i=0;i<relationList.size();i++) {
                relation=(UserScenarioRelation)relationList.get(i);
                Scenario scenario=new Scenario();
                scenario.setScenarioId(relation.getScenarioId());
                scenario.setScenarioName(relation.getScenarioName());
                sourceList.add(scenario);
            }
        }
       
        StringBuffer buffer= HtmlClientComponentService.getMultiSelect(sourceList, new ArrayList(), "scenarioName",Scenario.class);
View Full Code Here

        StringBuffer sdbuffer=new StringBuffer(); //场景和数据之间的
        StringBuffer rdbuffer=new StringBuffer(); //角色和数据之间的

        int size=scenarioList.size();
        for(int i=0;i<size;i++) {
            Scenario scenario=(Scenario)scenarioList.get(i);
            String scenarioName=scenario.getScenarioName();
            if(sbuffer.indexOf(scenarioName)<0) {
                sbuffer.append(scenarioName);
                sbuffer.append("\n");
            }
        }
View Full Code Here

        StringBuffer srbuffer=new StringBuffer()//场景和角色之间的
        StringBuffer ssdbuffer=new StringBuffer(); //场景之间共有的数据

        int size=scenarioList.size();
        for(int i=0;i<size;i++) {
            Scenario scenario=(Scenario)scenarioList.get(i);
            String scenarioName=scenario.getScenarioName();
            if(sbuffer.indexOf(scenarioName)<0) {
                sbuffer.append(scenarioName);
                sbuffer.append("\n");
            }
        }
View Full Code Here

    // dp.create(sd);
    // returnMessage="添加成功";
    // }
    // 
    public void saveScenarioName() throws EasyJException {
        Scenario scenario = (Scenario) object;
        Scenario temp = new Scenario();
        temp.setScenarioId(scenario.getScenarioId());
        temp = (Scenario) dp.get(temp);
        temp.setScenarioName(scenario.getScenarioName());
        dp.update(temp);
        returnMessage = "保存成功";
    }
View Full Code Here

    }

    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
View Full Code Here

            this.returnPath = Globals.SINGLE_DATA_EDIT_RETURN_PARTH;
        request.setAttribute(Globals.OBJECT, object);
    }

    public void apply() throws EasyJException {
        Scenario scenario = (Scenario) object;
        UserScenarioRelation relation = new UserScenarioRelation();
        relation.setScenarioId((scenario.getScenarioId()));
        relation.setUserId(userId);
        Long applyState = DictionaryProxy.getIdByRelatedValue(
                "PROJECT_APPLY_STATE", new Long(DictionaryConstant.APPLYING));
        relation.setApplyState(applyState);
        dp.create(relation);
View Full Code Here

        dp.create(relation);
    }

    public void paint() {
        try {
            Scenario scenario = (Scenario) cdp.get(object);
            // 在这里得到description,需要注意的是,当对参与场景的用户进行调整的时候,并没有把删除掉的角色的描述删掉,
            // 所以,在这里还是会碰到虽然没有参与此场景的描述,但依然会有描述的情况。 所以要把这些过滤掉。
            ArrayList descriptions = scenario.getDescriptions();
            StringBuffer buffer = new StringBuffer();
            ArrayList roles = scenario.getRoles();
            int roleSize = scenario.getRoles().size();
            // 找出所有的参与者
            String participants = ",";
            for (int j = 0; j < roleSize; j++) {
                ScenarioRoleRelation role = (ScenarioRoleRelation) roles.get(j);
                if ("participant".equals(role.getRoleType())) {
                    participants = participants + role.getRoleId() + ",";
                }
            }
            for (int i = 0; i < descriptions.size(); i++) {
                Description description = (Description) descriptions.get(i);
                if (participants.indexOf("," + description.getRoleId() + ",") >= 0) {
                    String content = HtmlTransformer
                            .getGraphSourceString(description
                                    .getDescriptionContent());
                    content = content.replaceAll("\u00a0", " ");
                    buffer.append(description.getRoleName() + "\n" + content
                            + "\n");
                    buffer.append(HtmlTransformer.SWIMLANE_SEP + "\n");
                }
            }
            System.out.println(buffer.toString());
            String fileName = ".txt";
            String nodeFileName = userId + "node" + scenario.getScenarioId()
                    + fileName;
            String edgeFileName = userId + "edge" + scenario.getScenarioId()
                    + fileName;

            String test = new String(buffer.toString().getBytes("GBK"),
                    "ISO-8859-1");
            Myparser.parseString(test, application.getRealPath(nodeFileName),
View Full Code Here

            e.printStackTrace();
        }
    }

    public void newObject() throws EasyJException {
        Scenario scenario = (Scenario) object;
        scenario.setCstId(user.getCstId());
        scenario.setCreatorId(userId);
        super.newObject();
    }
View Full Code Here

TOP

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

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.