Search in sources :

Example 1 with LinkLayerDiscoveryProtocolElement

use of org.ovirt.engine.api.model.LinkLayerDiscoveryProtocolElement in project ovirt-engine by oVirt.

the class LinkLayerDiscoveryProtocolElementMapper method map.

@Mapping(from = Tlv.class, to = LinkLayerDiscoveryProtocolElement.class)
public static LinkLayerDiscoveryProtocolElement map(Tlv entity, LinkLayerDiscoveryProtocolElement template) {
    LinkLayerDiscoveryProtocolElement model = template != null ? template : new LinkLayerDiscoveryProtocolElement();
    model.setName(entity.getName());
    model.setType(entity.getType());
    model.setOui(entity.getOui());
    model.setSubtype(entity.getSubtype());
    Properties properties = new Properties();
    for (Map.Entry<String, String> entry : entity.getProperties().entrySet()) {
        Property property = new Property();
        property.setName(entry.getKey());
        property.setValue(entry.getValue());
        properties.getProperties().add(property);
    }
    model.setProperties(properties);
    return model;
}
Also used : Properties(org.ovirt.engine.api.model.Properties) Map(java.util.Map) Property(org.ovirt.engine.api.model.Property) LinkLayerDiscoveryProtocolElement(org.ovirt.engine.api.model.LinkLayerDiscoveryProtocolElement)

Aggregations

Map (java.util.Map)1 LinkLayerDiscoveryProtocolElement (org.ovirt.engine.api.model.LinkLayerDiscoveryProtocolElement)1 Properties (org.ovirt.engine.api.model.Properties)1 Property (org.ovirt.engine.api.model.Property)1