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

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

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

Item.getAnyValue介绍

[英]Returns any of the values. Usually called when we are quite confident that there is only a single value; or we don't care which of the values we get. Does not create values if there are none.
[中]返回任何值。通常在我们确信只有一个值时调用;或者我们不在乎我们得到了哪些价值观。如果没有值,则不创建值。

代码示例

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

private V getSingleValue(Item<V, D> item) {
  if (item == null || item.isEmpty()) {
    return null;
  } else if (item.size() == 1) {
    return item.getAnyValue();
  } else {
    throw new IllegalStateException("Multiple values where single one was expected: " + item);
  }
}

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

@Override
public Long getAssignmentId() {
  Item<PrismContainerValue<AssignmentType>, PrismContainerDefinition<AssignmentType>> any = assignmentIdi.getAnyItem();
  return any != null && !any.getValues().isEmpty() ? any.getAnyValue().getId() : null;
}

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

/**
 * Marshals everything from the item except for the root node.
 * Separated from marshalItemAsRoot in order to be reusable.
 */
@NotNull
private XNodeImpl marshalItemContent(@NotNull Item<?, ?> item,
    ItemDefinition itemDefinition, SerializationContext context) throws SchemaException {
  if (item.size() == 1) {
    return marshalItemValue(item.getAnyValue(), itemDefinition, null, context);
  } else {
    ListXNodeImpl xlist = new ListXNodeImpl();
    for (PrismValue val : item.getValues()) {
      xlist.add(marshalItemValue(val, itemDefinition, null, context));
    }
    return xlist;
  }
}

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

public static Object getItemRealValue(PrismContainerValue containerValue, String itemName) {
  Item item = containerValue.findItem(new ItemName(itemName));
  if (item == null || item.size() == 0) {
    return null;
  }
  if (item.size() > 1) {
    throw new IllegalStateException("More than one value in item " + item);
  }
  PrismValue value = item.getAnyValue();
  if (value == null) {
    return null;
  }
  if (value instanceof PrismPropertyValue) {
    return ((PrismPropertyValue) value).getValue();
  } else if (value instanceof PrismReferenceValue) {
    ObjectReferenceType ort = new ObjectReferenceType();
    ort.setupReferenceValue((PrismReferenceValue) value);
    return ort;
  } else if (value instanceof PrismContainerValue) {
    return ((PrismContainerValue) value).asContainerable();     // questionable
  } else {
    throw new IllegalStateException("Unknown PrismValue: " + value);
  }
}

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

Item<IV,ID> subItem = prismContext.parserFor(getRootXNode(itemName)).name(itemName).definition(itemDefinition).parseItem();
if (!subItem.isEmpty()) {
  value = subItem.getAnyValue();
} else {
  value = null;

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

@Test
public void testInboundMapping() throws Exception{
  final String TEST_NAME = "testInboundMapping";
  TestUtil.displayTestTitle(TEST_NAME);
  PrismContext prismContext = evaluator.getPrismContext();
  PrismObject<ShadowType> account = PrismTestUtil.parseObject(new File(MappingTestEvaluator.TEST_DIR + "/account-inbound-mapping.xml"));
  Item oldItem = account.findItem(ItemPath.create(ShadowType.F_ATTRIBUTES, SchemaTestConstants.ICFS_NAME));
  ItemDelta delta = prismContext.deltaFactory().property().createModificationAddProperty(SchemaTestConstants.ICFS_NAME_PATH_PARTS, (PrismPropertyDefinition) oldItem.getDefinition(), ((PrismPropertyValue) oldItem.getAnyValue()).getValue());
  PrismObject<UserType> user = evaluator.getUserDefinition().instantiate();
  MappingImpl<PrismPropertyValue<PolyString>,PrismPropertyDefinition<PolyString>> mapping = evaluator.createInboudMapping("mapping-inbound.xml", TEST_NAME, delta, user.asObjectable(), account.asObjectable(), null, null);
  OperationResult opResult = new OperationResult(TEST_NAME);
  mapping.evaluate(null, opResult);
  PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple();
  outputTriple.checkConsistence();
  assertTripleZero(outputTriple, PrismTestUtil.createPolyString("pavolr"));
  PrismAsserts.assertTripleNoPlus(outputTriple);
  assertTripleNoMinus(outputTriple);
}

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

PrismPropertyValue<T> propertyValue = (PrismPropertyValue<T>) item.getAnyValue();
propertyValue.clearParent();
if (isGt || isGtEq) {

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

assertFalse(intAttributeReparsed.getAnyValue().isRaw());
Item<?, ?> stringAttributeReparsed = shadowReparsed.findItem(ItemPath.create(ShadowType.F_ATTRIBUTES, STRING_ATTRIBUTE_NAME));
assertNotNull(stringAttributeReparsed);
assertFalse(stringAttributeReparsed.getAnyValue().isRaw());
Item<?, ?> longExtensionReparsed = shadowReparsed.findItem(ItemPath.create(ShadowType.F_EXTENSION, SchemaTestConstants.EXTENSION_LONG_TYPE_ELEMENT));
assertNotNull(longExtensionReparsed);
assertFalse(longExtensionReparsed.getAnyValue().isRaw());
Item<?, ?> doubleExtensionReparsed = shadowReparsed.findItem(ItemPath.create(ShadowType.F_EXTENSION, SchemaTestConstants.EXTENSION_DOUBLE_TYPE_ELEMENT));
assertNotNull(doubleExtensionReparsed);
assertFalse(doubleExtensionReparsed.getAnyValue().isRaw());

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

Item<PrismValue, ItemDefinition> attr1Reparsed = shadowReparsed.findItem(ItemPath.create(ShadowType.F_ATTRIBUTES, ATTR1_QNAME));
assertNotNull(attr1Reparsed);
assertFalse("Reparsed attribute is raw", attr1Reparsed.getAnyValue().isRaw());

相关文章