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

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


    }

    public static Integer applyProject(Project project, Long userId)
            throws EasyJException {

        UserProjectRelation relation = new UserProjectRelation();
        relation.setUserId(userId);
        relation.setProjectId(project.getProjectId());
        ArrayList list = sdp.query(relation);
        if (list.size() == 0)
            return 1;
        relation = (UserProjectRelation) list.get(0);
        if (relation.getUserProjectStateRelatedValue() == DictionaryConstant.CANCELED
                || relation.getUserProjectStateRelatedValue() == DictionaryConstant.REJECTED)
            return 1;
        return 0;
    }
View Full Code Here


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

            return;
        }

        dp.setContext(null);
        Project project = (Project) object;
        UserProjectRelation relation = new UserProjectRelation();
        relation.setProjectId(project.getProjectId());
        relation.setUserId(userId);
        ArrayList relations = dp.query(relation);
        Long userProjectStateId = DictionaryProxy.getIdByRelatedValue(
                "PROJECT_APPLY_STATE", new Long(DictionaryConstant.APPLYING));

        // 说明数据不存在。
        if (relations.size() == 0) {
            relation.setUserProjectState(userProjectStateId);
            dp.create(relation);
        } else {
            // 数据存在则只是改变状态,被拒绝或者删除之后,数据是存在的,只是状态不同
            relation = (UserProjectRelation) relations.get(0);
            relation.setUserProjectState(userProjectStateId);
            dp.update(relation);
        }
    }
View Full Code Here

        }
    }

    private void updateApplyState(int state) throws EasyJException {
        dp.setContext(null);
        UserProjectRelation relation = (UserProjectRelation) object;
        relation = (UserProjectRelation) dp.get(relation);
        Long userProjectState = DictionaryProxy.getIdByRelatedValue(
                "PROJECT_APPLY_STATE", new Long(state));
        relation.setUserProjectState(userProjectState);
        dp.update(relation);
    }
View Full Code Here

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

            return;
        }

        dp.setContext(null);
        Project project = (Project) object;
        UserProjectRelation relation = new UserProjectRelation();
        relation.setProjectId(project.getProjectId());
        relation.setUserId(userId);
        ArrayList relations = dp.query(relation);
        Long userProjectStateId = DictionaryProxy.getIdByRelatedValue(
                "PROJECT_APPLY_STATE", new Long(DictionaryConstant.APPLYING));

        // 说明数据不存在。
        if (relations.size() == 0) {
            relation.setUserProjectState(userProjectStateId);
            dp.create(relation);
        } else {
            // 数据存在则只是改变状态,被拒绝或者删除之后,数据是存在的,只是状态不同
            relation = (UserProjectRelation) relations.get(0);
            relation.setUserProjectState(userProjectStateId);
            dp.update(relation);
        }
    }
View Full Code Here

        }
    }

    private void updateApplyState(int state) throws EasyJException {
        dp.setContext(null);
        UserProjectRelation relation = (UserProjectRelation) object;
        relation = (UserProjectRelation) dp.get(relation);
        Long userProjectState = DictionaryProxy.getIdByRelatedValue(
                "PROJECT_APPLY_STATE", new Long(state));
        relation.setUserProjectState(userProjectState);
        dp.update(relation);
    }
View Full Code Here

public class ProjectDetailAction extends SingleDataAction {

  public void getloginProjectsDetails() throws EasyJException {

    CompositeDataProxy cdp = CompositeDataProxy.getInstance();
    UserProjectRelation upr = new UserProjectRelation();
    user = (SysUser) object;
    String resp = "";
    upr.setUserName(user.getUserName());
    Project project = new Project();
    project.setProjectId(upr.getProjectId());
    ArrayList projects = new ArrayList();
    projects = cdp.query(project);
    if (projects.size() > 0) {
      for (int i = 0; i < projects.size(); i++) {
        resp = resp + ((Project) projects.get(i)).getProjectName()
View Full Code Here

TOP

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

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.