dangsn
2024-12-26 4e9ff2ce6a830bb2340d7c8612c72eea0c5a553e
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
package com.vci.client.framework.delegate;
 
import com.vci.client.ClientSession;
import com.vci.client.common.objects.UserEntityObject;
import com.vci.client.framework.systemConfig.log.SystemCfgObject;
import com.vci.client.framework.systemConfig.object.SpecialCharClsfObject;
import com.vci.client.framework.systemConfig.object.SpecialCharObject;
import com.vci.client.ui.exception.VCIException;
import com.vci.corba.common.VCIError;
import com.vci.corba.framework.data.SpecialCharClsfInfo;
import com.vci.corba.framework.data.SpecialCharInfo;
import com.vci.corba.framework.data.SystemCfgInfo;
 
 
public class SystemCfgClientDelegate extends ClientBaseDelegate {
    
    public SystemCfgClientDelegate(UserEntityObject userEntityObject) {
        super(userEntityObject);
    }
    
    public SystemCfgClientDelegate() {
    }
    /**
     * 根据KEY返回conf.properties中定义的数据值
     * <p>Description: </p>
     * 
     * @author xchao
     * @time 2012-9-20
     * @param key
     * @return
     */
    public String getConfigValue(String key) throws VCIException{
        try{
            return ClientSession.getFrameworkService().getConfigValue(key);
        }catch(VCIError e){
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
    }
    
    /**
     * 在指定文件中读取配置信息
     * 如果文件名称是一个相对路径,将先在工作目录下查找文件,
     * 如果没有到包中查找文件,当文件或key不存在时返回""
     * @param propertyPath 文件路径名称
     * @param key
     * @return
     */
//    public String getConfigValue(String propertyPath, String key) throws VCIException{
//        try{
//            return ClientSession.getFrameworkService().getConfigValue(propertyPath, key);
//        }catch(VCIError e){
//            throw new VCIException(String.valueOf(e.code), e.messages);
//        }
//    }
    
    /***
     * 存储特殊字符
     * @param specialCharInfo 要存储的特殊字符
     * @return
     * @throws VCIError
     */
    public String saveSpecialChar(SpecialCharObject[] specialCharObject) throws VCIException {
        String id = "";
        try {
            int length = specialCharObject.length;
            SpecialCharInfo[] specialCharInfos = new SpecialCharInfo[length];
            for (int i = 0; i < length; i++) {
                specialCharInfos[i] = changeSpecialCharObjectToSpecialCharInfo(specialCharObject[i]);
            }
            
            id = ClientSession.getFrameworkService().saveSpecialChar(specialCharInfos, userEntityInfo);
        }catch(VCIError e) {
            this.convertVCIErrorToVCIException(e);
        }
        
        return id;
    }
    
    /***
     * 更新特殊字符
     * @param specialCharInfo 要更新的特殊字符
     * @return
     * @throws VCIError
     */
    public boolean updateSpecialChar(SpecialCharObject specialCharObject) throws VCIException {
        boolean res = false;
        try {
            SpecialCharInfo specialCharInfo = changeSpecialCharObjectToSpecialCharInfo(specialCharObject);
            res = ClientSession.getFrameworkService().updateSpecialChar(specialCharInfo, userEntityInfo);
        }catch(VCIError e) {
            this.convertVCIErrorToVCIException(e);
            throw convertVCIErrorToVCIException(e);
        }
        
        return res;
    }
    
    /***
     * 
     * @param ids  要删除的特殊字符的id
     * @return
     * @throws VCIError
     */
    public boolean deletSpecialChar(String[] ids) throws VCIException {
        boolean res = false;
        try {
            res = ClientSession.getFrameworkService().deletSpecialChar(ids, userEntityInfo);
        }catch(VCIError e) {
            this.convertVCIErrorToVCIException(e);
        }
        return res;
    }
    
    /***
     * 
     * @param id  要删除的特殊字符的PId
     * @return
     * @throws VCIError
     */
    public boolean deleteSpecialCharByParentId(String id) throws VCIError {
        return ClientSession.getFrameworkService().deleteSpecialCharByParentId(id, userEntityInfo);
    }
    
    /***
     * 得到当前分类下的特殊字符
     * @param classId  分类id
     * @return
     * @throws VCIError
     */
    public SpecialCharObject[] fetchSpecialChar(String classId) throws VCIError {
        SpecialCharInfo[] specialCharInfo = ClientSession.getFrameworkService().fetchSpecialChar(classId);
        int length = specialCharInfo.length;
        SpecialCharObject[] specialCharObject = new SpecialCharObject[length];
        for (int i = 0; i < length; i++) {
            specialCharObject[i] = changeSpecialCharInfoToSpecialCharObject(specialCharInfo[i]);
        }
        return specialCharObject;
    }
 
    /***
     * 获取所有特殊字符分类
     * @param 
     * @return
     * @throws VCIError
     */
    public SpecialCharClsfObject[] getSpecialCharClsfList(int pageNo, int pageSize) throws VCIException {
        SpecialCharClsfObject[] specialCharClsfObject = {};
        try {
            SpecialCharClsfInfo[] specialCharClsfInfo = ClientSession.getFrameworkService().getSpecialCharClsfList(pageNo,pageSize);
            int length = specialCharClsfInfo.length;
            specialCharClsfObject = new SpecialCharClsfObject[length];
            for (int i = 0; i < length; i++) {
                specialCharClsfObject[i] = changeSpecialCharClsfInfoToSpecialCharClsfObject(specialCharClsfInfo[i]);
            }
        } catch (VCIError e) {
            throw convertVCIErrorToVCIException(e);
        }
        return specialCharClsfObject;
    }
    
    public SpecialCharClsfObject[] getSpecialCharClsfList() throws VCIException {
        SpecialCharClsfObject[] specialCharClsfObject = {};
        try {
            SpecialCharClsfInfo[] specialCharClsfInfo = ClientSession.getFrameworkService().getAllSpecialCharClsfList();
            int length = specialCharClsfInfo.length;
            specialCharClsfObject = new SpecialCharClsfObject[length];
            for (int i = 0; i < length; i++) {
                specialCharClsfObject[i] = changeSpecialCharClsfInfoToSpecialCharClsfObject(specialCharClsfInfo[i]);
            }
        } catch (VCIError e) {
            throw convertVCIErrorToVCIException(e);
        }
        return specialCharClsfObject;
    }
    
    /**
     * 得到特殊字符分类总数
     * <p>Description: </p>
     * 
     * @author Administrator
     * @time 2013-1-3
     * @return
     * @throws VCIException
     */
    public int getSpecialCharClsTotal() throws VCIException {
        int total = 0;
        try {
            total = (int)ClientSession.getFrameworkService().getSpecialCharClsTotal();
        }catch(VCIError e) {
            this.convertVCIErrorToVCIException(e);
        }
        return total;
    }
 
    /***
     * 存储特殊字符分类
     * @param specialCharClsfInfo  特殊字符分类对象
     * @return
     * @throws VCIError
     */
    public String saveSpecialCharClsf(SpecialCharClsfObject specialCharClsfObject) throws VCIException {
        String returnVal = "";
        try {
            SpecialCharClsfInfo specialCharClsfInfo = changeSpecialCharClsfObjectToSpecialCharClsfInfo(specialCharClsfObject);
            returnVal = ClientSession.getFrameworkService().saveSpecialCharClsf(specialCharClsfInfo, userEntityInfo);
        }catch(VCIError e) {
            this.convertVCIErrorToVCIException(e);
        }
        return returnVal;
    }
 
    /***
     *  更新特殊字符分类
     * @param specialCharInfo  要跟新的特殊字符分类
     * @return
     * @throws VCIError
     */
    public boolean updateSpecialCharClsf(SpecialCharClsfObject specialCharClsfObject) throws VCIException {
        boolean res = false;
        try {
            SpecialCharClsfInfo specialCharClsfInfo = changeSpecialCharClsfObjectToSpecialCharClsfInfo(specialCharClsfObject);
            res = ClientSession.getFrameworkService().updateSpecialCharClsf(specialCharClsfInfo, userEntityInfo);
        }catch (VCIError e) {
            this.convertVCIErrorToVCIException(e);
        }
        return res;
    }
/***
 * 根据字符分类获取字符
 * @param plscsfoId
 * @return
 */
    public SpecialCharObject[] getBychar(String plscsfoId){
        SpecialCharObject[] specialCharObject=null;
            try {
            SpecialCharInfo[] info=ClientSession.getFrameworkService().getBychar(plscsfoId);
             specialCharObject=new SpecialCharObject[info.length];
            
            for (int i = 0; i < info.length; i++) {
                specialCharObject[i]=changeSpecialCharInfoToSpecialCharObject(info[i]);
            }
            
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        
        
        return specialCharObject;
    }
    
    /***
     * 
     * @param ids  要删除的特殊字符分类的id
     * @return
     * @throws VCIError
     */
    public boolean deletSpecialCharClsf(String[] ids) throws VCIException {
        boolean res = false;
        try {
            res = ClientSession.getFrameworkService().deletSpecialCharClsf(ids, userEntityInfo);
        }catch (VCIError e) {
            this.convertVCIErrorToVCIException(e);
        }
        return res;
    }
    
    /***
     * 特殊字符分类,从客户端对象到corba对象
     * @param specialCharClsf
     * @return
     */
    private SpecialCharClsfInfo changeSpecialCharClsfObjectToSpecialCharClsfInfo(SpecialCharClsfObject specialCharClsfObject) {
        SpecialCharClsfInfo specialCharClsfInfo = new SpecialCharClsfInfo();
        specialCharClsfInfo.id = specialCharClsfObject.getId() == null ?  "" : specialCharClsfObject.getId();
        specialCharClsfInfo.name = specialCharClsfObject.getName();
        specialCharClsfInfo.desc = specialCharClsfObject.getDesc();
        return specialCharClsfInfo;
    }
    
    /***
     * 特殊字符分类,从corba对象到客户端对象
     * @param specialCharClsfInfo
     * @return
     */
    private SpecialCharClsfObject changeSpecialCharClsfInfoToSpecialCharClsfObject(SpecialCharClsfInfo specialCharClsfInfo) {
        SpecialCharClsfObject specialCharClsfObject = new SpecialCharClsfObject();
        specialCharClsfObject.setId(specialCharClsfInfo.id);
        specialCharClsfObject.setDesc(specialCharClsfInfo.desc);
        specialCharClsfObject.setName(specialCharClsfInfo.name);
        return specialCharClsfObject;
    }
    
    /***
     * 特殊字符,从corba对象到客户端对象
     * @param specialCharInfo
     * @return
     */
    private SpecialCharObject changeSpecialCharInfoToSpecialCharObject(SpecialCharInfo specialCharInfo) {
        SpecialCharObject specialChar = new SpecialCharObject();
        specialChar.setId(specialCharInfo.id);
        specialChar.setValue(specialCharInfo.value);
        specialChar.setParentId(specialCharInfo.parentId);
        return specialChar;
    }
    
    /***
     * 特殊字符,从客户端对象到corba对象
     * @param specialCharObject
     * @return
     */
    private SpecialCharInfo changeSpecialCharObjectToSpecialCharInfo(SpecialCharObject specialCharObject) {
        SpecialCharInfo specialCharInfo = new SpecialCharInfo();
        specialCharInfo.id = specialCharObject.getId() == null ?  "" : specialCharObject.getId();
        specialCharInfo.value = specialCharObject.getValue();
        specialCharInfo.parentId = specialCharObject.getParentId();
        return specialCharInfo;
    }
    
    /***
     *    系统配置对象从corba对象到客户端对象
     * @param systemCfgInfo
     * @return
     */
    public SystemCfgObject changeSystemCfgInfoToSystemCfgObject(SystemCfgInfo systemCfgInfo) {
        SystemCfgObject systemCfg = new SystemCfgObject();
        systemCfg.setId(systemCfgInfo.id);
        systemCfg.setName(systemCfgInfo.name);
        systemCfg.setValue(systemCfgInfo.value);
        return systemCfg;
    }
    
    /***
     *   系统配置对象从客户端对象到corba对象
     * @param systemCfgObject
     * @return
     */
    public SystemCfgInfo changeSystemCfgObjectToSystemCfgInfo(SystemCfgObject systemCfgObject) {
        SystemCfgInfo systemCfgInfo = new SystemCfgInfo();
        systemCfgInfo.id = systemCfgObject.getId() == null ?  "" : systemCfgObject.getId();
        systemCfgInfo.name = systemCfgObject.getName();
        systemCfgInfo.value = systemCfgObject.getValue();
        return systemCfgInfo;
    }
    
}