public static void validateAdd(IscsiBond bond) { if (bond == null) { throw new ValidationException("Parameter 'bond' is mandatory but was not provided."); } if (bond.getName()==null) { throw new ValidationException("Parameter 'bond.name' is mandatory but was not provided."); } }
@Mapping(from = IscsiBond.class, to = org.ovirt.engine.core.common.businessentities.IscsiBond.class) public static org.ovirt.engine.core.common.businessentities.IscsiBond map(IscsiBond from, org.ovirt.engine.core.common.businessentities.IscsiBond to) { org.ovirt.engine.core.common.businessentities.IscsiBond iscsiBond = (to != null) ? to : new org.ovirt.engine.core.common.businessentities.IscsiBond(); if (from.isSetId()) { iscsiBond.setId(Guid.createGuidFromString(from.getId())); } if (from.isSetDataCenter() && from.getDataCenter().isSetId()) { iscsiBond.setStoragePoolId(Guid.createGuidFromString(from.getDataCenter().getId())); } if (from.isSetName()) { iscsiBond.setName(from.getName()); } if (from.isSetDescription()) { iscsiBond.setDescription(from.getDescription()); } if (from.isSetStorageConnections()) { for (StorageConnection conn : from.getStorageConnections().getStorageConnections()) { iscsiBond.getStorageConnectionIds().add(conn.getId()); } } if (from.isSetNetworks()) { for (Network network : from.getNetworks().getNetworks()) { iscsiBond.getNetworkIds().add(Guid.createGuidFromString(network.getId())); } } return iscsiBond; }
@Override protected void verify(IscsiBond model, IscsiBond transform) { assertNotNull(transform); assertEquals(model.getName(), transform.getName()); assertEquals(model.getId(), transform.getId()); assertEquals(model.getDescription(), transform.getDescription()); if (model.isSetDataCenter()) { assertEquals(model.getDataCenter().getId(), transform.getDataCenter().getId()); } else { assertNull(transform.getDataCenter()); } verifyNetworks(model.getNetworks(), transform.getNetworks()); verifyStorageConnections(model.getStorageConnections(), transform.getStorageConnections()); }
to.setName(from.getName());