Search in sources :

Example 1 with ProjectBuilder

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

the class ProjectProducer method messageToProject.

private Project messageToProject(Message message) {
    Project project = message.getBody(Project.class);
    if (project == null) {
        Map headers = message.getHeaders();
        ProjectBuilder builder = Builders.project();
        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.PARENT_ID)) {
            builder.parentId(message.getHeader(KeystoneConstants.PARENT_ID, String.class));
        }
        project = builder.build();
    }
    return project;
}
Also used : Project(org.openstack4j.model.identity.v3.Project) ProjectBuilder(org.openstack4j.model.identity.v3.builder.ProjectBuilder) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 Project (org.openstack4j.model.identity.v3.Project)1 ProjectBuilder (org.openstack4j.model.identity.v3.builder.ProjectBuilder)1