use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class Construction method evaluateAttributes.
private void evaluateAttributes(Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException {
attributeMappings = new ArrayList<>();
// assignments.size(), assignments});
for (ResourceAttributeDefinitionType attribudeDefinitionType : getConstructionType().getAttribute()) {
QName attrName = ItemPathUtil.getOnlySegmentQName(attribudeDefinitionType.getRef());
if (attrName == null) {
throw new SchemaException("No attribute name (ref) in attribute definition in account construction in " + getSource());
}
if (!attribudeDefinitionType.getInbound().isEmpty()) {
throw new SchemaException("Cannot process inbound section in definition of attribute " + attrName + " in account construction in " + getSource());
}
MappingType outboundMappingType = attribudeDefinitionType.getOutbound();
if (outboundMappingType == null) {
throw new SchemaException("No outbound section in definition of attribute " + attrName + " in account construction in " + getSource());
}
Mapping<? extends PrismPropertyValue<?>, ? extends PrismPropertyDefinition<?>> attributeMapping = evaluateAttribute(attribudeDefinitionType, task, result);
if (attributeMapping != null) {
attributeMappings.add(attributeMapping);
}
}
}
use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class Construction method evaluateAssociations.
private void evaluateAssociations(Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException {
associationMappings = new ArrayList<>();
for (ResourceObjectAssociationType associationDefinitionType : getConstructionType().getAssociation()) {
QName assocName = ItemPathUtil.getOnlySegmentQName(associationDefinitionType.getRef());
if (assocName == null) {
throw new SchemaException("No association name (ref) in association definition in construction in " + getSource());
}
MappingType outboundMappingType = associationDefinitionType.getOutbound();
if (outboundMappingType == null) {
throw new SchemaException("No outbound section in definition of association " + assocName + " in construction in " + getSource());
}
Mapping<PrismContainerValue<ShadowAssociationType>, PrismContainerDefinition<ShadowAssociationType>> assocMapping = evaluateAssociation(associationDefinitionType, task, result);
if (assocMapping != null) {
associationMappings.add(assocMapping);
}
}
}
use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class PageTasks method synchronizeTasksPerformed.
private void synchronizeTasksPerformed(AjaxRequestTarget target) {
OperationResult result = new OperationResult(OPERATION_SYNCHRONIZE_TASKS);
try {
getTaskService().synchronizeTasks(result);
result.computeStatus();
if (result.isSuccess()) {
// brutal hack - the subresult's message contains statistics
result.recordStatus(OperationResultStatus.SUCCESS, result.getLastSubresult().getMessage());
}
} catch (RuntimeException | SchemaException | SecurityViolationException e) {
result.recordFatalError("Couldn't synchronize tasks", e);
}
showResult(result);
//refresh feedback and table
refreshTables(target);
}
use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class SearchFilterType method parseFromXNode.
public void parseFromXNode(XNode xnode, PrismContext prismContext) throws SchemaException {
if (xnode == null || xnode.isEmpty()) {
this.filterClauseXNode = null;
this.description = null;
} else {
if (!(xnode instanceof MapXNode)) {
throw new SchemaException("Cannot parse filter from " + xnode);
}
MapXNode xmap = (MapXNode) xnode;
XNode xdesc = xmap.get(SearchFilterType.F_DESCRIPTION);
if (xdesc != null) {
if (xdesc instanceof PrimitiveXNode<?>) {
String desc = ((PrimitiveXNode<String>) xdesc).getParsedValue(DOMUtil.XSD_STRING, String.class);
setDescription(desc);
} else {
throw new SchemaException("Description must have a primitive value");
}
}
MapXNode xfilter = new MapXNode();
for (Entry<QName, XNode> entry : xmap.entrySet()) {
if (!QNameUtil.match(entry.getKey(), SearchFilterType.F_DESCRIPTION) && !QNameUtil.match(entry.getKey(), new QName("condition"))) {
xfilter.put(entry.getKey(), entry.getValue());
}
}
if (xfilter.size() > 1) {
throw new SchemaException("Filter clause has more than one item: " + xfilter);
}
this.filterClauseXNode = xfilter;
QueryConvertor.parseFilterPreliminarily(xfilter, prismContext);
}
}
use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.
the class XmlTypeConverter method polyStringToJava.
/**
* Parse PolyString from DOM element.
*/
private static PolyString polyStringToJava(Element polyStringElement) throws SchemaException {
Element origElement = DOMUtil.getChildElement(polyStringElement, PrismConstants.POLYSTRING_ELEMENT_ORIG_QNAME);
if (origElement == null) {
// element as the value of orig
if (DOMUtil.hasChildElements(polyStringElement)) {
throw new SchemaException("Missing element " + PrismConstants.POLYSTRING_ELEMENT_ORIG_QNAME + " in polystring element " + DOMUtil.getQName(polyStringElement));
}
String orig = polyStringElement.getTextContent();
return new PolyString(orig);
}
String orig = origElement.getTextContent();
String norm = null;
Element normElement = DOMUtil.getChildElement(polyStringElement, PrismConstants.POLYSTRING_ELEMENT_NORM_QNAME);
if (normElement != null) {
norm = normElement.getTextContent();
}
return new PolyString(orig, norm);
}
Aggregations