[midPoint] Access to UserType extensions from model-client

BOSCHMANS Glenn gboschmans at cibg.brussels
Wed Feb 8 15:29:00 CET 2017


Hi Nicolas,

Perhaps you can try the following.

for (Object extension : et.getAny()) {
         System.out.println(((Element) extension).getFirstChild().getNodeValue());
}

Element is the dom class org.w3c.dom.Element;

Best regards,
Glenn Boschmans

[cid:cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png]

Glenn Boschmans
Consultant
Business Integrated Solutions
Kunstlaan 21, 1000 Brussel - cibg.brussels<http://cibg.brussels> - disclaimer<http://cibg.brussels/disclaimer-1>
+32 2 282 47 70 |
Be green, leave it on the screen !                                                       [cid:ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png] <http://www.linkedin.com/company/cirb_cibg>   [cid:tw_20cfb408-d952-4ea7-a757-a8716eaac012.png] <https://twitter.com/CIRB_CIBG>   [cid:logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg] <http://www.leefmilieu.brussels/themas/duurzame-stad/label-ecodynamische-onderneming>

From: midPoint [mailto:midpoint-bounces at lists.evolveum.com] On Behalf Of Nicolas Rossi
Sent: woensdag 8 februari 2017 0:57
To: midPoint General Discussion
Subject: [midPoint] Access to UserType extensions from model-client

Hi guys, we have a customer with a User schema extension and we are trying to access this data using the API of UserType from external Java application. We get the user with the model-client example but we couldn't find the way to acces the extension properties. Here is an example:

ModelPortType modelPort = createModelPort();
Holder<ObjectType> objectHolder = new Holder<ObjectType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();

modelPort.getObject(ModelClientUtil.getTypeQName(UserType.class), "2f749a40-d535-470b-ba7d-639adc364a52", options, objectHolder, resultHolder);

UserType user = (UserType) objectHolder.value;
ExtensionType et = user.getExtension();

for(int i=0; i < et.getAny().size(); i++)
{
     Object o = et.getAny().get(i);
     System.out.println("Extension --> " + o.toString());
}

Looking at the email sent from Ana Pereyra to the mailing list last week asking about writing Extension Attributes I guees we should code something like that:

QName relationQName = new QName("http://midpoint.identicum.com/xml/ns/metaP<http://midpoint.identicum.com/xml/ns/metaAssignment>erson", "extensionAttribute");
ExtensionType ext = new ExtensionType();
ext.asPrismContainerValue().getPropertyRealValue(relationQName);
But I don't have access to "asPrismContainerValue" method on the extension type. I have been looking on github examples but there is no reference to access this values. Has anyone tried this before ?

Thranks in advance,



Ing Nicolás Rossi
Identicum S.A.
Jorge Newbery 3226
Tel: +54 (11) 4552-3050
www.identicum.com<http://www.identicum.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170208/0e1920e6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png
Type: image/png
Size: 11221 bytes
Desc: cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170208/0e1920e6/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png
Type: image/png
Size: 722 bytes
Desc: ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170208/0e1920e6/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tw_20cfb408-d952-4ea7-a757-a8716eaac012.png
Type: image/png
Size: 464 bytes
Desc: tw_20cfb408-d952-4ea7-a757-a8716eaac012.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170208/0e1920e6/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg
Type: image/jpeg
Size: 1260 bytes
Desc: logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170208/0e1920e6/attachment.jpg>


More information about the midPoint mailing list