Search in sources :

Example 1 with GlusterServerHooks

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

the class V3GlusterServerHooksInAdapter method adapt.

@Override
public GlusterServerHooks adapt(V3GlusterServerHooks from) {
    GlusterServerHooks to = new GlusterServerHooks();
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetActive()) {
        to.setActive(from.getActive());
    }
    if (from.isSetSize()) {
        to.setSize(from.getSize());
    }
    if (from.isSetTotal()) {
        to.setTotal(from.getTotal());
    }
    to.getGlusterServerHooks().addAll(adaptIn(from.getGlusterServerHooks()));
    return to;
}
Also used : V3GlusterServerHooks(org.ovirt.engine.api.v3.types.V3GlusterServerHooks) GlusterServerHooks(org.ovirt.engine.api.model.GlusterServerHooks)

Example 2 with GlusterServerHooks

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

the class V3GlusterHookInAdapter method adapt.

@Override
public GlusterHook adapt(V3GlusterHook from) {
    GlusterHook to = new GlusterHook();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetChecksum()) {
        to.setChecksum(from.getChecksum());
    }
    if (from.isSetCluster()) {
        to.setCluster(adaptIn(from.getCluster()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetConflictStatus()) {
        to.setConflictStatus(from.getConflictStatus());
    }
    if (from.isSetConflicts()) {
        to.setConflicts(from.getConflicts());
    }
    if (from.isSetContent()) {
        to.setContent(from.getContent());
    }
    if (from.isSetContentType()) {
        to.setContentType(HookContentType.fromValue(from.getContentType()));
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetGlusterCommand()) {
        to.setGlusterCommand(from.getGlusterCommand());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetServerHooks()) {
        to.setServerHooks(new GlusterServerHooks());
        to.getServerHooks().getGlusterServerHooks().addAll(adaptIn(from.getServerHooks().getGlusterServerHooks()));
    }
    if (from.isSetStage()) {
        to.setStage(HookStage.fromValue(from.getStage()));
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(GlusterHookStatus.fromValue(from.getStatus().getState()));
    }
    return to;
}
Also used : GlusterServerHooks(org.ovirt.engine.api.model.GlusterServerHooks) V3GlusterHook(org.ovirt.engine.api.v3.types.V3GlusterHook) GlusterHook(org.ovirt.engine.api.model.GlusterHook)

Example 3 with GlusterServerHooks

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

the class GlusterHookMapper method map.

@Mapping(from = GlusterHookEntity.class, to = GlusterHook.class)
public static GlusterHook map(GlusterHookEntity entity, GlusterHook hook) {
    GlusterHook model = hook != null ? hook : new GlusterHook();
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
    }
    if (entity.getClusterId() != null) {
        model.setCluster(new Cluster());
        model.getCluster().setId(entity.getClusterId().toString());
    }
    if (entity.getHookKey() != null) {
        model.setName(entity.getHookKey());
    }
    if (entity.getGlusterCommand() != null) {
        model.setGlusterCommand(entity.getGlusterCommand());
    }
    if (entity.getStage() != null) {
        model.setStage(map(entity.getStage(), null));
    }
    if (entity.getStatus() != null) {
        model.setStatus(mapHookStatus(entity.getStatus()));
    }
    if (entity.getContentType() != null) {
        model.setContentType(map(entity.getContentType(), null));
    }
    if (entity.getChecksum() != null) {
        model.setChecksum(entity.getChecksum());
    }
    if (entity.getContent() != null) {
        model.setContent(entity.getContent());
    }
    if (entity.getConflictStatus() != null) {
        model.setConflictStatus(entity.getConflictStatus());
        model.setConflicts(mapConflicts(entity));
    }
    if (entity.getServerHooks() != null && !entity.getServerHooks().isEmpty()) {
        model.setServerHooks(new GlusterServerHooks());
        for (GlusterServerHook serverHookEntity : entity.getServerHooks()) {
            model.getServerHooks().getGlusterServerHooks().add(map(serverHookEntity));
        }
    }
    return model;
}
Also used : GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook) Cluster(org.ovirt.engine.api.model.Cluster) GlusterServerHooks(org.ovirt.engine.api.model.GlusterServerHooks) GlusterHook(org.ovirt.engine.api.model.GlusterHook)

Aggregations

GlusterServerHooks (org.ovirt.engine.api.model.GlusterServerHooks)3 GlusterHook (org.ovirt.engine.api.model.GlusterHook)2 Cluster (org.ovirt.engine.api.model.Cluster)1 V3GlusterHook (org.ovirt.engine.api.v3.types.V3GlusterHook)1 V3GlusterServerHooks (org.ovirt.engine.api.v3.types.V3GlusterServerHooks)1 GlusterServerHook (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook)1