private static HostNic getModelHostNic(NetworkAttachment model) { HostNic hostNic = model.getHostNic(); if (hostNic == null) { hostNic = new HostNic(); model.setHostNic(hostNic); } return hostNic; }
@Override public Response add(org.ovirt.engine.api.model.NetworkAttachment attachment) { verifyHostAndNicExistence(); if (attachment.isSetHostNic()) { Guid hostNicGuid = Guid.createGuidFromString(attachment.getHostNic().getId()); if (!nicId.equals(hostNicGuid)) { //TODO MM: add message. return Response.status(Response.Status.BAD_REQUEST).build(); } } else { HostNic hostNIC = new HostNic(); hostNIC.setId(nicId.toString()); attachment.setHostNic(hostNIC); } return super.add(attachment); } }
@Override protected org.ovirt.engine.api.model.NetworkAttachment getModel(int index) { org.ovirt.engine.api.model.NetworkAttachment model = super.getModel(index); model.setHostNic(new HostNic()); model.getHostNic().setId(HOST_NIC_ID.toString()); return model; }
@Override protected org.ovirt.engine.api.model.NetworkAttachment getModel(int index) { org.ovirt.engine.api.model.NetworkAttachment model = super.getModel(index); model.setHostNic(new HostNic()); model.getHostNic().setId(HOST_NIC_ID.toString()); return model; }
@Override protected org.ovirt.engine.api.model.NetworkAttachment addParents(org.ovirt.engine.api.model.NetworkAttachment model) { model.setHostNic(new HostNic()); model.getHostNic().setId(nicId.toString()); model.getHostNic().setHost(new Host()); model.getHostNic().getHost().setId(getHostId().toString()); return model; }
to.setHostNic(adaptIn(from.getHostNic()));