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

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

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

Network.getProvidedBy介绍

暂无

代码示例

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

private Network findCurrentNetwork(Map<Network, Set<Guid>> networks) {
  final Network result;
  if (networks == null) {
    result = null;
  } else {
    result = networks.keySet()
        .stream()
        .filter(network -> Objects.equals(network.getProvidedBy().getExternalId(), id))
        .findFirst()
        .orElse(null);
  }
  if (result == null) {
    // This will never return but always throw a WebApplicationException
    notFound();
  }
  return result;
}

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

public boolean isTunnelled() {
  return isExternal() && getProvidedBy().getPhysicalNetworkId()==null;
}

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

@Override
protected void selectPhysicalDatacenterNetwork() {
  final Network network = getNetwork();
  if (network.isExternal() && network.getProvidedBy().isSetPhysicalNetworkId()) {
    getDatacenterPhysicalNetwork().getItems()
        .stream()
        .filter(net -> Objects.equals(net.getId(), network.getProvidedBy().getPhysicalNetworkId()))
        .findAny()
        .ifPresent(this.getDatacenterPhysicalNetwork()::setSelectedItem);
  }
}

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

private boolean isConnectedToPhysicalNetwork() {
  final Network network = getNetwork();
  return network.isExternal() && (network.getProvidedBy().isSetPhysicalNetworkId()
      || StringHelper.isNotNullOrEmpty(network.getProvidedBy().getCustomPhysicalNetworkName()));
}

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

@Override
protected void initEnablePortSecurity() {
  if (getNetwork().getProvidedBy().isPortSecurityConfigured()) {
    getPortSecuritySelector().setSelectedItem(
        getNetwork().getProvidedBy().getPortSecurityEnabled() ?
            PortSecuritySelectorValue.ENABLED : PortSecuritySelectorValue.DISABLED
    );
  } else {
    getPortSecuritySelector().setSelectedItem(PortSecuritySelectorValue.UNDEFINED);
  }
}

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

@Override
public boolean test(Provider<?> provider) {
  return network.isExternal() && provider.getId().equals(network.getProvidedBy().getProviderId());
}

代码示例来源: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

private void initPhysnetAttachmentParameters() {
  if (isConnectedToPhysicalNetwork()) {
    getConnectedToPhysicalNetwork().setEntity(true);
    getUsePhysicalNetworkFromCustom().setEntity(true);
    getCustomPhysicalNetwork().setEntity(getNetwork().getProvidedBy().getCustomPhysicalNetworkName());
  }
  getHasVLanTag().setEntity(getNetwork().getProvidedBy().hasExternalVlanId());
  getVLanTag().setEntity(getNetwork().getProvidedBy().getExternalVlanId());
  onExportChanged();
}

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

public void onImport() {
  if (!validate()) {
    return;
  }
  List<ActionParametersBase> multipleActionParameters = new LinkedList<>();
  for (final ExternalNetwork externalNetwork : importedNetworks.getItems()) {
    final Network network = externalNetwork.getNetwork();
    final Guid dcId = externalNetwork.getDataCenters().getSelectedItem().getId();
    ImportExternalNetworkParameters params = new ImportExternalNetworkParameters(
        network.getProvidedBy().getProviderId(), network.getProvidedBy().getExternalId(), dcId,
        externalNetwork.isPublicUse(), true);
    multipleActionParameters.add(params);
  }
  Frontend.getInstance().runMultipleActions(ActionType.ImportExternalNetwork, multipleActionParameters,
      result -> sourceListModel.getSearchCommand().execute());
  cancel();
}

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

@Mapping(from = Network.class, to = OpenStackNetwork.class)
public static OpenStackNetwork map(Network entity, OpenStackNetwork template) {
  OpenStackNetwork model = template != null? template: new OpenStackNetwork();
  ProviderNetwork providedBy = entity.getProvidedBy();
  if (providedBy != null) {
    if (providedBy.getExternalId() != null) {
      model.setId(providedBy.getExternalId());
    }
  }
  if (entity.getName() != null) {
    model.setName(entity.getName());
  }
  return model;
}

