[midPoint] Access to UserType extensions from model-client
Nicolas Rossi
nrossi at identicum.com
Thu Feb 9 16:35:08 CET 2017
Hy Glenn, I did something like that:
UserType user = (UserType) objectHolder.value;
ExtensionType et = user.getExtension();
for(Object extension : et.getAny())
{
Node node = (Node) extension;
System.out.println(node.getNodeName());
System.out.println(node.getTextContent());
}
I just wanted to know if this is the only and the right way to access this
values.
Thank you !
Ing Nicolás Rossi
Identicum S.A.
Jorge Newbery 3226
Tel: +54 (11) 4552-3050
www.identicum.com
On Wed, Feb 8, 2017 at 11:29 AM, BOSCHMANS Glenn <gboschmans at cibg.brussels>
wrote:
> 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
>
>
>
> *Glenn Boschmans*
> Consultant
> Business Integrated Solutions
> Kunstlaan 21, 1000 Brussel - cibg.brussels - disclaimer
> <http://cibg.brussels/disclaimer-1>
> +32 2 282 47 70 |
> Be green, leave it on the screen !
> <http://www.linkedin.com/company/cirb_cibg>
> <https://twitter.com/CIRB_CIBG>
> <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
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170209/57dc797a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tw_20cfb408-d952-4ea7-a757-a8716eaac012.png
Type: image/png
Size: 464 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170209/57dc797a/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png
Type: image/png
Size: 11221 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170209/57dc797a/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png
Type: image/png
Size: 722 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170209/57dc797a/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: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170209/57dc797a/attachment.jpg>
More information about the midPoint
mailing list