public static boolean getBooleanConditionOutput(PrismPropertyValue<Boolean> conditionOutput) { if (conditionOutput == null) { return false; } Boolean value = conditionOutput.getValue(); if (value == null) { return false; } return value; }
private void processPropertyValueCollection(Collection<PrismPropertyValue<ProtectedStringType>> collection) throws PolicyViolationException, SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException { if (collection == null) { return; } for (PrismPropertyValue<ProtectedStringType> val: collection) { validateProtectedStringValue(val.getValue()); } }
private <T> boolean isInValues(ValueMatcher<T> valueMatcher, T shouldBeValue, Collection<PrismPropertyValue<T>> arePValues) { if (arePValues == null || arePValues.isEmpty()) { return false; } for (PrismPropertyValue<T> isPValue : arePValues) { if (matchValue(isPValue.getValue(), shouldBeValue, valueMatcher)) { return true; } } return false; }
public boolean hasStrongConstruction() { for (PrismPropertyValue<T> construction: constructions) { if (!construction.getValue().isWeak()) { return true; } } return false; }
private <T> void recordDeleteDelta(PrismPropertyValue<T> isPValue, RefinedAttributeDefinition<T> attributeDefinition, ValueMatcher<T> valueMatcher, LensProjectionContext projCtx, String reason) throws SchemaException { recordDelta(valueMatcher, projCtx, SchemaConstants.PATH_ATTRIBUTES, attributeDefinition, ModificationType.DELETE, isPValue.getValue(), null, reason); }
public static <T> void recomputePrismPropertyValue(PrismPropertyValue<T> pValue, PrismContext prismContext) { if (pValue == null) { return; } recomputeRealValue(pValue.getValue(), prismContext); }
private <V extends PrismValue, D extends ItemDefinition, F extends FocusType> void sqeezeAttributesFromAccountConstructionSet( Map<QName, DeltaSetTriple<ItemValueWithOrigin<V,D>>> squeezedMap, Collection<PrismPropertyValue<Construction<F>>> constructionSet, MappingExtractor<V,D,F> extractor, AssignmentPolicyEnforcementType enforcement) { if (constructionSet == null) { return; } for (PrismPropertyValue<Construction<F>> construction: constructionSet) { sqeezeAttributesFromConstruction(squeezedMap, construction.getValue(), extractor, enforcement); } }
public static <T> void assertPropertyValues(String message, Collection<T> expected, Collection<PrismPropertyValue<T>> results) { assertEquals(message+" - unexpected number of results", expected.size(), results.size()); Set<Object> values = new HashSet<>(); for (PrismPropertyValue<T> result : results) { values.add(result.getValue()); } assertEquals(message, expected, values); }
/** * Type override, also for compatibility. */ public <X> X[] getRealValuesArray(Class<X> type) { X[] valuesArrary = (X[]) Array.newInstance(type, getValues().size()); for (int j = 0; j < getValues().size(); ++j) { Object avalue = getValues().get(j).getValue(); Array.set(valuesArrary, j, avalue); } return valuesArrary; }
protected Object getValue(PropertyValueFilter filter) throws QueryException { PrismValue val = filter.getSingleValue(); if (val == null) { return null; } else if (val instanceof PrismPropertyValue) { PrismPropertyValue propertyValue = (PrismPropertyValue) val; return propertyValue.getValue(); } else { throw new QueryException("Non-property value in filter: " + filter + ": " + val.getClass()); } }
public static <T> void assertEqualsFilterValue(EqualFilter filter, T value) { List<? extends PrismValue> values = filter.getValues(); assertEquals("Wrong number of filter values", 1, values.size()); assertTrue("Wrong filter value class: " + values.get(0).getClass(), values.get(0) instanceof PrismPropertyValue); PrismPropertyValue val = (PrismPropertyValue) values.get(0); assertEquals("Wrong filter value", value, val.getValue()); }
private <T> Collection<T> getMultiValueFromDeltaSetTriple(PrismValueDeltaSetTriple<? extends PrismPropertyValue<?>> triple, Collection<? extends PrismPropertyValue<?>> set) { Collection<T> vals = new ArrayList<>(set.size()); for (PrismPropertyValue<?> pval: set) { vals.add((T)pval.getValue()); } return vals; }
public static <T> T getSingleValue(String setName, Collection<PrismPropertyValue<T>> set) { assertEquals("Expected single value in "+setName+" but found "+set.size()+" values: "+set, 1, set.size()); PrismPropertyValue<T> propertyValue = set.iterator().next(); return propertyValue.getValue(); }
protected void validateCredentialContainerValues(PrismContainerValue<R> cVal) throws PolicyViolationException, SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException { PrismProperty<ProtectedStringType> credentialValueProperty = cVal.findProperty(getCredentialRelativeValuePath()); if (credentialValueProperty != null) { for (PrismPropertyValue<ProtectedStringType> credentialValuePropertyValue : credentialValueProperty.getValues()) { validateProtectedStringValue(credentialValuePropertyValue.getValue()); } } }
private RoleSelectionSpecEntry getRoleSelectionSpecEq(EqualFilter<String> eqFilter) throws SchemaException { if (QNameUtil.match(RoleType.F_ROLE_TYPE, eqFilter.getElementName()) || QNameUtil.match(RoleType.F_SUBTYPE, eqFilter.getElementName())) { List<PrismPropertyValue<String>> ppvs = eqFilter.getValues(); if (ppvs.size() > 1) { throw new SchemaException("More than one value in roleType search filter"); } String roleType = ppvs.get(0).getValue(); RoleSelectionSpecEntry roleTypeDval = new RoleSelectionSpecEntry(roleType, roleType, null); return roleTypeDval; } return null; }
public void assertProtectedString(String desc, Collection<PrismPropertyValue<ProtectedStringType>> set, String expected) throws EncryptionException { assertEquals("Unexpected size of "+desc+": "+set, 1, set.size()); PrismPropertyValue<ProtectedStringType> pval = set.iterator().next(); ProtectedStringType ps = pval.getValue(); String zeroString = protector.decryptString(ps); assertEquals("Unexpected value in "+desc+": "+set, expected, zeroString); }
private <T> void normalizeAttribute(ResourceAttribute<T> attribute, RefinedAttributeDefinition rAttrDef) throws SchemaException { MatchingRule<T> matchingRule = matchingRuleRegistry.getMatchingRule(rAttrDef.getMatchingRuleQName(), rAttrDef.getTypeName()); if (matchingRule != null) { for (PrismPropertyValue<T> pval: attribute.getValues()) { T normalizedRealValue = matchingRule.normalize(pval.getValue()); pval.setValue(normalizedRealValue); } } }
private void assertUnion01Delta(ObjectDelta<UserType> userDeltaUnion) { PropertyDelta<PolyString> fullNameDeltaUnion = getCheckedPropertyDeltaFromUnion(userDeltaUnion); Collection<PrismPropertyValue<PolyString>> valuesToAdd = fullNameDeltaUnion.getValuesToAdd(); assertNotNull("No valuesToAdd in fullName delta after union", valuesToAdd); assertEquals("Unexpected size of valuesToAdd in fullName delta after union", 1, valuesToAdd.size()); PrismPropertyValue<PolyString> valueToAdd = valuesToAdd.iterator().next(); assertEquals("Unexcted value in valuesToAdd in fullName delta after union", PrismTestUtil.createPolyString("baz"), valueToAdd.getValue()); }
private String getEntryUuid(Collection<ResourceAttribute<?>> identifiers) { for (ResourceAttribute<?> identifier : identifiers) { if (identifier.getElementName().equals(new QName(ResourceTypeUtil.getResourceNamespace(resourceType), OpenDJController.RESOURCE_OPENDJ_PRIMARY_IDENTIFIER_LOCAL_NAME))) { return identifier.getValue(String.class).getValue(); } } return null; }
@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()); }