代码示例来源: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

/**
 * Ensures the right set of networks are returned for the given provider.
 */
@Test
public void testGetAllForProvider() {
  List<Network> result = dao.getAllForProvider(FixturesTool.PROVIDER_ID);
  assertNotNull(result);
  assertFalse(result.isEmpty());
  for (Network network : result) {
    assertEquals(FixturesTool.PROVIDER_ID, network.getProvidedBy().getProviderId());
  }
}

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

@Override
public void executeSave() {
  if (getExternal().getEntity() && getConnectedToPhysicalNetwork().getEntity()
      && getUsePhysicalNetworkFromCustom().getEntity()) {
    getNetwork().getProvidedBy().setCustomPhysicalNetworkName(null);
    getNetwork().getProvidedBy().setExternalVlanId(null);
  }
  Frontend.getInstance().runAction(ActionType.UpdateNetwork,
      new AddNetworkStoragePoolParameters(getSelectedDc().getId(), getNetwork()),
      result -> {
        ActionReturnValue retVal = result.getReturnValue();
        postSaveAction(null,
            retVal != null && retVal.getSucceeded());
      },
      null);
}

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

private void checkAndMapNetwork() {
  if (getNetwork().isExternal()) {
    startProgress();
    Frontend.getInstance()
        .runQuery(QueryType.GetExternalNetworkById,
            new IdQueryParameters(getNetwork().getId()),
            new AsyncQuery<QueryReturnValue>(result -> {
              Network network = result.getReturnValue();
              if (network != null) {
                getNetwork().setProvidedBy(network.getProvidedBy());
                initEnablePortSecurity();
                if (!getNetwork().getProvidedBy().isSetPhysicalNetworkId()) {
                  initPhysnetAttachmentParameters();
                }
              }
              stopProgress();
            }, true));
  } else {
    getPortSecuritySelector().setSelectedItem(PortSecuritySelectorValue.UNDEFINED);
  }
}

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

private void updateProperties() {
  Network extendedNetwork = getEntity();
  setName(extendedNetwork.getName());
  setId(extendedNetwork.getId());
  setDescription(extendedNetwork.getDescription());
  setVmNetwork(extendedNetwork.isVmNetwork());
  setVlan(extendedNetwork.getVlanId());
  setMtu(extendedNetwork.getMtu());
  setVdsmName(extendedNetwork.getVdsmName());
  if (extendedNetwork.isExternal()) {
    setExternalId(extendedNetwork.getProvidedBy().getExternalId());
  } else {
    setExternalId(null);
  }
}

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

private static Network cloneNetwork(Network instance) {
  Network obj = new Network();
  obj.setAddr(instance.getAddr());
  obj.setDescription(instance.getDescription());
  obj.setComment(instance.getComment());
  obj.setId(instance.getId());
  obj.setName(instance.getName());
  obj.setVdsmName(instance.getVdsmName());
  obj.setSubnet(instance.getSubnet());
  obj.setGateway(instance.getGateway());
  obj.setType(instance.getType());
  obj.setVlanId(instance.getVlanId());
  obj.setStp(instance.getStp());
  obj.setDataCenterId(instance.getDataCenterId());
  obj.setMtu(instance.getMtu());
  obj.setVmNetwork(instance.isVmNetwork());
  if (instance.getCluster() !=null){
    obj.setCluster(cloneNetworkCluster(instance.getCluster()));
  }
  if (instance.getProvidedBy() != null) {
    obj.setProvidedBy(cloneProviderNetwork(instance.getProvidedBy()));
  }
  return obj;
}

代码示例来源: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

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();
}

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

providerNetwork.setProviderId(externalProvider.getId());
getNetwork().setProvidedBy(providerNetwork);
getNetwork().getProvidedBy().setPortSecurityEnabled(getPortSecuritySelector().getSelectedItem().getValue());
if (hasDefinedSubnet()) {
  getSubnetModel().flush();

相关文章