Search in sources :

Example 6 with Properties

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

the class V3OpenStackImageProviderInAdapter method adapt.

@Override
public OpenStackImageProvider adapt(V3OpenStackImageProvider from) {
    OpenStackImageProvider to = new OpenStackImageProvider();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAuthenticationUrl()) {
        to.setAuthenticationUrl(from.getAuthenticationUrl());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetPassword()) {
        to.setPassword(from.getPassword());
    }
    if (from.isSetProperties()) {
        to.setProperties(new Properties());
        to.getProperties().getProperties().addAll(adaptIn(from.getProperties().getProperties()));
    }
    if (from.isSetRequiresAuthentication()) {
        to.setRequiresAuthentication(from.isRequiresAuthentication());
    }
    if (from.isSetTenantName()) {
        to.setTenantName(from.getTenantName());
    }
    if (from.isSetUrl()) {
        to.setUrl(from.getUrl());
    }
    if (from.isSetUsername()) {
        to.setUsername(from.getUsername());
    }
    return to;
}
Also used : V3OpenStackImageProvider(org.ovirt.engine.api.v3.types.V3OpenStackImageProvider) OpenStackImageProvider(org.ovirt.engine.api.model.OpenStackImageProvider) Properties(org.ovirt.engine.api.model.Properties)

Example 7 with Properties

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

the class V3HostNICInAdapter method adapt.

@Override
public HostNic adapt(V3HostNIC from) {
    HostNic to = new HostNic();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetBaseInterface()) {
        to.setBaseInterface(from.getBaseInterface());
    }
    if (from.isSetBonding()) {
        to.setBonding(adaptIn(from.getBonding()));
    }
    if (from.isSetBootProtocol()) {
        to.setBootProtocol(BootProtocol.fromValue(from.getBootProtocol()));
    }
    if (from.isSetBridged()) {
        to.setBridged(from.isBridged());
    }
    if (from.isSetCheckConnectivity()) {
        to.setCheckConnectivity(from.isCheckConnectivity());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetCustomConfiguration()) {
        to.setCustomConfiguration(from.isCustomConfiguration());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetIp()) {
        to.setIp(adaptIn(from.getIp()));
    }
    if (from.isSetLabels()) {
        to.setNetworkLabels(new NetworkLabels());
        to.getNetworkLabels().getNetworkLabels().addAll(adaptIn(from.getLabels().getLabels()));
    }
    if (from.isSetMac()) {
        to.setMac(adaptIn(from.getMac()));
    }
    if (from.isSetMtu()) {
        to.setMtu(from.getMtu());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNetwork()) {
        to.setNetwork(adaptIn(from.getNetwork()));
    }
    if (from.isSetOverrideConfiguration()) {
        to.setOverrideConfiguration(from.isOverrideConfiguration());
    }
    if (from.isSetPhysicalFunction()) {
        to.setPhysicalFunction(adaptIn(from.getPhysicalFunction()));
    }
    if (from.isSetProperties()) {
        to.setProperties(new Properties());
        to.getProperties().getProperties().addAll(adaptIn(from.getProperties().getProperties()));
    }
    if (from.isSetQos()) {
        to.setQos(adaptIn(from.getQos()));
    }
    if (from.isSetSpeed()) {
        to.setSpeed(from.getSpeed());
    }
    if (from.isSetStatistics()) {
        to.setStatistics(new Statistics());
        to.getStatistics().getStatistics().addAll(adaptIn(from.getStatistics().getStatistics()));
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(NicStatus.fromValue(from.getStatus().getState()));
    }
    if (from.isSetVirtualFunctionsConfiguration()) {
        to.setVirtualFunctionsConfiguration(adaptIn(from.getVirtualFunctionsConfiguration()));
    }
    if (from.isSetVlan()) {
        to.setVlan(adaptIn(from.getVlan()));
    }
    return to;
}
Also used : HostNic(org.ovirt.engine.api.model.HostNic) NetworkLabels(org.ovirt.engine.api.model.NetworkLabels) Properties(org.ovirt.engine.api.model.Properties) Statistics(org.ovirt.engine.api.model.Statistics)

Example 8 with Properties

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

the class V3SchedulingPolicyInAdapter method adapt.

@Override
public SchedulingPolicy adapt(V3SchedulingPolicy from) {
    SchedulingPolicy to = new SchedulingPolicy();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDefaultPolicy()) {
        to.setDefaultPolicy(from.isDefaultPolicy());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetLocked()) {
        to.setLocked(from.isLocked());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetProperties()) {
        to.setProperties(new Properties());
        to.getProperties().getProperties().addAll(adaptIn(from.getProperties().getProperties()));
    }
    return to;
}
Also used : SchedulingPolicy(org.ovirt.engine.api.model.SchedulingPolicy) V3SchedulingPolicy(org.ovirt.engine.api.v3.types.V3SchedulingPolicy) Properties(org.ovirt.engine.api.model.Properties)

