org.ovirt.engine.core.common.businessentities.network.Network.getName()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中org.ovirt.engine.core.common.businessentities.network.Network.getName()方法的一些代码示例,展示了Network.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Network.getName()方法的具体详情如下:
包路径:org.ovirt.engine.core.common.businessentities.network.Network
类名称:Network
方法名:getName

Network.getName介绍

暂无

代码示例

代码示例来源:origin: oVirt/ovirt-engine

@Override
  public String getValue(Network network) {
    return network.getName();
  }
};

代码示例来源:origin: oVirt/ovirt-engine

private org.ovirt.engine.core.common.businessentities.network.Network getNetworkByName(String networkName,
    List<org.ovirt.engine.core.common.businessentities.network.Network> networks) {
  for (org.ovirt.engine.core.common.businessentities.network.Network network : networks) {
    if (network.getName().equals(networkName)) {
      return network;
    }
  }
  return null;
}

代码示例来源:origin: oVirt/ovirt-engine

private org.ovirt.engine.core.common.businessentities.network.Network lookupAtachedNetwork(String networkName) {
  if(!StringUtils.isEmpty(networkName)){
    for(org.ovirt.engine.core.common.businessentities.network.Network nwk : parent.getClusterNetworks()){
      if(nwk.getName().equals(networkName)) {
        return nwk;
      }
    }
  }
  return null;
}

代码示例来源:origin: oVirt/ovirt-engine

private Map<String, Guid> mapNetworkNamesToNetworkIds() {
  List<org.ovirt.engine.core.common.businessentities.network.Network> clusterNetworks = getClusterNetworks();
  Map<String, Guid> networkIdByName = new HashMap<>();
  for(org.ovirt.engine.core.common.businessentities.network.Network nwk : clusterNetworks) {
    networkIdByName.put(nwk.getName(), nwk.getId());
  }
  return networkIdByName;
}

代码示例来源:origin: oVirt/ovirt-engine

private static void assertIsSorted(List<Network> result) {
  Network previous = null;
  for (Network network : result) {
    if (previous != null && network.getName().compareTo(previous.getName()) < 0) {
      fail(String.format("List of networks is not ordered by network name, %s came before %s.",
          previous.getName(),
          network.getName()));
    }
    previous = network;
  }
}

代码示例来源:origin: oVirt/ovirt-engine

public static void setNetworkVdsmName(Network network) {
  String networkName = network.getName();
  if (VALID_VDS_NAME_PATTERN.matcher(networkName).matches()) {
    network.setVdsmName(networkName);
  } else {
    network.setVdsmName("on" + network.getId().toString()
        .replaceAll("[^a-zA-Z0-9]+", "")
        .substring(0, BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH - 2));
  }
}

代码示例来源:origin: oVirt/ovirt-engine

public org.ovirt.engine.core.common.businessentities.network.Network lookupNetwork(Guid id, String name) {
  for (org.ovirt.engine.core.common.businessentities.network.Network entity : getBackendCollection(queryType, getQueryParameters())) {
    if ((id != null && id.equals(entity.getId())) ||
      (name != null && name.equals(entity.getName()))) {
      return entity;
    }
  }
  return null;
}

代码示例来源:origin: oVirt/ovirt-engine

public NetworkAttachment(VdsNetworkInterface baseNic, Network network, IpConfiguration ipConfiguration) {
  this.networkId = network.getId();
  this.networkName = network.getName();
  this.nicId = baseNic.getId();
  this.nicName = baseNic.getName();
  this.ipConfiguration = ipConfiguration;
}

代码示例来源:origin: oVirt/ovirt-engine

static org.ovirt.engine.core.common.businessentities.network.Network setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.network.Network entity, int index) {
  when(entity.getId()).thenReturn(GUIDS[index]);
  when(entity.getName()).thenReturn(NAMES[index]);
  when(entity.getDescription()).thenReturn(DESCRIPTIONS[index]);
  when(entity.getDataCenterId()).thenReturn(GUIDS[1]);
  return entity;
}

代码示例来源:origin: oVirt/ovirt-engine

protected Model setTitle() {
    return setTitle(ConstantsManager.getInstance()
        .getMessages()
        .editNetworkTitle(network.getName()));
  }
}

