Search in sources :

Example 1 with KatelloErratum

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

the class ErratumMapper method map.

@Mapping(from = Erratum.class, to = KatelloErratum.class)
public static KatelloErratum map(Erratum entity, KatelloErratum model) {
    model = model == null ? new KatelloErratum() : model;
    model.setId(string2hex(entity.getId()));
    model.setName(entity.getId());
    model.setTitle(entity.getTitle());
    model.setSummary(entity.getSummary());
    model.setSolution(entity.getSolution());
    model.setDescription(entity.getDescription());
    if (entity.getIssued() != null) {
        model.setIssued(DateMapper.map(entity.getIssued(), null));
    }
    model.setSeverity(entity.getSeverity() == null ? null : entity.getSeverity().getDescription());
    model.setType(entity.getType() == null ? null : entity.getType().getDescription());
    if (entity.getPackages() != null && !entity.getPackages().isEmpty()) {
        Packages packages = new Packages();
        for (String packageName : entity.getPackages()) {
            Package p = new Package();
            p.setName(packageName);
            packages.getPackages().add(p);
        }
        model.setPackages(packages);
    }
    return model;
}
Also used : Packages(org.ovirt.engine.api.model.Packages) KatelloErratum(org.ovirt.engine.api.model.KatelloErratum) Package(org.ovirt.engine.api.model.Package) Mapping(org.ovirt.engine.api.restapi.types.Mapping)

Example 2 with KatelloErratum

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

the class V3KatelloErratumInAdapter method adapt.

@Override
public KatelloErratum adapt(V3KatelloErratum from) {
    KatelloErratum to = new KatelloErratum();
    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.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetIssued()) {
        to.setIssued(from.getIssued());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetPackages()) {
        to.setPackages(new Packages());
        to.getPackages().getPackages().addAll(adaptIn(from.getPackages().getPackages()));
    }
    if (from.isSetSeverity()) {
        to.setSeverity(from.getSeverity());
    }
    if (from.isSetSolution()) {
        to.setSolution(from.getSolution());
    }
    if (from.isSetSummary()) {
        to.setSummary(from.getSummary());
    }
    if (from.isSetTitle()) {
        to.setTitle(from.getTitle());
    }
    if (from.isSetType()) {
        to.setType(from.getType());
    }
    if (from.isSetVm()) {
        to.setVm(adaptIn(from.getVm()));
    }
    return to;
}
Also used : Packages(org.ovirt.engine.api.model.Packages) KatelloErratum(org.ovirt.engine.api.model.KatelloErratum) V3KatelloErratum(org.ovirt.engine.api.v3.types.V3KatelloErratum)

Aggregations

KatelloErratum (org.ovirt.engine.api.model.KatelloErratum)2 Packages (org.ovirt.engine.api.model.Packages)2 Package (org.ovirt.engine.api.model.Package)1 Mapping (org.ovirt.engine.api.restapi.types.Mapping)1 V3KatelloErratum (org.ovirt.engine.api.v3.types.V3KatelloErratum)1