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
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.FuncOperationObject;
import com.vci.client.framework.rightConfig.object.FunctionObject;
import com.vci.client.ui.exception.VCIException;
import com.vci.corba.common.VCIError;
import com.vci.corba.framework.data.FuncOperationInfo;
import com.vci.corba.framework.data.FunctionInfo;
 
public class FuncOperationClientDelegate extends ClientBaseDelegate {
    
    public FuncOperationClientDelegate(UserEntityObject userEntityObject){
        super(userEntityObject);
    }
    
    public FuncOperationClientDelegate(){
        
    }
    
    /**
     * 获取模块下的操作,如果操作ID为空,则获取模块下的全部操作
     * @param functionId 模块ID
     * @param operateId  操作ID
     * @param onlyIsValid onlyIsValid 参数表示是否仅仅返回是生效的操作 true:是 false :不是(此时返回模块下全部的操作,仅在定义模块下的操作时需要返回全部的操作,其它情况需要均只需要返回生效的操作) 
     * @return
     * @throws VCIException
     */
    public FuncOperationObject[] getFuncOperationByModuleId(String functionId,String operateId, boolean onlyIsValid) throws VCIException {
        FuncOperationObject[] objs = null;
        try{
            FuncOperationInfo[] infos = ClientSession.getFrameworkService().getFuncOperationByModule(functionId,operateId, onlyIsValid);
            objs = new FuncOperationObject[infos.length];
            for(int i = 0;i < infos.length ;i++){
                objs[i] = changeFuncOperationInfoToObj(infos[i]);
            }
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
        return objs;
    }
    /**
     * 保存模块下的操作
     * @param funcOperationObjs
     * @return
     * @throws VCIException
     */
    public boolean saveFuncOperation(FuncOperationObject[] funcOperationObjs) throws VCIException {
        boolean res = true;
        try{
            FuncOperationInfo[] funcOperationInfos = new FuncOperationInfo[funcOperationObjs.length];
            for(int i = 0;i < funcOperationObjs.length;i++){
                funcOperationInfos[i] = changeFuncOperationObjToInfo(funcOperationObjs[i]);
            }
            res = ClientSession.getFrameworkService().saveFuncOperation(funcOperationInfos, userEntityInfo);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code),e.messages);
        }
        return res;
    }
    
    public boolean updateFuncOperation(String id , String alias, boolean isSelected) throws VCIException {
        boolean res = false;
        try{
            res = ClientSession.getFrameworkService().updateFuncOperation(id, alias, isSelected, userEntityInfo);
        }catch(VCIError e){
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
        return res;
    }
    /**
     * 移除模块下的操作
     * @param funcOperationObj
     * @return
     * @throws VCIException
     */
    public boolean deleteFuncOperation(FuncOperationObject funcOperationObj) throws VCIException{
        boolean res = true;
        try{
            res = ClientSession.getFrameworkService().deleteFuncOperation(changeFuncOperationObjToInfo(funcOperationObj), userEntityInfo);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
        return res;
    }
    
    /**
     * 根据操作的标识和模块ID获取挂接关系对象
     * @param functionId
     * @param identify
     * @return
     * @throws VCIException
     */
    public FuncOperationObject getFuncOperationByIdentify(String functionId,String identify) throws VCIException {
        try{
            FuncOperationInfo info = ClientSession.getFrameworkService().getFuncOperationByIdentify(functionId,identify);
            return changeFuncOperationInfoToObj(info);
        }catch (VCIError e) {
            e.printStackTrace();
            throw new VCIException(String.valueOf(e.code), e.messages);
        }
    }
    
    private FuncOperationObject changeFuncOperationInfoToObj(FuncOperationInfo info){
        FuncOperationObject obj = new FuncOperationObject();
        obj.setId(info.id);
        obj.setFuncId(info.funcId);
        obj.setOperId(info.operId);
        obj.setOperName(info.operName);
        obj.setOperIndentify(info.operIndentify);
        obj.setOperAlias(info.operAlias);
        obj.setOperDesc(info.operDesc);
        obj.setNumber(info.number);
        obj.setIsValid(info.isValid);
        return obj;
    }
    
    private FuncOperationInfo changeFuncOperationObjToInfo(FuncOperationObject obj){
        FuncOperationInfo info = new FuncOperationInfo();
        info.id = obj.getId() == null ? "" : obj.getId();
        info.funcId = obj.getFuncId() == null ? "" : obj.getFuncId();
        info.operId = obj.getOperId() == null ? "" : obj.getOperId();
        info.operName = obj.getOperName() == null ? "" : obj.getOperName();
        info.operIndentify = obj.getOperIndentify() == null ? "" : obj.getOperIndentify();
        info.operAlias = obj.getOperAlias() == null ? "" : obj.getOperAlias();
        info.operDesc = obj.getOperDesc() == null ? "" : obj.getOperDesc();
        info.number = obj.getNumber();
        info.isValid = obj.getIsValid();
        return info;
    }
    /**
     * 导入操作和模块关系对象
     * add by caill
     * */
    public String saveFunOper(FuncOperationObject funcOperationObject) throws VCIException{
        
         try {
            ClientSession.getFrameworkService().saveFunOper(changeFuncOperationObjToInfo(funcOperationObject));
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }    
    /**
     * 保存操作类型        
     * add by caill
     * */
    public boolean saveFuncOperation2(FuncOperationObject funcOperationObject) throws VCIException{
        
         try {
            ClientSession.getFrameworkService().saveFuncOperation2(changeFuncOperationObjToInfo(funcOperationObject),userEntityInfo);
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return true;
    }    
    /**
     * 覆盖操作类型        
     * add by caill
     * */
    public String updateOperation(FuncOperationObject funcOperationObject,String dataOperName,String plFuncOid) throws VCIException{
        
         try {
            ClientSession.getFrameworkService().updateOperation(changeFuncOperationObjToInfo(funcOperationObject),userEntityInfo,dataOperName,plFuncOid);
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }    
    /**
     * 查询同一模块中是否已经存在相同的操作类型
     * add by caill
     * */
    public boolean selSameOper(String dataOperName,String plFuncOid) throws VCIException{
        boolean same=false;
         try {
            same=ClientSession.getFrameworkService().selSameOper(dataOperName,plFuncOid);
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return same;
    }    
}