ludc
2024-09-14 36c2449aec5b51e5ed4e5c6841154b746060e09a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.vci.client.omd.enumManager.toOutside;
 
import java.util.ArrayList;
import java.util.HashMap;
 
import com.vci.client.common.providers.ServiceProvider;
import com.vci.corba.common.VCIError;
import com.vci.corba.omd.etm.EnumChild;
import com.vci.corba.omd.etm.EnumItem;
 
/**
 * 根据枚举类型查询枚举
 * @author Administrator
 *
 */
public class GetEnumForOut {
    
    /**
     * 根据枚举类型查询枚举:枚举名 , 枚举
     * @param enumType:String, Integer
     * @return
     */
    public HashMap<String, ArrayList<String>> getEnumMap(String enumType){
        HashMap<String, ArrayList<String>> enumMap = new HashMap<String, ArrayList<String>>();
        EnumItem[] emArray = null;
        try {
            emArray = ServiceProvider.getOMDService().getEnumService().getEmItemsByType(enumType);
        } catch (VCIError e) {
            e.printStackTrace();
        }
        if(emArray == null || emArray.length == 0){
            return null;
        }
        EnumItem emItem;
        for(int i = 0; i < emArray.length; i++){
            emItem = emArray[i];
            EnumChild[] emChildren = emItem.children;
            ArrayList<String> valueList = new ArrayList<String>();
            for(int k = 0; k < emChildren.length; k++){
                EnumChild emChild = emChildren[k];
                String value = emChild.value;
                valueList.add(value);
            }
            enumMap.put(emItem.name, valueList);
        }
        
        return enumMap;
    }
}