Search in sources :

Example 6 with com.evolveum.midpoint.xml.ns._public.resource.capabilities_3

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3 in project midpoint by Evolveum.

the class XmlParser method parseObject.

private boolean parseObject(XMLStreamReader stream, XmlObjectHandler handler, int serial, Map<String, String> nsMap) {
    XmlObjectMetadata metadata = new XmlObjectMetadata();
    metadata.setSerialNumber(serial);
    metadata.setStartLine(stream.getLocation().getLineNumber());
    com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType object = null;
    try {
        Document objectDoc = domConverter.buildDocument(stream);
        Element objectElement = ToolsUtils.getFirstChildElement(objectDoc);
        ToolsUtils.setNamespaceDeclarations(objectElement, nsMap);
        Unmarshaller unmarshaller = ToolsUtils.JAXB_CONTEXT.createUnmarshaller();
        Object obj = unmarshaller.unmarshal(objectElement);
        if (!(obj instanceof com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)) {
            throw new XmlParserException("Xml object '" + obj.getClass().getName() + "' doesn't represent 'ObjectType'");
        }
        object = (ObjectType) obj;
    } catch (JAXBException | XMLStreamException | XmlParserException ex) {
        metadata.setException(ex);
    }
    metadata.setEndLine(stream.getLocation().getLineNumber());
    return handler.handleObject(object, metadata);
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) Element(org.w3c.dom.Element) JAXBException(javax.xml.bind.JAXBException) Document(org.w3c.dom.Document) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) XMLStreamException(javax.xml.stream.XMLStreamException) Unmarshaller(javax.xml.bind.Unmarshaller)

Aggregations

OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)3 ObjectType (com.evolveum.midpoint.cli.ninja.util.ObjectType)2 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)2 SelectorQualifiedGetOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)2 QName (javax.xml.namespace.QName)2 Holder (javax.xml.ws.Holder)2 Document (org.w3c.dom.Document)2 Element (org.w3c.dom.Element)2 NotificationManager (com.evolveum.midpoint.notifications.api.NotificationManager)1 Message (com.evolveum.midpoint.notifications.api.transports.Message)1 TransportService (com.evolveum.midpoint.notifications.api.transports.TransportService)1 CustomEventImpl (com.evolveum.midpoint.notifications.impl.events.CustomEventImpl)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)1 S_ItemEntry (com.evolveum.midpoint.prism.delta.builder.S_ItemEntry)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 SimpleExpressionUtil (com.evolveum.midpoint.schema.util.SimpleExpressionUtil)1 LightweightIdentifier (com.evolveum.midpoint.task.api.LightweightIdentifier)1 LightweightIdentifierGenerator (com.evolveum.midpoint.task.api.LightweightIdentifierGenerator)1 Task (com.evolveum.midpoint.task.api.Task)1