代码示例来源:origin: oVirt/ovirt-engine

public org.ovirt.engine.core.common.businessentities.network.Network lookupNetwork(Guid id, String name, String dataCenterId) {
  for (org.ovirt.engine.core.common.businessentities.network.Network entity : getBackendCollection(queryType, getQueryParameters())) {
    if ((id != null && id.equals(entity.getId())) ||
      (name != null && name.equals(entity.getName()))
      && (entity.getDataCenterId()!=null) && entity.getDataCenterId().toString().equals(dataCenterId)) {
      return entity;
    }
  }
  return null;
}

代码示例来源:origin: oVirt/ovirt-engine

private void cancelImport() {
  Collection<ExternalNetwork> selectedNetworks = getImportedNetworks().getSelectedItems();
  Collection<ExternalNetwork> importedNetworks = getImportedNetworks().getItems();
  getDefaultCommand().setIsExecutionAllowed(selectedNetworks.size() < importedNetworks.size());
  for (ExternalNetwork externalNetwork : selectedNetworks) {
    externalNetwork.setDisplayName(externalNetwork.getNetwork().getName());
  }
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
  protected Model setTitle() {
    return setTitle(
        ConstantsManager.getInstance().getMessages().editManagementNetworkTitle(getNetwork().getName()));
  }
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
protected Network getEntity(int index) {
  Network network = mock(Network.class);
  when(network.getId()).thenReturn(GUIDS[index]);
  when(network.getName()).thenReturn(NAMES[index]);
  ProviderNetwork providedBy = new ProviderNetwork();
  providedBy.setProviderId(GUIDS[0]);
  providedBy.setExternalId(string2hex(NAMES[index]));
  when(network.getProvidedBy()).thenReturn(providedBy);
  return network;
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
protected Network getEntity(int index) {
  Network network = mock(Network.class);
  when(network.getId()).thenReturn(GUIDS[index]);
  when(network.getName()).thenReturn(NAMES[index]);
  ProviderNetwork providedBy = new ProviderNetwork();
  providedBy.setProviderId(GUIDS[0]);
  providedBy.setExternalId(string2hex(NAMES[index]));
  when(network.getProvidedBy()).thenReturn(providedBy);
  return network;
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Ensures that retrieving a network by name and cluster works as expected.
 */
@Test
public void testGetByNameAndCluster() {
  Network result = dao.getByNameAndCluster(EXISTING_NETWORK_NAME1, FixturesTool.CLUSTER);
  assertNotNull(result);
  assertEquals(EXISTING_NETWORK_NAME1, result.getName());
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Ensures that retrieving a network by name works as expected.
 */
@Test
public void testGetByName() {
  Network result = dao.getByNameAndCluster(EXISTING_NETWORK_NAME1, FixturesTool.CLUSTER);
  assertNotNull(result);
  assertEquals(EXISTING_NETWORK_NAME1, result.getName());
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Ensures that retrieving a network by name and data center works as expected.
 */
@Test
public void testGetByNameAndDataCenter() {
  Network result = dao.getByNameAndDataCenter(EXISTING_NETWORK_NAME1, FixturesTool.DATA_CENTER);
  assertNotNull(result);
  assertEquals(EXISTING_NETWORK_NAME1, result.getName());
}

代码示例来源:origin: oVirt/ovirt-engine

@Test
public void testGetEntityNameByIdAndTypeForNetwork() {
  Network network = networkDao.get(NETWORK_ID);
  assertNotNull(network);
  String name = network.getName();
  assertEquals(name, dao.getEntityNameByIdAndType(NETWORK_ID, VdcObjectType.Network));
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
public Response doImport(Action action) {
  validateParameters(action, "dataCenter.id|name");
  Guid dataCenterId = getDataCenterId(action);
  ProviderNetwork providerNetwork = new ProviderNetwork(new Guid(providerId), id);
  Network network = new Network();
  network.setProvidedBy(providerNetwork);
  network.setDataCenterId(dataCenterId);
  network.setName(getNetwork().getName());
  AddNetworkStoragePoolParameters parameters = new AddNetworkStoragePoolParameters(dataCenterId, network);
  return doAction(ActionType.AddNetwork, parameters, action);
}

相关文章