package com.vci.server.framework.systemConfig.specialRole;
|
|
import java.util.ArrayList;
|
import java.util.Iterator;
|
import java.util.List;
|
import java.util.Map;
|
|
import org.springframework.context.support.FileSystemXmlApplicationContext;
|
|
public class SpecialroleService {
|
|
//spring配置文件路径
|
private static String[] contestpaths = new String[]{"properties/applicationContext.xml"};
|
// ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext(contestpaths);
|
//通过相对路径读取配置文件
|
private static FileSystemXmlApplicationContext fileSystemXmlApplicationContext = new FileSystemXmlApplicationContext(contestpaths);
|
public static FileSystemXmlApplicationContext getFileSystemXmlApplicationContext() {
|
return fileSystemXmlApplicationContext;
|
}
|
public static void setFileSystemXmlApplicationContext(
|
FileSystemXmlApplicationContext fileSystemXmlApplicationContext) {
|
SpecialroleService.fileSystemXmlApplicationContext = fileSystemXmlApplicationContext;
|
}
|
|
/**
|
* 获取三员角色登录模块信息
|
* @return
|
*/
|
public SpecialRoleObject[] getSpecialRoleList(){
|
List<SpecialRoleObject> list = new ArrayList<SpecialRoleObject>();
|
Map<String, SpecialRoleObject> beansOfType = fileSystemXmlApplicationContext.getBeansOfType(SpecialRoleObject.class);
|
Iterator<String> iterator = beansOfType.keySet().iterator();
|
while(iterator.hasNext()){
|
String next = iterator.next();
|
SpecialRoleObject specialRoleObject = beansOfType.get(next);
|
list.add(specialRoleObject);
|
}
|
return list.toArray(new SpecialRoleObject[]{});
|
}
|
|
|
/**
|
* 获取过滤功能编号
|
* @return
|
*/
|
public List<String> getFilterFunctionNos(){
|
try{
|
SpecialRoleRightFilter filter = fileSystemXmlApplicationContext.getBean(SpecialRoleRightFilter.class);
|
if(filter != null && filter.getFilterFunctionNos() != null){
|
return filter.getFilterFunctionNos();
|
}
|
}catch(Throwable e){
|
|
}
|
return new ArrayList<String>();
|
}
|
|
public static void main(String[] args){
|
String[] contestpaths = new String[]{"properties/applicationContext.xml"};
|
// ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext(contestpaths);
|
//通过相对路径读取配置文件
|
FileSystemXmlApplicationContext fileSystemXmlApplicationContext = new FileSystemXmlApplicationContext(contestpaths);
|
Map<String, SpecialRoleObject> beansOfType = fileSystemXmlApplicationContext.getBeansOfType(SpecialRoleObject.class);
|
Iterator<String> iterator = beansOfType.keySet().iterator();
|
while(iterator.hasNext()){
|
String next = iterator.next();
|
SpecialRoleObject specialRoleObject = beansOfType.get(next);
|
//System.out.println(specialRoleObject.getPanelName());
|
}
|
}
|
}
|