use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class AbstractIntegrationTest method getIcfUid.
protected String getIcfUid(PrismObject<ShadowType> shadow) {
PrismContainer<Containerable> attributesContainer = shadow.findContainer(ShadowType.F_ATTRIBUTES);
assertNotNull(attributesContainer, "Null attributes in " + shadow);
assertFalse(attributesContainer.isEmpty(), "Empty attributes in " + shadow);
PrismProperty<String> icfUidProp = attributesContainer.findProperty(new ItemName(SchemaConstants.NS_ICF_SCHEMA, "uid"));
assertNotNull(icfUidProp, "No ICF name attribute in " + shadow);
return icfUidProp.getRealValue();
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class AbstractHigherUnitTest method assertNoAttribute.
protected void assertNoAttribute(PrismObject<ResourceType> resource, ShadowType shadow, String attrName) {
ItemName attrQname = new ItemName(ResourceTypeUtil.getResourceNamespace(resource), attrName);
assertNoAttribute(resource, shadow, attrQname);
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class CredentialPolicyEvaluator method hasValueDelta.
private boolean hasValueDelta(ObjectDelta<F> focusDelta, ItemPath credentialsPath) {
if (focusDelta == null) {
return false;
}
for (PartiallyResolvedDelta<PrismValue, ItemDefinition> partialDelta : focusDelta.findPartial(credentialsPath)) {
LOGGER.trace("Residual delta:\n{}", partialDelta.debugDumpLazily());
ItemPath residualPath = partialDelta.getResidualPath();
if (ItemPath.isEmpty(residualPath)) {
continue;
}
LOGGER.trace("PATH: {}", residualPath);
ItemName name = residualPath.firstName();
LOGGER.trace("NAME: {}", name);
if (isValueElement(name)) {
return true;
}
}
return false;
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class ExpressionEvaluationHelper method evaluateExpression.
@SuppressWarnings("unchecked")
@NotNull
public <T> List<T> evaluateExpression(ExpressionType expressionType, VariablesMap variables, String contextDescription, Class<T> clazz, QName typeName, boolean multiValued, Function<Object, Object> additionalConvertor, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {
MutableItemDefinition<?> resultDef;
ItemName resultName = new ItemName(SchemaConstants.NS_C, "result");
if (QNameUtil.match(typeName, ObjectReferenceType.COMPLEX_TYPE)) {
resultDef = prismContext.definitionFactory().createReferenceDefinition(resultName, typeName);
} else {
resultDef = prismContext.definitionFactory().createPropertyDefinition(resultName, typeName);
}
if (multiValued) {
resultDef.setMaxOccurs(-1);
}
Expression<?, ?> expression = expressionFactory.makeExpression(expressionType, resultDef, MiscSchemaUtil.getExpressionProfile(), contextDescription, task, result);
ExpressionEvaluationContext context = new ExpressionEvaluationContext(null, variables, contextDescription, task);
context.setAdditionalConvertor(additionalConvertor);
PrismValueDeltaSetTriple<?> exprResultTriple = ModelExpressionThreadLocalHolder.evaluateAnyExpressionInContext(expression, context, task, result);
List<T> list = new ArrayList<>();
for (PrismValue pv : exprResultTriple.getZeroSet()) {
T realValue;
if (pv instanceof PrismReferenceValue) {
// pv.getRealValue sometimes returns synthesized Referencable, not ObjectReferenceType
// If we would stay with that we would need to make many changes throughout workflow module.
// So it is safer to stay with ObjectReferenceType.
ObjectReferenceType ort = new ObjectReferenceType();
ort.setupReferenceValue((PrismReferenceValue) pv);
realValue = (T) ort;
} else {
realValue = pv.getRealValue();
}
list.add(realValue);
}
return list;
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class RUtil method stringToQName.
public static ItemName stringToQName(String text) {
if (Strings.isNullOrEmpty(text)) {
return null;
}
int index = text.lastIndexOf(QNAME_DELIMITER);
String namespace = StringUtils.left(text, index);
String localPart = StringUtils.right(text, text.length() - index - 1);
if (Strings.isNullOrEmpty(localPart)) {
return null;
}
return new ItemName(namespace, localPart);
}
Aggregations