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;
}
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;
}
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;
}
Aggregations