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

Examples of cn.edu.pku.dr.requirement.elicitation.system.Context


    public void view() throws EasyJException {
        Project project = (Project) object;
        project = (Project) dp.get(project);
        SysUserCache userCache = (SysUserCache) request.getSession()
                .getAttribute(Globals.SYS_USER_CACHE);
        Context context = new Context();
        context.setProjectId(project.getProjectId());
        context.setProjectName(project.getProjectName());
        // 下面的程序用来确定此用户在此project中的角色

        // 1.首先确定是不是owner。
        if (project.getCreatorId().longValue() == user.getUserId().longValue()) {
            context.setProjectRole(DictionaryConstant.OWNER);
        } else {
            // 2.判断用户是否是参与了当前项目
            UserProjectRelation relation = new UserProjectRelation();
            relation.setUserId(user.getUserId());
            relation.setProjectId(project.getProjectId());
            ArrayList relationList = dp.query(relation);
            // 如果不存在数据,说明没有加入;否则根据状态来确定。
            if (relationList.size() == 0) {
                context.setProjectRole(DictionaryConstant.OTHER);
            } else {
                relation = (UserProjectRelation) relationList.get(0);
                int applyState = relation.getUserProjectStateRelatedValue()
                        .intValue();
                // 此状态请参见表dictionary中的PROJECT_APPLY_STATE 对应的related value部分。
                switch (applyState) {
                    case 2:
                        context.setProjectRole(DictionaryConstant.GROUP);
                        break;
                    default:
                        context.setProjectRole(DictionaryConstant.OTHER);
                        break;
                }
            }
        }

        userCache.setContext(context);

        HashMap<String,String> roles = context.getRoles();
        roles.clear();
       
        //将此项目所拥有的角色加入环境当中
        Role role = new Role();
        role.setProjectId(project.getProjectId());
View Full Code Here


        classes = new ArrayList();
        displayProperties = new Hashtable();
        editProperties = new Hashtable();
        queryProperties = new Hashtable();
        interests = new ArrayList();
        context = new Context();
    }
View Full Code Here

    public void view() throws EasyJException {
        Project project = (Project) object;
        project = (Project) dp.get(project);
        SysUserCache userCache = (SysUserCache) request.getSession()
                .getAttribute(Globals.SYS_USER_CACHE);
        Context context = new Context();
        context.setProjectId(project.getProjectId());
        context.setProjectName(project.getProjectName());
        // 下面的程序用来确定此用户在此project中的角色

        // 1.首先确定是不是owner。
        if (project.getCreatorId().longValue() == user.getUserId().longValue()) {
            context.setProjectRole(DictionaryConstant.OWNER);
        } else {
            // 2.判断用户是否是参与了当前项目
            UserProjectRelation relation = new UserProjectRelation();
            relation.setUserId(user.getUserId());
            relation.setProjectId(project.getProjectId());
            ArrayList relationList = dp.query(relation);
            // 如果不存在数据,说明没有加入;否则根据状态来确定。
            if (relationList.size() == 0) {
                context.setProjectRole(DictionaryConstant.OTHER);
            } else {
                relation = (UserProjectRelation) relationList.get(0);
                int applyState = relation.getUserProjectStateRelatedValue()
                        .intValue();
                // 此状态请参见表dictionary中的PROJECT_APPLY_STATE 对应的related value部分。
                switch (applyState) {
                    case 2:
                        context.setProjectRole(DictionaryConstant.GROUP);
                        break;
                    default:
                        context.setProjectRole(DictionaryConstant.OTHER);
                        break;
                }
            }
        }

        userCache.setContext(context);

        HashMap<String,String> roles = context.getRoles();
        roles.clear();
       
        //将此项目所拥有的角色加入环境当中
        Role role = new Role();
        role.setProjectId(project.getProjectId());
View Full Code Here

     */
    public static StringBuffer getFunction(HttpServletRequest request,
            String className, String pageName, String position)
            throws EasyJException {
        // 得到当前的上下文
        Context context = sdp.getContext();

        // 定义当前登陆的人在context中的角色,在不同的环境下角色的区分是不同的。
        // 在当前这个项目里面context主要是指Project Context,而不同的项目context可能会不同,角色也可能会不同。
        // 所以在将来这里应该用某种规则或者配置文件的形式来表达,而不应该写程序在这里。
        // 但一般情况下角色大部分分为owner, group, other,所以这里就暂时直接设定为
        int role = DictionaryConstant.OTHER;
        if (context != null) {
            role = context.getProjectRole();
        }

        /* 获得功能列表 */
        StringBuffer buffer = new StringBuffer();
        PageFunction function = new PageFunction();
View Full Code Here

        classes = new ArrayList();
        displayProperties = new Hashtable();
        editProperties = new Hashtable();
        queryProperties = new Hashtable();
        interests = new ArrayList();
        context = new Context();
    }
View Full Code Here

   */
  public static StringBuffer getFunction(HttpServletRequest request,
      String className, String pageName, String position)
      throws EasyJException {
    // 得到当前的上下文
    Context context = sdp.getContext();

    // 定义当前登陆的人在context中的角色,在不同的环境下角色的区分是不同的。
    // 在当前这个项目里面context主要是指Project Context,而不同的项目context可能会不同,角色也可能会不同。
    // 所以在将来这里应该用某种规则或者配置文件的形式来表达,而不应该写程序在这里。
    // 但一般情况下角色大部分分为owner, group, other,所以这里就暂时直接设定为
    int role = DictionaryConstant.OTHER;
    if (context != null) {
      role = context.getProjectRole();
    }

    /* 获得功能列表 */
    StringBuffer buffer = new StringBuffer();
    PageFunction function = new PageFunction();
View Full Code Here

TOP

Related Classes of cn.edu.pku.dr.requirement.elicitation.system.Context

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.