ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.vci.client.portal.utility;
 
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
 
import com.vci.client.bof.ClientBusinessObject;
import com.vci.client.bof.ClientLinkObject;
import com.vci.client.framework.delegate.RightManagementClientDelegate;
import com.vci.client.ui.exception.VCIException;
import com.vci.corba.omd.data.AttributeValue;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.data.LinkObject;
 
public class CBOHelper {
 
 
    public static Map<String, String>[] getLOValueMap(LinkObject[] los){
        @SuppressWarnings("unchecked")
        Map<String, String>[] res = new LinkedHashMap[los.length];
        for (int i = 0; i < res.length; i++) {
            res[i] = getLOValueMap(los[i]);
        }
        return res;
    }
    
    public static Map<String, String> getLOValueMap(LinkObject lo){
        Map<String, String> res = new LinkedHashMap<String, String>();
        for(AttributeValue av : lo.hisAttrValList){
            res.put(av.attrName.toLowerCase(), av.attrVal);
        }
        return res;
    }
    
    public static Map<String, String>[] getBOValueMap(BusinessObject[] bos){
        @SuppressWarnings("unchecked")
        Map<String, String>[] res = new LinkedHashMap[bos.length];
        for (int i = 0; i < res.length; i++) {
            res[i] = getBOValueMap(bos[i]);
        }
        return res;
    }
    
    public static Map<String, String> getBOValueMap(BusinessObject bo){
        Map<String, String> res = new LinkedHashMap<String, String>();
        for(AttributeValue av : bo.hisAttrValList){
            res.put(av.attrName.toLowerCase(), av.attrVal);
        }
        return res;
    }
 
    /**
     * 返回服务器端的日期 yyyy-MM-dd
     * @return
     */
    public static String getDBDateString(){
        return getDBDateTimeString("yyyy-MM-dd");
    }
 
    public static String getDBTimeString(String format){
        return getDBDateTimeString("hh:mm:ss");
    }
    /**
     * 返回服务器端时间字符串
     * @param dateFormat 日期&时间格式字符串 yyyy-MM-dd
     * @return
     */
    private static String getDBDateTimeString(String format){
        String res = "";
        try {
            long time = new RightManagementClientDelegate().getSystemTime();
            SimpleDateFormat sdf = new SimpleDateFormat(format);
            res = sdf.format(new Date(time));
        } catch (VCIException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return res;
    }
}