Search in sources :

Example 1 with GlusterClients

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

the class V3GlusterBrickAdvancedDetailsInAdapter method adapt.

@Override
public GlusterBrickAdvancedDetails adapt(V3GlusterBrickAdvancedDetails from) {
    GlusterBrickAdvancedDetails to = new GlusterBrickAdvancedDetails();
    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.isSetDevice()) {
        to.setDevice(from.getDevice());
    }
    if (from.isSetFsName()) {
        to.setFsName(from.getFsName());
    }
    if (from.isSetGlusterClients()) {
        to.setGlusterClients(new GlusterClients());
        to.getGlusterClients().getGlusterClients().addAll(adaptIn(from.getGlusterClients().getGlusterClients()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetMemoryPools()) {
        to.setMemoryPools(new GlusterMemoryPools());
        to.getMemoryPools().getGlusterMemoryPools().addAll(adaptIn(from.getMemoryPools().getGlusterMemoryPools()));
    }
    if (from.isSetMntOptions()) {
        to.setMntOptions(from.getMntOptions());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetPid()) {
        to.setPid(from.getPid());
    }
    if (from.isSetPort()) {
        to.setPort(from.getPort());
    }
    return to;
}
Also used : GlusterMemoryPools(org.ovirt.engine.api.model.GlusterMemoryPools) V3GlusterBrickAdvancedDetails(org.ovirt.engine.api.v3.types.V3GlusterBrickAdvancedDetails) GlusterBrickAdvancedDetails(org.ovirt.engine.api.model.GlusterBrickAdvancedDetails) GlusterClients(org.ovirt.engine.api.model.GlusterClients)

Example 2 with GlusterClients

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

the class V3GlusterBrickInAdapter method adapt.

@Override
public GlusterBrick adapt(V3GlusterBrick from) {
    GlusterBrick to = new GlusterBrick();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetBrickDir()) {
        to.setBrickDir(from.getBrickDir());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDevice()) {
        to.setDevice(from.getDevice());
    }
    if (from.isSetFsName()) {
        to.setFsName(from.getFsName());
    }
    if (from.isSetGlusterClients()) {
        to.setGlusterClients(new GlusterClients());
        to.getGlusterClients().getGlusterClients().addAll(adaptIn(from.getGlusterClients().getGlusterClients()));
    }
    if (from.isSetGlusterVolume()) {
        to.setGlusterVolume(adaptIn(from.getGlusterVolume()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetMemoryPools()) {
        to.setMemoryPools(new GlusterMemoryPools());
        to.getMemoryPools().getGlusterMemoryPools().addAll(adaptIn(from.getMemoryPools().getGlusterMemoryPools()));
    }
    if (from.isSetMntOptions()) {
        to.setMntOptions(from.getMntOptions());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetPid()) {
        to.setPid(from.getPid());
    }
    if (from.isSetPort()) {
        to.setPort(from.getPort());
    }
    if (from.isSetServerId()) {
        to.setServerId(from.getServerId());
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(GlusterBrickStatus.fromValue(from.getStatus().getState()));
    }
    return to;
}
Also used : GlusterMemoryPools(org.ovirt.engine.api.model.GlusterMemoryPools) GlusterClients(org.ovirt.engine.api.model.GlusterClients) V3GlusterBrick(org.ovirt.engine.api.v3.types.V3GlusterBrick) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Example 3 with GlusterClients

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

the class GlusterBrickDetailMapper method map.

@Mapping(from = GlusterVolumeAdvancedDetails.class, to = GlusterBrick.class)
public static GlusterBrick map(GlusterVolumeAdvancedDetails fromEntity, GlusterBrick toModel) {
    GlusterBrick model = (toModel == null) ? new GlusterBrick() : toModel;
    if (fromEntity.getBrickDetails() == null) {
        return model;
    }
    // Since the getDetails call is for a single brick the list size will always be 1 - so get the first element
    BrickDetails detail = (fromEntity.getBrickDetails().size() > 0) ? fromEntity.getBrickDetails().get(0) : null;
    if (detail == null) {
        return model;
    }
    model = mapBrickProperties(detail, model);
    if (detail.getClients() != null) {
        model.setGlusterClients(new GlusterClients());
        for (GlusterClientInfo clientEntity : detail.getClients()) {
            model.getGlusterClients().getGlusterClients().add(map(clientEntity));
        }
    }
    if (detail.getMemoryStatus() != null && detail.getMemoryStatus().getMemPools() != null) {
        model.setMemoryPools(new GlusterMemoryPools());
        for (Mempool pool : detail.getMemoryStatus().getMemPools()) {
            model.getMemoryPools().getGlusterMemoryPools().add(map(pool));
        }
    }
    return model;
}
Also used : GlusterMemoryPools(org.ovirt.engine.api.model.GlusterMemoryPools) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool) GlusterClients(org.ovirt.engine.api.model.GlusterClients) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Aggregations

GlusterClients (org.ovirt.engine.api.model.GlusterClients)3 GlusterMemoryPools (org.ovirt.engine.api.model.GlusterMemoryPools)3 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)2 GlusterBrickAdvancedDetails (org.ovirt.engine.api.model.GlusterBrickAdvancedDetails)1 V3GlusterBrick (org.ovirt.engine.api.v3.types.V3GlusterBrick)1 V3GlusterBrickAdvancedDetails (org.ovirt.engine.api.v3.types.V3GlusterBrickAdvancedDetails)1 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)1 GlusterClientInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo)1 Mempool (org.ovirt.engine.core.common.businessentities.gluster.Mempool)1