[midPoint] Inbound mapping to custom extension "attributes"

Deepak Natarajan dnataraj at trilobytesystems.com
Mon May 26 16:04:42 CEST 2014


Hmmm, I'm unable to get my custom schema extension to support attributes
on elements (which would lead me to my second problem described below -
so I'm actually one step behind)

I'm trying to follow the sample :
midpoint/samples/schema/extension-whatever.xsd

So I have

<xsd:schema elementFormDefault="qualified"
            targetNamespace="http://axapoint.com/apos2/xsd"
            xmlns:apos="http://axapoint.com/apos2/xsd"
           
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
            xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:complexType name="GroupType">
        <xsd:simpleContent>
            <xsd:extension base="xsd:string">
                <xsd:attribute name="GroupDisplayName" type="xsd:string" />
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>

Which I then reference as :

    <xsd:complexType name="UserExtensionType">
        <xsd:annotation>
            <xsd:appinfo>
                <a:extension ref="c:UserType"/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
             <xsd:element name="groupMembership" type="apos:GroupType"
minOccurs="0" maxOccurs="unbounded" />
             ...
             ...
        </xsd:sequence>
    </xsd:complexType>

At mapping time, this fails with :

Caused by: java.lang.NullPointerException: null
        at
com.evolveum.midpoint.model.common.expression.ExpressionUtil.convertValue(ExpressionUtil.java:148)
~[model-common-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.convertScalarResult(Jsr223ScriptEvaluator.java:184)
~[model-common-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:143)
~[model-common-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.common.expression.script.ScriptExpression.evaluate(ScriptExpression.java:108)
~[model-common-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.common.expression.script.ScriptExpressionEvaluator.transformSingleValue(ScriptExpressionEvaluator.java:58)
~[model-common-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpressionEvaluator.java:420)
~[model-common-2.3-SNAPSHOT.jar:na]

If I avoid the type declaration, and try :

    <xsd:complexType name="UserExtensionType">
        <xsd:annotation>
            <xsd:appinfo>
                <a:extension ref="c:UserType"/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
             <xsd:element name="groupMembership" minOccurs="0"
maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                            <xsd:attribute name="GroupDisplayName"
type="xsd:string" />
                        </xsd:extension>
                    </xsd:simpleContent>
                </xsd:complexType>
            </xsd:element>
             ...
             ...
        </xsd:sequence>
    </xsd:complexType>

This fails with :

Caused by: com.evolveum.midpoint.util.exception.SchemaException: No
target item that would conform to the path
$user/extension/groupMembership in mapping in inbound expression for
{http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}orgdesc
in resource:036f0100-2fe8-49e1-a8fd-5548374f8703(APOS CSV Feeder
Resource Definition)
        at
com.evolveum.midpoint.model.common.mapping.Mapping.parseTarget(Mapping.java:857)
~[model-common-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.common.mapping.Mapping.getOutputPath(Mapping.java:883)
~[model-common-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.lens.projector.InboundProcessor.evaluateInboundMapping(InboundProcessor.java:373)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.lens.projector.InboundProcessor.processInboundExpressionsForAccount(InboundProcessor.java:248)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.lens.projector.InboundProcessor.processInboundFocal(InboundProcessor.java:167)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.lens.projector.InboundProcessor.processInbound(InboundProcessor.java:113)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.lens.projector.FocusProcessor.processFocusFocus(FocusProcessor.java:239)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.lens.projector.FocusProcessor.processFocus(FocusProcessor.java:176)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.lens.projector.Projector.project(Projector.java:153)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.lens.Clockwork.click(Clockwork.java:199)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.lens.Clockwork.run(Clockwork.java:156)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.sync.SynchronizationService.reactToChange(SynchronizationService.java:611)
~[model-impl-2.3-SNAPSHOT.jar:na]
        at
com.evolveum.midpoint.model.sync.SynchronizationService.notifyChange(SynchronizationService.java:253)
~[model-impl-2.3-SNAPSHOT.jar:na]


I've tried a couple of things and am about to throw the towel in. Could
anyone please help me? Thanks!

BR/Deepak

> Deepak Natarajan <mailto:dnataraj at trilobytesystems.com>
> May 26, 2014 at 2:32 PM
> Hi everyone -
>
> I am trying to achieve the following inbound mapping :
>
> from resource :
> "groups" : "a_1,b_2,c_3,d_4"
>
> to
>
> <user>
> <group id="1">a</group>
> <group id="2">b</group>
> <group id="3">c</group>
> </user>
>
> My custom schema extension seems to be accepted by Midpoint. I have
> extended the UserType to support a multi-valued child element <group>
> with an "id" attribute (I have a GroupType defined in my custom schema).
>
> I can achieve the simple case, without the "id" attribute. So I can see
> in the Admin Console that the User has several groups, which I do with
> the following mapping :
>
> <attribute>
> <ref>ri:groups</ref>
> <inbound>
> <expression>
> <script>
> <code>
> [parse input and return array of string [a, b,
> c...]
> </code>
> </script>
> </expression>
> <target>
> <path>$user/extension/my:group</path>
> </target>
> </inbound>
> </attribute>
>
> Now I'm trying to map attributes for the group element
> ($user/extension/my:group/@id)
>
> Has anyone tried this? Thanks for any input!
>
> BR/

-- 
Deepak Natarajan

Trilobyte Systems ApS
Falkoner Alle 1, 3
2000 Frederiksberg
Denmark
+45 29375068

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20140526/c865c980/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20140526/c865c980/attachment.jpg>


More information about the midPoint mailing list