com.evolveum.midpoint.prism.Item.getRealValue()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(129)

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

Item.getRealValue介绍

[英]Returns the "real value" (content) of this item: - value contained in PrismPropertyValue - Referencable in PrismReferenceValue - Containerable in PrismContainerValue - Objectable in PrismObjectValue Note that the real value can contain operational items. It can also contain container IDs (although they are not considered to be part of the real value). It does not contain information about item element name nor other metadata like origin, definition, etc. (Although e.g. Containerable can be converted back into PrismContainerValue that can be used to retrieve this information.)
[中]返回此项的“实际值”(内容):-包含在PrismPropertyValue中的值-PrismReferenceValue中的Referenceable-PrismContainerValue中的Containerable-PrismObjectValue中的Objectable请注意,实际值可以包含操作项。它还可以包含容器ID(尽管它们不被视为实际值的一部分)。它不包含关于项元素名称或其他元数据(如来源、定义等)的信息(尽管例如Containerable可以转换回PrismContainerValue,用于检索此信息)

代码示例

代码示例来源:origin: Evolveum/midpoint

@SuppressWarnings("unchecked")
public static <T> T getExtensionItemRealValue(@Nullable ExtensionType extension, @NotNull QName itemName) {
  if (extension == null) {
    return null;
  }
  Item item = extension.asPrismContainerValue().findItem(ItemName.fromQName(itemName));
  return item != null ? (T) item.getRealValue() : null;
}

代码示例来源:origin: Evolveum/midpoint

@Test
public void testParseTaskFile() throws Exception {
  System.out.println("===[ testParseTaskFile ]===");
  // GIVEN
  PrismContext prismContext = PrismTestUtil.getPrismContext();
  // WHEN
  PrismObject<TaskType> task = prismContext.parserFor(TASK_FILE).xml().parse();
  // THEN
  System.out.println("Parsed task:");
  System.out.println(task.debugDump());
  assertTask(task);
  Item executeScriptItem = task.findExtensionItem(new QName("executeScript"));
  ExecuteScriptType executeScript = (ExecuteScriptType) executeScriptItem.getRealValue();
  Object o = executeScript.getInput().getValue().get(0);
  System.out.println(o);
  assertTrue("Raw value is not parsed", o instanceof RawType && ((RawType) o).getAlreadyParsedValue() != null);
}

代码示例来源:origin: Evolveum/midpoint

ExecuteScriptType executeScript = (ExecuteScriptType) executeScriptItem.getRealValue();
Object o = executeScript.getInput().getValue().get(0);
System.out.println(o);

相关文章