Package org.apdplat.module.security.model

Examples of org.apdplat.module.security.model.Position


         */
        @Override
        public void prepareForDelete(Integer[] ids){
            User loginUser=UserHolder.getCurrentLoginUser();
            for(int id :ids){
                Position position=getService().retrieve(Position.class, id);
                boolean canDel=true;
                //获取拥有等待删除的角色的所有用户
                List<User> users=position.getUsers();
                for(User user : users){
                    if(loginUser.getId()==user.getId()){
                        canDel=false;
                    }
                }
View Full Code Here


            ids.addAll(getChildIds(item));
        }
        return ids;
    }
    public static boolean isParentOf(Position parent,Position child){
        Position position=child.getParent();
        while(position!=null){
            if(position.getId()==parent.getId()){
                return true;
            }
            position=position.getParent();
        }
        return false;
    }
View Full Code Here

        }
        return false;
    }
   
    public String toRootJson(boolean recursion){
        Position rootPosition=getRootPosition();
        if(rootPosition==null){
            LOG.error("获取根岗位失败!");
            return "";
        }
        StringBuilder json=new StringBuilder();
        json.append("[");

        json.append("{'text':'")
            .append(rootPosition.getPositionName())
            .append("','id':'position-")
            .append(rootPosition.getId());
            if(rootPosition.getChild().isEmpty()){
                json.append("','leaf':true,'cls':'file'");
            }else{
                json.append("','leaf':false,'cls':'folder'");
               
                if (recursion) {
                    for(Position item : rootPosition.getChild()){
                        json.append(",children:").append(toJson(item.getId(), recursion));
                    }
                }
            }
        json.append("}");
View Full Code Here

        json.append("]");
       
        return json.toString();
    }
    public String toJson(int positionId, boolean recursion){
        Position position=serviceFacade.retrieve(Position.class, positionId);
        if(position==null){
            LOG.error("获取ID为 "+positionId+" 的岗位失败!");
            return "";
        }
        List<Position> child=position.getChild();
        if(child.isEmpty()){
            return "";
        }
        StringBuilder json=new StringBuilder();
        json.append("[");
View Full Code Here

            String[] positionIds = positions.trim().split(",");
            for(String id : positionIds){
                String[] attr = id.split("-");
                if(attr.length == 2){
                    int positionId = Integer.parseInt(attr[1]);
                    Position temp=serviceFacade.retrieve(Position.class, positionId);
                    if(temp != null){
                        model.addPosition(temp);
                        LOG.debug("岗位 " + positionId + " 解析成功");
                    }
                }
View Full Code Here

TOP

Related Classes of org.apdplat.module.security.model.Position

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.