directoryattr.d

来自「本人课程设计时做的一个用struts框架实现的基于cmmi2的项目管理系统的原型」· D 代码 · 共 92 行

D
92
字号
package com.cmmi2pms.cm;

import java.util.*;                                                        
import com.cmmi2pms.common.comdb.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.io.*;
/** class DirectoryAttr 
 * it's a java bean,store the attributes of a directory
 * @author LinRong
 * @version 1.0
*/
public class DirectoryAttr
{
    
    private String mode=new String("");         
    
    //relative path of this directory
    private String dirName;        
    
    //absolute path of configuration repositoty
    private String repositoryPath="E:\\CMP";
    private String[] fileList;
    private String user;
    
    private SqlDB dbf = new SqlDB();
    private ResultSet rs = null;
    
    /** 
     * @param:userID,pathname
    */
    DirectoryAttr(String userID,String pathname) throws SQLException,Exception
    {   
	File path;
        this.user = userID;
	this.dirName = pathname;
	path = new File(repositoryPath+dirName);//May be can use another method to get file list;
	fileList = path.list(); 
	
       /*
	  ADD:判断使用者的权限是否有访问此目录权限,无则mode="";
	*/
        
        dbf.setSql("select *.position from 'employee' where userid = ? ");
        dbf.setString(1,user);
        rs = dbf.executeQuery();
	
	/*if ( !rs ) 
	{
	   
        }*/
	
	if ( rs.getString(1).equals("cc" ) )
	{
	    mode = "R+W";
	}
	else
	{
	    mode = "R";
	}
    }

    public String[] refresh()
    {
	File path = new File(repositoryPath+dirName);
        this.fileList = path.list(); 
	return (this.fileList);
    }

    public String getdirName() 
    {
	return (this.dirName);
    }

    public String getuser()
    {
	return (this.user);
    }

    public String[] getfileList()
    {
	return (this.fileList);
    }

    public String getmode()
    {
	return (this.mode);
    }

}
    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?