本文整理了Java中org.ovirt.engine.core.compat.Guid.createGuidListFromString()
方法的一些代码示例,展示了Guid.createGuidListFromString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Guid.createGuidListFromString()
方法的具体详情如下:
包路径:org.ovirt.engine.core.compat.Guid
类名称:Guid
方法名:createGuidListFromString
[英]Gets a string containing multiple Guid
values separated by a comma and returns a List of Guid
. If the String is null/empty returns an empty array.
[中]获取一个字符串,该字符串包含由逗号分隔的多个Guid
值,并返回Guid
的列表。如果字符串为null/empty,则返回空数组。
代码示例来源:origin: oVirt/ovirt-engine
public Set<Guid> fetchMemoryDisks(XmlDocument xmlDocument) {
Set<Guid> memoryDiskIds = new HashSet<>();
xmlDocument.selectNodes("ovf:SnapshotsSection_Type");
XmlNode content = xmlDocument.selectSingleNode("//*/Content");
XmlNodeList nodeList = content.selectNodes("Section");
if (nodeList != null) {
for (XmlNode section : nodeList) {
String value = section.attributes.get("xsi:type").getValue();
if (value.equals("ovf:SnapshotsSection_Type")) {
Iterator<XmlNode> snapshotIter = section.selectNodes("Snapshot").iterator();
while (snapshotIter.hasNext()) {
XmlNode memorySnapshot = snapshotIter.next().selectSingleNode("Memory");
if (memorySnapshot != null) {
List<Guid> guids = Guid.createGuidListFromString(memorySnapshot.innerText);
memoryDiskIds.add(guids.get(2));
memoryDiskIds.add(guids.get(4));
}
}
}
}
}
return memoryDiskIds;
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testNullGuidListValues() {
List<Guid> stringList = Guid.createGuidListFromString(null);
List<Guid> expectedList = new ArrayList<>();
assertEquals(expectedList, stringList);
}
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testEmptyGuidListValues() {
String listValues = "";
List<Guid> stringList = Guid.createGuidListFromString(listValues);
List<Guid> expectedList = new ArrayList<>();
assertEquals(expectedList, stringList);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGuidListValuesWithOneGuid() {
String listValues = "e61f7070-cd52-46ca-88c2-686e1c70fe44";
List<Guid> stringList = Guid.createGuidListFromString(listValues);
List<Guid> expectedList = new ArrayList<>();
expectedList.add(new Guid("e61f7070-cd52-46ca-88c2-686e1c70fe44"));
assertEquals(expectedList, stringList);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGuidListValues() {
String listValues = "e61f7070-cd52-46ca-88c2-686e1c70fe44,1eaa381a-fbf9-4ef5-bec2-6e4337f85d66";
List<Guid> stringList = Guid.createGuidListFromString(listValues);
List<Guid> expectedList = new ArrayList<>();
expectedList.add(new Guid("e61f7070-cd52-46ca-88c2-686e1c70fe44"));
expectedList.add(new Guid("1eaa381a-fbf9-4ef5-bec2-6e4337f85d66"));
assertEquals(expectedList, stringList);
}
代码示例来源:origin: oVirt/ovirt-engine
.getTimestamp("lastModified")));
entity.setAppList(rs.getString("app_list"));
entity.setStorageIds(Guid.createGuidListFromString(rs.getString("storage_id")));
entity.setStorageTypes(getStorageTypesList(rs.getString("storage_type")));
entity.setStoragesNames(split(rs.getString("storage_name")));
代码示例来源:origin: oVirt/ovirt-engine
entity.setSpiceCopyPasteEnabled(rs.getBoolean("is_spice_copy_paste_enabled"));
entity.setMigrationSupport(MigrationSupport.forValue(rs.getInt("migration_support")));
entity.setDedicatedVmForVdsList(Guid.createGuidListFromString(rs.getString("dedicated_vm_for_vds")));
entity.setMinAllocatedMem(rs.getInt("min_allocated_mem"));
entity.setQuotaId(getGuid(rs, "quota_id"));
代码示例来源:origin: oVirt/ovirt-engine
XmlNode memory = selectSingleNode(node, "Memory", _xmlNS);
if (memory != null) {
List<Guid> guids = Guid.createGuidListFromString(memory.innerText);
snapshot.setMemoryDiskId(guids.get(2));
snapshot.setMetadataDiskId(guids.get(4));
内容来源于网络,如有侵权,请联系作者删除!