Example 9 with Properties

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

the class V3SchedulingPolicyUnitInAdapter method adapt.

@Override
public SchedulingPolicyUnit adapt(V3SchedulingPolicyUnit from) {
    SchedulingPolicyUnit to = new SchedulingPolicyUnit();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetEnabled()) {
        to.setEnabled(from.isEnabled());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetInternal()) {
        to.setInternal(from.isInternal());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetPropertiesMetaData()) {
        to.setProperties(new Properties());
        to.getProperties().getProperties().addAll(adaptIn(from.getPropertiesMetaData().getProperties()));
    }
    if (from.isSetType()) {
        to.setType(PolicyUnitType.fromValue(from.getType()));
    }
    return to;
}
Also used : SchedulingPolicyUnit(org.ovirt.engine.api.model.SchedulingPolicyUnit) V3SchedulingPolicyUnit(org.ovirt.engine.api.v3.types.V3SchedulingPolicyUnit) Properties(org.ovirt.engine.api.model.Properties)

Example 10 with Properties

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

the class OpenStackImageProviderMapper method map.

@Mapping(from = Provider.class, to = OpenStackImageProvider.class)
public static OpenStackImageProvider map(Provider<OpenStackImageProviderProperties> entity, OpenStackImageProvider template) {
    OpenStackImageProvider model = template != null ? template : new OpenStackImageProvider();
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
    }
    if (entity.getName() != null) {
        model.setName(entity.getName());
    }
    if (entity.getDescription() != null) {
        model.setDescription(entity.getDescription());
    }
    if (entity.getUrl() != null) {
        model.setUrl(entity.getUrl());
    }
    if (entity.getAuthUrl() != null) {
        model.setAuthenticationUrl(entity.getAuthUrl());
    }
    model.setRequiresAuthentication(entity.isRequiringAuthentication());
    if (entity.getUsername() != null) {
        model.setUsername(entity.getUsername());
    }
    // The password isn't mapped for security reasons.
    // if (entity.getPassword() != null) {
    // model.setPassword(entity.getPassword());
    // }
    Map<String, String> customProperties = entity.getCustomProperties();
    if (customProperties != null) {
        Properties properties = new Properties();
        for (Map.Entry<String, String> entry : customProperties.entrySet()) {
            Property property = new Property();
            property.setName(entry.getKey());
            property.setValue(entry.getValue());
            properties.getProperties().add(property);
        }
        model.setProperties(properties);
    }
    OpenStackImageProviderProperties additionalProperties = entity.getAdditionalProperties();
    if (additionalProperties != null) {
        if (additionalProperties.getTenantName() != null) {
            model.setTenantName(additionalProperties.getTenantName());
        }
    }
    return model;
}
Also used : OpenStackImageProvider(org.ovirt.engine.api.model.OpenStackImageProvider) Properties(org.ovirt.engine.api.model.Properties) OpenStackImageProviderProperties(org.ovirt.engine.core.common.businessentities.OpenStackImageProviderProperties) Map(java.util.Map) HashMap(java.util.HashMap) Property(org.ovirt.engine.api.model.Property) OpenStackImageProviderProperties(org.ovirt.engine.core.common.businessentities.OpenStackImageProviderProperties) Mapping(org.ovirt.engine.api.restapi.types.Mapping)

Aggregations

Properties (org.ovirt.engine.api.model.Properties)18 Map (java.util.Map)5 Property (org.ovirt.engine.api.model.Property)5 HashMap (java.util.HashMap)4 Mapping (org.ovirt.engine.api.restapi.types.Mapping)3 OpenStackImageProvider (org.ovirt.engine.api.model.OpenStackImageProvider)2 OpenStackNetworkProvider (org.ovirt.engine.api.model.OpenStackNetworkProvider)2 OpenStackVolumeProvider (org.ovirt.engine.api.model.OpenStackVolumeProvider)2 SchedulingPolicy (org.ovirt.engine.api.model.SchedulingPolicy)2 V3SchedulingPolicy (org.ovirt.engine.api.v3.types.V3SchedulingPolicy)2 V3SchedulingPolicyThresholds (org.ovirt.engine.api.v3.types.V3SchedulingPolicyThresholds)2 WebApplicationException (javax.ws.rs.WebApplicationException)1 CustomProperty (org.ovirt.engine.api.model.CustomProperty)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 ExternalHostProvider (org.ovirt.engine.api.model.ExternalHostProvider)1 ExternalProvider (org.ovirt.engine.api.model.ExternalProvider)1 HostNic (org.ovirt.engine.api.model.HostNic)1 IpAddressAssignments (org.ovirt.engine.api.model.IpAddressAssignments)1 LinkLayerDiscoveryProtocolElement (org.ovirt.engine.api.model.LinkLayerDiscoveryProtocolElement)1 NetworkAttachment (org.ovirt.engine.api.model.NetworkAttachment)1