本文整理了Java中org.ovirt.engine.core.compat.Guid.<init>()
方法的一些代码示例,展示了Guid.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Guid.<init>()
方法的具体详情如下:
包路径:org.ovirt.engine.core.compat.Guid
类名称:Guid
方法名:<init>
[英]This constructor should never be used directly - use #Empty instead. It is left here only because GWT requires it.
[中]此构造函数不应直接使用-请使用#Empty。它留在这里只是因为GWT需要它。
代码示例来源:origin: oVirt/ovirt-engine
private static Guid createGuidFromStringWithDefault(String candidate, Guid defaultValue) {
if (candidate == null) {
return defaultValue;
}
return new Guid(candidate);
}
代码示例来源:origin: oVirt/ovirt-engine
public static Guid asGuid(byte[] guid) {
try {
return new Guid(guid);
} catch (IllegalArgumentException e) {
throw new MalformedIdException(e);
}
}
代码示例来源:origin: oVirt/ovirt-engine
protected Guid asGuid(byte[] guid) {
try {
return new Guid(guid);
} catch (IllegalArgumentException e) {
throw new MalformedIdException(e);
}
}
代码示例来源:origin: oVirt/ovirt-engine
protected Guid asGuid(String id) {
try {
return new Guid(id);
}catch (IllegalArgumentException e) {
throw new MalformedIdException(e);
}
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
public List<Pair<Guid, String>> getAllDevicesHashes() {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource();
return getCallsHandler().executeReadList("GetAllHashesFromVmDynamic",
(rs, i) -> new Pair<>(new Guid(rs.getString("vm_guid")), rs.getString("hash")),
parameterSource);
}
代码示例来源:origin: oVirt/ovirt-engine
public static void setupMemoryBalloon(VmBase vmBase, BackendResource parentResource) {
Boolean balloonEnabled = parentResource.getEntity(Boolean.class,
QueryType.IsBalloonEnabled,
new IdQueryParameters(new Guid(vmBase.getId())),
null,
true);
if (!vmBase.isSetMemoryPolicy()) {
vmBase.setMemoryPolicy(new MemoryPolicy());
}
vmBase.getMemoryPolicy().setBallooning(balloonEnabled);
}
}
代码示例来源:origin: oVirt/ovirt-engine
public static void setVirtioScsiController(BackendResource resouce, Vm vm) {
if (!vm.isSetVirtioScsi()) {
vm.setVirtioScsi(new VirtioScsi());
}
vm.getVirtioScsi().setEnabled(!VmHelper.getVirtioScsiControllersForEntity(resouce, new Guid(vm.getId())).isEmpty());
}
代码示例来源:origin: oVirt/ovirt-engine
private Guid getDataCenterId(Action action) {
String dcIdFromAction = action.getDataCenter().getId();
if (dcIdFromAction != null) {
return new Guid(dcIdFromAction);
}
return getDataCenterIdByName(action.getDataCenter().getName());
}
代码示例来源:origin: oVirt/ovirt-engine
public static void setConsoleDevice(BackendResource resouce, Vm vm) {
if (!vm.isSetConsole()) {
vm.setConsole(new Console());
}
vm.getConsole().setEnabled(!getConsoleDevicesForEntity(resouce, new Guid(vm.getId())).isEmpty());
}
代码示例来源: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);
}
代码示例来源:origin: oVirt/ovirt-engine
public DbGroup(DirectoryGroup directoryGroup) {
externalId = directoryGroup.getId();
setId(new Guid(directoryGroup.getId().getBytes()));
namespace = directoryGroup.getNamespace();
setDomain(directoryGroup.getDirectoryName());
setName(directoryGroup.getName());
distinguishedName = "";
}
代码示例来源:origin: oVirt/ovirt-engine
private Guid getTempalteId(Template template) {
Guid result = null;
if (template.isSetId()) {
result = new Guid(template.getId());
} else if (template.isSetName()) {
result = lookupTemplateByName(template.getName()).getId();
}
return result;
}
代码示例来源:origin: oVirt/ovirt-engine
@BeforeEach
@Override
public void setUp() throws Exception {
super.setUp();
// create some test data
new_bookmark = new Bookmark();
Random r = new Random(System.currentTimeMillis());
new_bookmark.setName("newbookmarkname" + (r.nextInt() % BOOKMARK_MAX_RANDOM_NUMBER));
new_bookmark.setValue("newbookmarkvalue");
existing_bookmark = dao.get(new Guid("a4affabf-7b45-4a6c-b0a9-107d0bbe265e"));
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testSelfAndIdentifyEquality() {
Guid vmId = new Guid("b23ad6d7-0df8-4d69-b4e5-d5b5e90c2463");
Guid deviceId = new Guid("b23ad6d7-0df8-4d69-b4e5-d5b5e90c2464");
VmDevice device1 = createVmDevice(deviceId, vmId);
assertEquals(0, device1.compareTo(device1));
VmDevice device2 = createVmDevice(deviceId, vmId);
assertEquals(0, device1.compareTo(device2));
}
代码示例来源:origin: oVirt/ovirt-engine
private Guid getHostId(Host host) {
// presence of host ID or name already validated
return host.isSetId()
? new Guid(host.getId())
: host.isSetName()
? getEntity(VdsStatic.class,
QueryType.GetVdsStaticByName,
new NameQueryParameters(host.getName()),
"Hosts: name=" + host.getName()).getId()
: null;
}
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGetBySlaveHostAndVolume() {
GlusterGeoRepSession session = dao.getGeoRepSession(FixturesTool.GLUSTER_VOLUME_UUID1,
new Guid("44f645f6-3fe9-4b35-a30c-be0d1a835ea8"), "slave-replica");
assertNotNull(session);
assertEquals(FixturesTool.GLUSTER_GEOREP_SESSION_ID, session.getId());
}
代码示例来源:origin: oVirt/ovirt-engine
private void completeSlaveNames(BusinessEntityMap<VdsNetworkInterface> nicsFromBackend, HostNic bond) {
if (bond.isSetBonding() && bond.getBonding().isSetSlaves()) {
for (HostNic slave : bond.getBonding().getSlaves().getHostNics()) {
if (!slave.isSetName() && slave.isSetId()){
Guid slaveId = new Guid(slave.getId());
String slaveNameFromBackend = nicsFromBackend.get(slaveId).getName();
slave.setName(slaveNameFromBackend);
}
}
}
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
@Override
public void testRoundtrip() throws Exception {
Application model = Application.class.cast(populate(Application.class));
model = postPopulate(model);
model.setName(NAMES[0]);
model.setId(new Guid(NAMES[0].getBytes()).toString());
Mapper<String, Application> back = getMappingLocator().getMapper(String.class, Application.class);
Application transform = back.map(NAMES[0], null);
verify(model, transform);
}
代码示例来源:origin: oVirt/ovirt-engine
private Guid getHostId(StorageDomain storageDomain) {
// presence of host ID or name already validated
return storageDomain.getHost().isSetId()
? new Guid(storageDomain.getHost().getId())
: storageDomain.getHost().isSetName()
? getEntity(VdsStatic.class,
QueryType.GetVdsStaticByName,
new NameQueryParameters(storageDomain.getHost().getName()),
"Hosts: name=" + storageDomain.getHost().getName()).getId()
: null;
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testUpdateAll() {
DiskImageDynamic existingEntity2 = dao.get(new Guid("42058975-3d5e-484a-80c1-01c31207f579"));
existingEntity.setActualSize(100);
existingEntity2.setReadRate(120);
existingEntity.setReadLatency(100d);
existingEntity2.setReadLatency(0.00001d);
dao.updateAll(Arrays.asList(existingEntity, existingEntity2));
assertEquals(existingEntity, dao.get(existingEntity.getId()));
assertEquals(existingEntity2, dao.get(existingEntity2.getId()));
}
内容来源于网络,如有侵权,请联系作者删除!