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
package com.vci.client.framework.delegate;
import com.vci.client.ClientSession;
import com.vci.client.common.objects.UserEntityObject;
import com.vci.client.framework.appConfig.object.AppConfigCategoryObject;
import com.vci.client.framework.delegate.ClientBaseDelegate;
import com.vci.client.ui.exception.VCIException;
import com.vci.corba.common.VCIError;
import com.vci.corba.framework.data.AppConfigCategoryInfo;
 
    /**
     * AppConfigCategory Client Delegate
     *
     */
    public class AppConfigCategoryClientDelegate extends ClientBaseDelegate{
        /**
         * 
         */
        private static final long serialVersionUID = 1L;
        public AppConfigCategoryClientDelegate(UserEntityObject userEntityObject) {
            super(userEntityObject);
        }
        
        /**
        * 添加、保存 AppConfigCategory 对象
        * @param info AppConfigCategoryInfo 对象
        */
        public String saveAppConfigCategory(AppConfigCategoryObject object) throws VCIException{
            try{
                AppConfigCategoryInfo info = this.convertAppConfigCategoryObjectToAppConfigCategoryInfo(object);
                return ClientSession.getFrameworkService().saveAppConfigCategory(info, userEntityInfo);
            }catch(VCIError e){
                throw new VCIException(String.valueOf(e.code), e.messages);
            }
        }
        
        /**
        * 修改、更新 AppConfigCategory 对象
        * @param info AppConfigCategoryInfo 对象
        */
        public boolean updateAppConfigCategory(AppConfigCategoryObject object) throws VCIException{
            try{
                AppConfigCategoryInfo info = this.convertAppConfigCategoryObjectToAppConfigCategoryInfo(object);
                return ClientSession.getFrameworkService().updateAppConfigCategory(info, userEntityInfo);
            }catch(VCIError e){
                throw new VCIException(String.valueOf(e.code), e.messages);
            }
        }
        
        /**
        * 根据 ID 删除 AppConfigCategory 对象(批量)
        * @param ids AppConfigCategory 对象的 ID 列表
        */
        public boolean deleteAppConfigCategory(String[] ids) throws VCIException{
            try{
                return ClientSession.getFrameworkService().deleteAppConfigCategory(ids, userEntityInfo); 
            }catch(VCIError e){
                throw new VCIException(String.valueOf(e.code), e.messages);
            }
        }
        
        /**
        * 返回全部的 AppConfigCategory 对象
        */
        public AppConfigCategoryObject[] getAppConfigCategorys() throws VCIException{
            try{
                AppConfigCategoryInfo[] infos = ClientSession.getFrameworkService().getAppConfigCategorys(userEntityInfo);
                return this.convertAppConfigCategoryInfosToAppConfigCategoryObjects(infos);
            }catch(VCIError e){
                throw new VCIException(String.valueOf(e.code), e.messages);
            }
        }
        
        /**
        * 根据 ID 返回 AppConfigCategory 对象
        * @param info AppConfigCategoryInfo 对象
        */
        public AppConfigCategoryObject getAppConfigCategoryById(String id) throws VCIException{
            try{
                AppConfigCategoryInfo info = ClientSession.getFrameworkService().getAppConfigCategoryById(id, userEntityInfo);
                return this.convertAppConfigCategoryInfoToAppConfigCategoryObject(info);
            }catch(VCIError e){
                throw new VCIException(String.valueOf(e.code), e.messages);
            }
        }
        
        /************************* CORBA & CLIENT CONVERT **************************/
        /**
        * 对象转换(批量),从 Client 对象转换到 Corba 对象
        * @param infos
        * @return
        */    
        public AppConfigCategoryInfo[] convertAppConfigCategoryObjectsToAppConfigCategoryInfos(AppConfigCategoryObject[] objects){
            AppConfigCategoryInfo[] infos = new AppConfigCategoryInfo[objects.length];
            int i = 0;
            for(AppConfigCategoryObject obj : objects){
                infos[i++] = this.convertAppConfigCategoryObjectToAppConfigCategoryInfo(obj);
            }
            return infos;
        }
        /**
        * 对象转换,从 Client 对象转换到 Corba 对象
        * @param infos
        * @return
        */
        public AppConfigCategoryInfo convertAppConfigCategoryObjectToAppConfigCategoryInfo(AppConfigCategoryObject object){
            AppConfigCategoryInfo info = new AppConfigCategoryInfo();
            info.id = object.getId() == null ? "" : object.getId();
            info.name = object.getName() == null ? "" : object.getName();
            info.desc = object.getDesc() == null ? "" : object.getDesc();
            return info;
        }
        /**
        * 对象转换(批量),从 Corba 对象转换到 Client 对象
        * @param infos
        * @return
        */
        public AppConfigCategoryObject[] convertAppConfigCategoryInfosToAppConfigCategoryObjects(AppConfigCategoryInfo[] infos){
            AppConfigCategoryObject[] objects = new AppConfigCategoryObject[infos.length];
            int i = 0;
            for(AppConfigCategoryInfo info : infos){
                objects[i++] = this.convertAppConfigCategoryInfoToAppConfigCategoryObject(info);
            }
            return objects;
        }
        /**
        * 对象转换,从 Corba 对象转换到 Client 对象
        * @param infos
        * @return
        */
        public AppConfigCategoryObject convertAppConfigCategoryInfoToAppConfigCategoryObject(AppConfigCategoryInfo info){
            AppConfigCategoryObject object = new AppConfigCategoryObject();
            object.setId(info.id);
            object.setName(info.name);
            object.setDesc(info.desc);
            return object;
        }
        /**
        * 对象转换,从  Client 对象 对象转换到 Client 对象
        * @param infos
        * @return
        */
        public AppConfigCategoryObject convertAppConfigCategoryObjectToAppConfigCategoryObject(AppConfigCategoryObject object){
           AppConfigCategoryObject objectRes = new AppConfigCategoryObject();
            objectRes.setId(object.getId());
            objectRes.setName(object.getName());
            objectRes.setDesc(object.getDesc());
            return objectRes;
        }
    }