本文整理了Java中org.ovirt.engine.core.common.businessentities.network.Network.setCluster()
方法的一些代码示例,展示了Network.setCluster()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Network.setCluster()
方法的具体详情如下:
包路径:org.ovirt.engine.core.common.businessentities.network.Network
类名称:Network
方法名:setCluster
暂无
代码示例来源:origin: oVirt/ovirt-engine
@Override
public Network mapRow(ResultSet rs, int rowNum) throws SQLException {
Network entity = super.mapRow(rs, rowNum);
entity.setCluster(new NetworkCluster());
entity.getCluster().setDisplay((Boolean) rs.getObject("is_display"));
entity.getCluster().setRequired(rs.getBoolean("required"));
entity.getCluster().setStatus(NetworkStatus.forValue(rs.getInt("status")));
entity.getCluster().setMigration(rs.getBoolean("migration"));
entity.getCluster().setManagement(rs.getBoolean("management"));
entity.getCluster().setGluster(rs.getBoolean("is_gluster"));
entity.getCluster().setDefaultRoute(rs.getBoolean("default_route"));
return entity;
}
}
代码示例来源:origin: oVirt/ovirt-engine
public ClusterNetworkModel(Network network) {
setEntity(network);
if (network.getCluster() == null) {
originalNetworkCluster = null;
attached = false;
// Init with default values
getEntity().setCluster(new NetworkCluster(false));
} else {
originalNetworkCluster = (NetworkCluster) Cloner.clone(network.getCluster());
}
}
代码示例来源:origin: oVirt/ovirt-engine
private ClusterNetworkManageModel createManageList() {
List<ClusterNetworkModel> networkManageModelList = new ArrayList<>();
Iterable<PairQueryable<Cluster, NetworkCluster>> items = getItems();
for (PairQueryable<Cluster, NetworkCluster> item : items) {
Network network = (Network) Cloner.clone(getEntity());
if (item.getSecond() != null) {
network.setCluster((NetworkCluster) Cloner.clone(item.getSecond()));
}
ClusterNetworkModel networkManageModel = new ClusterNetworkModel(network) {
@Override
public String getDisplayedName() {
return getCluster().getName();
}
};
networkManageModel.setCluster((Cluster) Cloner.clone(item.getFirst()));
networkManageModelList.add(networkManageModel);
}
Collections.sort(networkManageModelList, manageModelComparator);
ClusterNetworkManageModel listModel = new ClusterNetworkManageModel(this) {
@Override
public boolean isMultiCluster() {
return true;
}
};
listModel.setItems(networkManageModelList);
return listModel;
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
protected org.ovirt.engine.core.common.businessentities.network.Network getEntity(int index) {
org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network();
NetworkCluster networkCluster = new NetworkCluster();
networkCluster.setDisplay(false);
networkCluster.setMigration(false);
networkCluster.setRequired(false);
networkCluster.setDefaultRoute(false);
network.setCluster(networkCluster);
network.setId(GUIDS[index]);
network.setName(NAMES[index]);
network.setDescription(DESCRIPTIONS[index]);
network.setDataCenterId(GUIDS[1]);
return network;
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Ensures that saving a network works as expected.
*/
@Test
public void testSave() {
List<NetworkCluster> clustersFromDB = networkClusterDao.getAllForCluster(FixturesTool.CLUSTER);
DnsResolverConfiguration dnsResolverConfiguration =
dnsResolverConfigurationDao.get(FixturesTool.EXISTING_DNS_RESOLVER_CONFIGURATION);
dnsResolverConfiguration.setId(null);
NetworkCluster clusterFromDB = clustersFromDB.get(0);
assertNotNull(clusterFromDB);
newNet.setCluster(clusterFromDB);
newNet.setId(Guid.newGuid());
newNet.setDnsResolverConfiguration(dnsResolverConfiguration);
dao.save(newNet);
Network result = dao.getByNameAndDataCenter(newNet.getName(), FixturesTool.DATA_CENTER);
assertNotNull(result);
assertEquals(newNet, result);
}
代码示例来源:origin: oVirt/ovirt-engine
@Mapping(from = Network.class, to = org.ovirt.engine.core.common.businessentities.network.Network.class)
public static org.ovirt.engine.core.common.businessentities.network.Network map(Network model, org.ovirt.engine.core.common.businessentities.network.Network template) {
org.ovirt.engine.core.common.businessentities.network.Network entity = template != null ? template : new org.ovirt.engine.core.common.businessentities.network.Network();
entity.setCluster(template != null && template.getCluster() != null ? template.getCluster() : new NetworkCluster());
if (model.isSetId()) {
entity.setId(GuidUtils.asGuid(model.getId()));
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!