田源
2024-03-07 4b4083fd73dc27ece42f4835483565eef0e4f608
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
package com.vci.server.base.delegate;
 
import com.vci.common.objects.UserEntity;
import com.vci.corba.common.data.UserEntityInfo;
import com.vci.server.base.persistence.dao.BaseService;
 
/**
 * <p>Title: UserEntityDelegate</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2012</p>
 * <p>Company: VCI</p>
 * @author wangxl
 * @time 2012-5-10
 * @version 1.0
 */
public class UserEntityDelegate {
    public static UserEntity changeUserEntityInfoToEntity(UserEntityInfo info) {
        UserEntity obj = new UserEntity();
        obj.setUserName(info.userName);
        obj.setIp(info.ip);
        obj.setModule(info.modules);
        return obj;
    }
    
    public static UserEntityInfo changeUserEntityToInfo(UserEntity obj) {
        UserEntityInfo info = new UserEntityInfo();
        info.userName = obj.getUserName() == null ? "" : obj.getUserName();
        info.modules = obj.getModule() == null ? "" : obj.getModule();
        info.ip = obj.getIp() == null ? "" : obj.getIp();
        return info;
    }
 
    public static void setUserEntityToService(BaseService service,
            UserEntityInfo userEntityInfo) {
        UserEntity userEntity = changeUserEntityInfoToEntity(userEntityInfo);
        service.setUserEntity(userEntity);
    }
}