Search in sources :

Example 1 with GlusterHook

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

the class BackendGlusterHookResource method get.

@Override
public GlusterHook get() {
    GlusterHook hook = performGet(QueryType.GetGlusterHookById, new GlusterHookQueryParameters(guid, true));
    QueryReturnValue result = runQuery(QueryType.GetGlusterHookContent, new GlusterHookContentQueryParameters(guid));
    if (result != null && result.getSucceeded() && result.getReturnValue() != null) {
        hook.setContent(result.getReturnValue());
    }
    return hook;
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GlusterHookContentQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters) GlusterHook(org.ovirt.engine.api.model.GlusterHook) GlusterHookQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterHookQueryParameters)

Example 2 with GlusterHook

use of org.ovirt.engine.api.model.GlusterHook 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 GlusterHook

use of org.ovirt.engine.api.model.GlusterHook 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

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