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

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

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

Network.getLabel介绍

暂无

代码示例

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

/**
 * Determine if a given network is labeled
 *
 * @param network
 *            the network to check.
 * @return <code>true</code> iff the network is labeled.
 */
public static boolean isLabeled(Network network) {
  return network.getLabel() != null;
}

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

@Override
public List<Network> getAllByLabelForCluster(String label, Guid clusterId) {
  List<Network> networksInCluster = getAllForCluster(clusterId);
  return networksInCluster.stream()
      .filter(network -> StringUtils.equals(network.getLabel(), label)).collect(Collectors.toList());
}

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

public String getLabelViaAttached() {
  return labelModel.computeSelectedLabels().contains(getEntity().getLabel()) ? getEntity().getLabel()
      : null;
}

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

private void initNetworkModels() {
  Map<String, LogicalNetworkModel> networkModels = new HashMap<>();
  Map<Guid, NetworkAttachment> networkAttachmentByNetworkId = mapNetworkAttachmentsByNetworkId();
  for (Network network : allNetworks) {
    NetworkAttachment attachment = networkAttachmentByNetworkId.get(network.getId());
    LogicalNetworkModel networkModel = new LogicalNetworkModel(network, attachment, this);
    networkModels.put(network.getName(), networkModel);
    if (networkModel.isManagement()) {
      managementNetworkModel = networkModel;
    }
    if (!network.isExternal()) {
      String label = network.getLabel();
      if (label != null) {
        // The network model is candidate to be drawn as part of the label.
        // This doesn't yet consider whether it actually exists on the interface.
        networkLabelModelByLabel.get(label).getNetworks().add(networkModel);
      }
    }
  }
  setNetworks(networkModels);
}

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

private void setLabelErrorsOnNicModels(Map<String, NetworkInterfaceModel> nicModels,
    List<LogicalNetworkModel> networkModelsWithLabelError,
    Map<String, String> labelToDesiredNicName) {
  for (LogicalNetworkModel networkModel : networkModelsWithLabelError) {
    NetworkInterfaceModel desiredNicModel =
        nicModels.get(labelToDesiredNicName.get(networkModel.getNetwork().getLabel()));
    NetworkOperation operation = NetworkOperationFactory.operationFor(networkModel, desiredNicModel);
    UIMessages messages = ConstantsManager.getInstance().getMessages();
    // Should be attached but can't due to conflict
    if (desiredNicModel != null) {
      if (operation.isNullOperation()) {
        networkModel.setErrorMessage(messages.networkLabelConflict(desiredNicModel.getName(),
            networkModel.getNetwork().getLabel())
            + " " + operation.getMessage(networkModel, desiredNicModel)); //$NON-NLS-1$
      } else {
        networkModel.setErrorMessage(messages.labeledNetworkNotAttached(desiredNicModel.getName(),
            networkModel.getNetwork().getLabel()));
      }
    }
  }
}

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

/**
 * Ensures a list of networks is returned for a given cluster by a specific label
 */
@Test
public void getAllByLabelForCluster() {
  List<Network> result = dao.getAllByLabelForCluster(NETWORK_LABEL, FixturesTool.CLUSTER);
  assertNotNull(result);
  assertFalse(result.isEmpty());
  for (Network network : result) {
    assertEquals(NETWORK_LABEL, network.getLabel());
  }
}

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

@Override
public String toString() {
  return ToStringBuilder.forInstance(this)
      .append("id", getId())
      .append("description", getDescription())
      .append("comment", getComment())
      .append("vdsmName", getVdsmName())
      .append("subnet", getSubnet())
      .append("gateway", getGateway())
      .append("type", getType())
      .append("vlanId", getVlanId())
      .append("stp", getStp())
      .append("dataCenterId", getDataCenterId())
      .append("mtu", getMtu())
      .append("vmNetwork", isVmNetwork())
      .append("cluster", getCluster())
      .append("providedBy", getProvidedBy())
      .append("label", getLabel())
      .append("qosId", getQosId())
      .append("dnsResolverConfiguration", dnsResolverConfiguration)
      .build();
}

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

@Override
protected MapSqlParameterSource createFullParametersMapper(Network network) {
  return getCustomMapSqlParameterSource()
      .addValue("addr", network.getAddr())
      .addValue("description", network.getDescription())
      .addValue("free_text_comment", network.getComment())
      .addValue("id", network.getId())
      .addValue("name", network.getName())
      .addValue("vdsm_name", network.getVdsmName())
      .addValue("subnet", network.getSubnet())
      .addValue("gateway", network.getGateway())
      .addValue("type", network.getType())
      .addValue("vlan_id", network.getVlanId())
      .addValue("stp", network.getStp())
      .addValue("storage_pool_id", network.getDataCenterId())
      .addValue("mtu", network.getMtu())
      .addValue("vm_network", network.isVmNetwork())
      .addValue("provider_network_provider_id",
          network.getProvidedBy() == null ? null : network.getProvidedBy().getProviderId())
      .addValue("provider_network_external_id",
          network.getProvidedBy() == null ? null : network.getProvidedBy().getExternalId())
      .addValue("provider_physical_network_id",
          network.getProvidedBy() == null ? null : network.getProvidedBy().getPhysicalNetworkId())
      .addValue("qos_id", network.getQosId())
      .addValue("label", network.getLabel())
      .addValue("dns_resolver_configuration_id", getDnsResolverConfigurationId(network));
}

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

private void init() {
  setTitle(ConstantsManager.getInstance().getConstants().editLogicalNetworkTitle());
  setHelpTag(HelpTag.edit_logical_network);
  setHashName("edit_logical_network"); //$NON-NLS-1$
  getName().setEntity(getNetwork().getName());
  getDescription().setEntity(getNetwork().getDescription());
  getComment().setEntity(getNetwork().getComment());
  getIsStpEnabled().setEntity(getNetwork().getStp());
  getConnectedToPhysicalNetwork().setEntity(isConnectedToPhysicalNetwork());
  initMtu();
  initIsVm();
  getExternal().setEntity(getNetwork().isExternal());
  getExternal().setIsChangeable(false);
  if (isConnectedToPhysicalNetwork()) {
    if (getNetwork().getProvidedBy().isSetPhysicalNetworkId()) {
      getUsePhysicalNetworkFromDatacenter().setEntity(true);
    }
  } else {
    getNetworkLabel().setSelectedItem(getNetwork().getLabel());
    getHasVLanTag().setEntity(getNetwork().getVlanId() != null);
    getVLanTag().setEntity(getNetwork().getVlanId());
  }
  toggleProfilesAvailability();
}

相关文章