private boolean isInAssociationValues(ValueMatcher valueMatcher, ShadowAssociationType shouldBeValue, Collection<PrismContainerValue<ShadowAssociationType>> arePValues) { if (arePValues == null || arePValues.isEmpty()) { return false; } for (PrismContainerValue<ShadowAssociationType> isPValue : arePValues) { if (matchValue(isPValue.getValue(), shouldBeValue, valueMatcher)) { return true; } } return false; }
private boolean isInCvwoAssociationValues(ValueMatcher valueMatcher, ShadowAssociationType value, Collection<ItemValueWithOrigin<PrismContainerValue<ShadowAssociationType>,PrismContainerDefinition<ShadowAssociationType>>> shouldBeCvwos) { if (shouldBeCvwos == null || shouldBeCvwos.isEmpty()) { return false; } for (ItemValueWithOrigin<? extends PrismContainerValue<ShadowAssociationType>,PrismContainerDefinition<ShadowAssociationType>> shouldBeCvwo : shouldBeCvwos) { if (!shouldBeCvwo.isValid()) { continue; } PrismContainerValue<ShadowAssociationType> shouldBePCValue = shouldBeCvwo.getItemValue(); ShadowAssociationType shouldBeValue = shouldBePCValue.getValue(); if (matchValue(value, shouldBeValue, valueMatcher)) { return true; } } return false; }
private void hashPasswordPcvs(Collection<PrismContainerValue<PasswordType>> values, CredentialsStorageMethodType storageMethod) throws SchemaException, EncryptionException { if (values == null) { return; } for (PrismContainerValue<PasswordType> pval: values) { PasswordType password = pval.getValue(); if (password != null && password.getValue() != null) { if (!password.getValue().isHashed()) { protector.hash(password.getValue()); } } } }
private void hashCredentialsPcvs(Collection<PrismContainerValue<CredentialsType>> values, CredentialsStorageMethodType storageMethod) throws SchemaException, EncryptionException { if (values == null) { return; } for (PrismContainerValue<CredentialsType> pval: values) { CredentialsType credentials = pval.getValue(); if (credentials != null && credentials.getPassword() != null) { ProtectedStringType passwordValue = credentials.getPassword().getValue(); if (passwordValue != null && !passwordValue.isHashed()) { protector.hash(passwordValue); } } } }
@Override protected void assertPrismContainerValueLocal(PrismContainerValue<MappingType> value) throws SchemaException { MappingType mappingType = value.getValue(); ExpressionType expressionType = mappingType.getExpression(); List<JAXBElement<?>> expressionEvaluatorElements = expressionType.getExpressionEvaluator(); assertEquals("Wrong number of expression evaluator elemenets", 1, expressionEvaluatorElements.size()); JAXBElement<?> expressionEvaluatorElement = expressionEvaluatorElements.get(0); Object evaluatorElementObject = expressionEvaluatorElement.getValue(); if (!(evaluatorElementObject instanceof ConstExpressionEvaluatorType)) { AssertJUnit.fail("Const expression is of type " + evaluatorElementObject.getClass().getName()); } ConstExpressionEvaluatorType constExpressionEvaluatorType = (ConstExpressionEvaluatorType)evaluatorElementObject; System.out.println("ConstExpressionEvaluatorType: "+constExpressionEvaluatorType); assertEquals("Wrong value in const evaluator", "foo", constExpressionEvaluatorType.getValue()); }
if (isInCvwoAssociationValues(valueMatcher, isCValue.getValue(), shouldBeCValues)) { LOGGER.trace("Reconciliation: KEEPING value {} of association {}: it is in 'shouldBeCValues'", isCValue, assocNameLocal); continue; isCValue.getValue(), null, "identifier " + targetNamingIdentifier + " matches with intolerant pattern"); continue; isCValue.getValue(), null, "it is not given by any mapping and the association is not tolerant"); } else { LOGGER.trace("Reconciliation: KEEPING value {} of association {}: the association is tolerant and the value"
ItemDefinition assignmentDefinition = getPrismContext().getSchemaRegistry().findContainerDefinitionByCompileTimeClass(AssignmentType.class); assertNotNull(assignmentDefinition); AssignmentType assignmentType = ((PrismContainerValue<AssignmentType>) rawType.getParsedValue(assignmentDefinition, null)).getValue();
for (Object o : associationsContainer.getValues()) { PrismContainerValue<ShadowAssociationType> existingAssocValue = (PrismContainerValue<ShadowAssociationType>) o; if (existingAssocValue.getValue().getName().equals(assocName)) { areCValues.add(existingAssocValue); ShadowAssociationType shouldBeRealValue = shouldBeCvwo.getItemValue().getValue(); if (shouldBeCvwo.isValid() && !isInAssociationValues(associationValueMatcher, shouldBeRealValue, areCValues)) { recordAssociationDelta(associationValueMatcher, projCtx, associationDefinition, ModificationType.ADD, shouldBeRealValue,
dataRead = ((ConstructionType)user.findContainer(attribute2).getValue().getValue()).getDescription(); } else { dataRead = user.findProperty(attribute2).getRealValue(String.class);
PrismContainerValue<ResourceAttributeDefinitionType> oldAttrContainer = null; for (PrismContainerValue<ResourceAttributeDefinitionType> cval: attributeCont.getValues()) { ResourceAttributeDefinitionType attrType = cval.getValue(); if (ItemPathTypeUtil.asSingleNameOrFail(attrType.getRef()).getLocalPart().equals(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME)) { oldAttrContainer = cval; JAXBElement<?> cutlassExpressionEvalJaxbElement = newAttrContainer.getValue().getOutbound().getExpression().getExpressionEvaluator().get(0); RawType cutlassValueEvaluator = (RawType) cutlassExpressionEvalJaxbElement.getValue(); XNode daggerXNode = prismContext.xnodeFactory().primitive("dagger"); RawType daggerValueEvaluator = new RawType(daggerXNode, prismContext); JAXBElement<?> daggerExpressionEvalJaxbElement = new JAXBElement<>(SchemaConstants.C_VALUE, Object.class, daggerValueEvaluator); newAttrContainer.getValue().getOutbound().getExpression().getExpressionEvaluator().add(daggerExpressionEvalJaxbElement); newAttrContainer.getValue().getOutbound().setStrength(MappingStrengthType.STRONG); attrItemPath, oldAttrContainer.getValue().clone()); ResourceAttributeDefinitionType newAttrCVal = newAttrContainer.getValue(); newAttrCVal.asPrismContainerValue().setId(null); rolePirateDelta.addModificationAddContainer(attrItemPath, newAttrCVal);