public static <T> Collection<PrismPropertyValue<T>> createCollection(PrismContext prismContext, Collection<T> realValueCollection) { Collection<PrismPropertyValue<T>> pvalCol = new ArrayList<>(realValueCollection.size()); for (T realValue: realValueCollection) { pvalCol.add(prismContext.itemFactory().createPropertyValue(realValue)); } return pvalCol; }
public static <T> Collection<PrismPropertyValue<T>> createCollection(PrismContext prismContext, T[] realValueArray) { Collection<PrismPropertyValue<T>> pvalCol = new ArrayList<>(realValueArray.length); for (T realValue: realValueArray) { pvalCol.add(prismContext.itemFactory().createPropertyValue(realValue)); } return pvalCol; }
public static <T> Collection<PrismPropertyValue<T>> wrap(PrismContext prismContext, @NotNull Collection<T> realValues) { return realValues.stream() .map(val -> prismContext.itemFactory().createPropertyValue(val)) .collect(Collectors.toList()); }
@SafeVarargs public static <T> PrismPropertyValue<T>[] wrap(PrismContext prismContext, T... realValues) { //noinspection unchecked return Arrays.stream(realValues) .map(val -> prismContext.itemFactory().createPropertyValue(val)) .toArray(PrismPropertyValue[]::new); }
public static <X> Collection<PrismPropertyValue<X>> toPrismPropertyValues(PrismContext prismContext, X... realValues) { Collection<PrismPropertyValue<X>> pvalues = new ArrayList<>(realValues.length); for (X val: realValues) { PrismUtil.recomputeRealValue(val, prismContext); PrismPropertyValue<X> pval = prismContext.itemFactory().createPropertyValue(val); pvalues.add(pval); } return pvalues; }
private <T> RawType[] rawize(QName attrName, PrismContext prismContext, T[] expectedValues) { RawType[] raws = new RawType[expectedValues.length]; for(int i = 0; i < expectedValues.length; i++) { raws[i] = new RawType(prismContext.itemFactory().createPropertyValue(expectedValues[i]), attrName, prismContext); } return raws; }
private <T> RawType[] rawize(QName attrName, PrismContext prismContext, T[] expectedValues) { RawType[] raws = new RawType[expectedValues.length]; for(int i = 0; i < expectedValues.length; i++) { raws[i] = new RawType(prismContext.itemFactory().createPropertyValue(expectedValues[i]), attrName, prismContext); } return raws; }
private boolean contains(PrismProperty<String> property, String keyword) { return property.contains(prismContext.itemFactory().createPropertyValue(keyword), EquivalenceStrategy.REAL_VALUE); }
@Override protected <T> PrismPropertyValue<T> createPropertyValue(T realValue) { return reportService.getPrismContext().itemFactory().createPropertyValue(realValue); }
public static <T,X> PrismPropertyValue<X> convertPropertyValue(PrismPropertyValue<T> srcVal, PrismPropertyDefinition<T> srcDef, PrismPropertyDefinition<X> targetDef, PrismContext prismContext) { if (targetDef.getTypeName().equals(srcDef.getTypeName())) { return (PrismPropertyValue<X>) srcVal; } else { Class<X> expectedJavaType = XsdTypeMapper.toJavaType(targetDef.getTypeName()); X convertedRealValue = JavaTypeConverter.convert(expectedJavaType, srcVal.getValue()); return prismContext.itemFactory().createPropertyValue(convertedRealValue); } }
private void resetFailedLogins(LensFocusContext<UserType> focusContext, AbstractCredentialType credentialTypeNew, ItemPath path) throws SchemaException{ if (credentialTypeNew != null) { Integer failedLogins = credentialTypeNew.getFailedLogins(); if (failedLogins != null && failedLogins != 0) { PrismPropertyDefinition<Integer> failedLoginsDef = getFailedLoginsDefinition(); PropertyDelta<Integer> failedLoginsDelta = failedLoginsDef.createEmptyDelta(path); failedLoginsDelta.setValueToReplace(prismContext.itemFactory().createPropertyValue(0, OriginType.USER_POLICY, null)); focusContext.swallowToProjectionWaveSecondaryDelta(failedLoginsDelta); } } }
public PipelineData evaluateConstantStringExpression(RawType constant, ExecutionContext context, OperationResult result) throws ScriptExecutionException { try { String value = constant.getParsedRealValue(String.class); return PipelineData.createItem(prismContext.itemFactory().createPropertyValue(value), context.getInitialVariables()); } catch (SchemaException e) { throw new ScriptExecutionException(e.getMessage(), e); } }
@Test public void testNode() { String input = "test content"; PrismPropertyValue<String> value = getPrismContext().itemFactory().createPropertyValue(input); value = filter.apply(value); AssertJUnit.assertEquals(input, value.getValue()); } }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEmptyParameters() { PrismPropertyValue<String> value = getPrismContext().itemFactory().createPropertyValue(input); value = filter.apply(value); AssertJUnit.assertEquals(expected, value.getValue()); }
@Test public void testEmptyValue() { PrismPropertyValue<String> value = getPrismContext().itemFactory().createPropertyValue(""); value = filter.apply(value); AssertJUnit.assertEquals("", value.getValue()); }
@Test public void testEmptyValue() { PrismPropertyValue<String> value = getPrismContext().itemFactory().createPropertyValue(""); value = filter.apply(value); AssertJUnit.assertEquals("", value.getValue()); }
@Test public void testValueTextNode() { PrismPropertyValue<String> value = getPrismContext().itemFactory().createPropertyValue(input); value = filter.apply(value); AssertJUnit.assertEquals(expected, value.getValue()); } }
@Test(expectedExceptions = IllegalArgumentException.class) public void testValueInElementBadParameters() { List<Object> parameters = createBadParameters(); filter.setParameters(parameters); PrismPropertyValue<String> value = getPrismContext().itemFactory().createPropertyValue(input); value = filter.apply(value); AssertJUnit.assertEquals(expected, value.getValue()); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testValueInElementBadParameters2() { List<Object> parameters = createBadParameters2(); filter.setParameters(parameters); PrismPropertyValue<String> value = getPrismContext().itemFactory().createPropertyValue(input); value = filter.apply(value); AssertJUnit.assertEquals(expected, value.getValue()); }
@Test public void testValue() { List<Object> parameters = createGoodParameters(); filter.setParameters(parameters); PrismPropertyValue<String> value = getPrismContext().itemFactory().createPropertyValue(input); value = filter.apply(value); AssertJUnit.assertEquals(expected, value.getValue()); }