protected boolean namedDataCenter(Network network) { return network != null && network.isSetDataCenter() && network.getDataCenter().isSetName() && !network.getDataCenter().isSetId(); }
protected boolean namedDataCenter(Network network) { return network != null && network.isSetDataCenter() && network.getDataCenter().isSetName() && !network.getDataCenter().isSetId(); }
public StoragePool getStoragePool(DataCenter dataCenter) { StoragePool pool = null; if (dataCenter.isSetId()) { Guid id = asGuid(dataCenter.getId()); pool = getEntity(StoragePool.class, QueryType.GetStoragePoolById, new IdQueryParameters(id), "Datacenter: id=" + dataCenter.getId()); } else if (dataCenter.isSetName()) { pool = getEntity(StoragePool.class, QueryType.GetStoragePoolByDatacenterName, new NameQueryParameters(dataCenter.getName()), "Datacenter: name=" + dataCenter.getName()); } if (pool == null) { notFound(DataCenter.class); } return pool; }
/** * Get the storage pool (i.e. datacenter entity) associated with the given * cluster. */ @SuppressWarnings("unchecked") public static StoragePool getStoragePool(DataCenter dataCenter, AbstractBackendResource parent) { StoragePool pool = null; if (dataCenter.isSetId()) { String id = dataCenter.getId(); Guid guid; try { guid = new Guid(id); // can't use asGuid() because the method is static. } catch (IllegalArgumentException e) { throw new MalformedIdException(e); } pool = parent.getEntity(StoragePool.class, QueryType.GetStoragePoolById, new IdQueryParameters(guid), "Datacenter: id=" + id); } else { String clusterName = dataCenter.getName(); pool = parent.getEntity(StoragePool.class, QueryType.GetStoragePoolByDatacenterName, new NameQueryParameters(clusterName), "Datacenter: name=" + clusterName); dataCenter.setId(pool.getId().toString()); } return pool; }
@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; }
@Mapping(from = Qos.class, to = QosBase.class) public static QosBase map(Qos model, QosBase template) { if (template == null) { template = createNewQosEntityForQosType(model.getType()); } if (model.isSetId()) { template.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { template.setName(model.getName()); } if (model.isSetDataCenter() && model.getDataCenter().isSetId()) { template.setStoragePoolId(GuidUtils.asGuid(model.getDataCenter() .getId())); } if (model.isSetDescription()) { template.setDescription(model.getDescription()); } mapQosToEntity(model, template); return template; }
@Mapping(from = Permission.class, to = VdcObjectType.class) public static VdcObjectType map(Permission p, VdcObjectType template) { return p.isSetDataCenter() && p.getDataCenter().isSetId() ? VdcObjectType.StoragePool : p.isSetCluster() && p.getCluster().isSetId() ? VdcObjectType.Cluster : p.isSetHost() && p.getHost().isSetId() ? VdcObjectType.VDS : p.isSetStorageDomain() && p.getStorageDomain().isSetId() ? VdcObjectType.Storage : p.isSetVm() && p.getVm().isSetId() ? VdcObjectType.VM : p.isSetVmPool() && p.getVmPool().isSetId() ? VdcObjectType.VmPool : p.isSetTemplate() && p.getTemplate().isSetId() ? VdcObjectType.VmTemplate : template; }
entity.setComment(model.getComment()); if (model.isSetDataCenter() && model.getDataCenter().isSetId()) { entity.setDataCenterId(GuidUtils.asGuid(model.getDataCenter().getId()));
if (event.isSetDataCenter() && event.getDataCenter().isSetId()) { Guid guid = GuidUtils.asGuid(event.getDataCenter().getId()); if (!Guid.isNullOrEmpty(guid)) {
to.setDescription(from.getDescription()); if (from.isSetId()) { to.setId(from.getId());
@Mapping(from = Permission.class, to = Guid.class) public static Guid map(Permission p, Guid template) { return p.isSetDataCenter() && p.getDataCenter().isSetId() ? GuidUtils.asGuid(p.getDataCenter().getId()) : p.isSetCluster() && p.getCluster().isSetId() ? GuidUtils.asGuid(p.getCluster().getId()) : p.isSetHost() && p.getHost().isSetId() ? GuidUtils.asGuid(p.getHost().getId()) : p.isSetStorageDomain() && p.getStorageDomain().isSetId() ? GuidUtils.asGuid(p.getStorageDomain().getId()) : p.isSetVm() && p.getVm().isSetId() ? GuidUtils.asGuid(p.getVm().getId()) : p.isSetVmPool() && p.getVmPool().isSetId() ? GuidUtils.asGuid(p.getVmPool().getId()) : p.isSetTemplate() && p.getTemplate().isSetId() ? GuidUtils.asGuid(p.getTemplate().getId()) : template; }
@Mapping(from = DataCenter.class, to = StoragePool.class) public static StoragePool map(DataCenter model, StoragePool template) { StoragePool entity = template != null ? template : new StoragePool(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId()));
entity.setArchitecture(CPUMapper.map(model.getCpu().getArchitecture(), null)); if (model.isSetDataCenter() && model.getDataCenter().isSetId()) { entity.setStoragePoolId(GuidUtils.asGuid(model.getDataCenter().getId()));