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
package com.vci.client.framework.delegate;
 
import com.vci.client.ClientSession;
import com.vci.client.common.objects.UserEntityObject;
import com.vci.client.framework.rightConfig.object.OperateObject;
import com.vci.client.ui.exception.VCIException;
import com.vci.corba.common.VCIError;
import com.vci.corba.framework.data.OperateInfo;
 
/**
 * 操作类型客户端
 * 
 * @author liudi
 * 
 *         2011-6-9
 */
public class OperateClientDelegate extends ClientBaseDelegate{
 
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
 
    public OperateClientDelegate(UserEntityObject userEntityObject) {
        super(userEntityObject);
    }
    
    public OperateClientDelegate() {
    }
 
    /**
     * 保存操作类型
     * 
     * @param OperateObject
     * @return
     * @throws VCIException
     */
    public String saveOperate(OperateObject operateObj) throws VCIException {
        String res = "";
        try{
            res = ClientSession.getFrameworkService().saveOperate(transformPoToIdl(operateObj),userEntityInfo);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
        return res;
    }
    
    /**
     * 修改操作类型
     * 
     * @param OperateObject
     * @return
     * @throws VCIException
     */
    public String updateOperate(OperateObject operateObj) throws VCIException {
        String res = "";
        try{
            res = ClientSession.getFrameworkService().updateOperate(transformPoToIdl(operateObj),userEntityInfo);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
        return res;
    }
    
    /**
     * 删除操作类型
     * 
     * @param id
     * @return
     * @throws VCIException
     */
    public boolean deleteOperate(String id) throws VCIException {
        boolean res = true;
        try{
            res = ClientSession.getFrameworkService().deleteOperate(id,userEntityInfo);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
        return res;
    }
    
    /**
     * 获取操作列表
     * @param moduleId 为空时获取全部操作列表,否则获取除挂接在当前模块下操作之外的列表
     * @return
     * @throws VCIException
     */
    public OperateObject[] getOperateTreeList(String moduleId) throws VCIException {
        OperateObject[] operateObjs = null;
        try{
            OperateInfo[] operateInfos = ClientSession.getFrameworkService().getOperateTreeList(moduleId);
            operateObjs = new OperateObject[operateInfos.length];
            for(int i = 0; i < operateInfos.length;i++ ){
                operateObjs[i] = transformIdlToPo(operateInfos[i]);
            }
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code),e.messages);
        }
        return operateObjs;
    }
 
    /**
     * 检查操作是否被引用
     * @param operateId
     * @return 0表示无引用,1表示被模块引用,2表示有权限信息
     * @throws VCIException
     */
    public int checkOperateIsReferenced(String operateId) throws VCIException {
        try{
            return (int)ClientSession.getFrameworkService().checkOperateIsReferenced(operateId);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code),e.messages);
        }
    }
    
    /**
     * 通过树节点取得信息
     * 
     * @param id
     * @return
     * @throws VCIError
     */
    public OperateObject getOperatetById(String id) throws VCIException {
        try{
            return transformIdlToPo(ClientSession.getFrameworkService().getOperatetById(id));
        }catch(VCIError e) {
            throw new VCIException(String.valueOf(e.code),e.messages);
        }
    }
 
    
    public OperateObject getOperateByIdentify(String identify) throws VCIException {
        try{
            OperateInfo info =  ClientSession.getFrameworkService().getOperateByIdentify(identify);
            return transformIdlToPo(info);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code),e.messages);
        }
    }
    public OperateObject fetchOperateTypeByName(String name) throws VCIException {
        try{
            OperateInfo info =  ClientSession.getFrameworkService().fetchOperateTypeByName(name);
            return transformIdlToPo(info);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code),e.messages);
        }
    }
    
    /**
     * po对象和idl转换
     * 
     * @param o
     * @return
     */
    private OperateInfo transformPoToIdl(OperateObject o) {
        OperateInfo po = new OperateInfo();
        po.id = o.getId() == null ? "" : o.getId();
        po.name = o.getName() == null ? "" : o.getName();
        po.identify = o.getIdentify() == null ? "" : o.getIdentify();
        po.alias = o.getAlias() == null ? "" : o.getAlias();
        po.desc = o.getDesc() == null ? "" : o.getDesc();
        po.seq = o.getSequence();
        return po;
    }
    
    /**
     * idl对象和po转换
     * 
     * @param o
     * @return
     */
    private OperateObject transformIdlToPo(OperateInfo o) {
        OperateObject po = new OperateObject();
        po.setId(o.id);
        po.setName(o.name);
        po.setIdentify(o.identify);
        po.setAlias(o.alias);
        po.setDesc(o.desc);
        po.setSequence(o.seq);
        return po;
    }
    /**
     * 
     * 获得所有操作类型的数量
     * add by caill start 2015.12.11
     * */
    public int getAllOperitionsNum() throws VCIException{
        int res = 0;
        try{
            res = (int)ClientSession.getFrameworkService().getAllOperitionsNum();
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
        return res;
    }
    // add by caill end
    /**
     * 
     * 获得所有的操作类型并导出到.sql文件中
     * add by caill start 2015.12.11
     * */
    public String[][] getAllOperitions(int size) throws VCIException{
        String[][] res = new String[size][6];
        try{
            res = ClientSession.getFrameworkService().getAllOperitions(size);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
        return res;
    }
    // add by caill end
}