Search in sources :

Example 1 with UserBuilder

use of org.openstack4j.model.identity.v3.builder.UserBuilder in project camel by apache.

the class UserProducer method messageToUser.

private User messageToUser(Message message) {
    User project = message.getBody(User.class);
    if (project == null) {
        Map headers = message.getHeaders();
        UserBuilder builder = Builders.user();
        ObjectHelper.notEmpty(message.getHeader(OpenstackConstants.NAME, String.class), "Name");
        builder.name(message.getHeader(OpenstackConstants.NAME, String.class));
        if (headers.containsKey(KeystoneConstants.DOMAIN_ID)) {
            builder.domainId(message.getHeader(KeystoneConstants.DOMAIN_ID, String.class));
        }
        if (headers.containsKey(KeystoneConstants.DESCRIPTION)) {
            builder.description(message.getHeader(KeystoneConstants.DESCRIPTION, String.class));
        }
        if (headers.containsKey(KeystoneConstants.PASSWORD)) {
            builder.password(message.getHeader(KeystoneConstants.PASSWORD, String.class));
        }
        if (headers.containsKey(KeystoneConstants.EMAIL)) {
            builder.email(message.getHeader(KeystoneConstants.EMAIL, String.class));
        }
        project = builder.build();
    }
    return project;
}
Also used : User(org.openstack4j.model.identity.v3.User) Map(java.util.Map) UserBuilder(org.openstack4j.model.identity.v3.builder.UserBuilder)

Aggregations

Map (java.util.Map)1 User (org.openstack4j.model.identity.v3.User)1 UserBuilder (org.openstack4j.model.identity.v3.builder.UserBuilder)1