blob: 9c86ea7991668d30f1228cc5e61f2d899facf6e3 (
plain) (
blame)
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 org.openslx.imagemaster.localrpc;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.Role;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.imagemaster.util.Util;
public class JsonUser
{
private static final Logger LOGGER = LogManager.getLogger( JsonUser.class );
private String userId = null;
private String organizationId = null;
private String firstName = null;
private String lastName = null;
private String mail = null;
private String role = null;
public UserInfo toUser()
{
Role role;
try {
role = Role.valueOf( this.role );
} catch ( Exception e ) {
LOGGER.warn( "Invalid role: " + this.role );
return null;
}
if ( Util.isEmpty( userId, "userId", LOGGER ) || Util.isEmpty( organizationId, "orgId", LOGGER )
|| Util.isEmpty( lastName, "lastName", LOGGER ) || Util.isEmpty( mail, "mail", LOGGER ) )
return null;
UserInfo ui = new UserInfo( userId, firstName, lastName, mail, organizationId );
ui.role = role;
return ui;
}
}
|