[midPoint] midPoint Digest, Vol 111, Issue 7

Richard Richter virgo at evolveum.com
Wed Jul 14 08:01:30 CEST 2021


Hi Jeremiah

This one is easy - searchObjects returns the list of objects, that is that "ArrayList" that Groovy is complaining about: https://github.com/Evolveum/midpoint/blob/358afeacbc984928d1c3ff508bc5d54b4a76305e/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java#L531

Even if your search is specific, it's always a collection, and you need to get the element from it.
Either "thisUser.get(0)" (in your example, of course the name of the variable is misleading) or even "thisUser[0]" should suffice.

I'm not sure how you got "thisUser.givenName" working in your first mail, but I suspect you somehow extracted the user first. There are also "searchObjectBy..." methods, these really return a single object.

Cheers

Richard Richter
midPoint developer

----- Original Message -----
From: "midPoint General Discussion" <midpoint at lists.evolveum.com>
To: "midPoint General Discussion" <midpoint at lists.evolveum.com>
Cc: "Jeremiah Haywood" <jhaywo1 at ilstu.edu>
Sent: Tuesday, July 13, 2021 4:46:02 PM
Subject: Re: [midPoint] midPoint Digest, Vol 111, Issue 7

Hey Ivan, 

Thanks for the quick response! Attempted using the basic method as outlined.
Fed it the user object, schema and extension attribute name:

basic.getExtensionPropertyValue(thisUser,"http://illinoisstate.edu/xml/ns/is
uSchema","pwdExpireDate") 

Ended up receiving the following error. Appears possibly the object type
isn't what's expected. The variable thisUser is populated directly by the
search operation.

thisUser = midpoint.searchObjects(UserType.class, userQuery, null)


Error:

com.evolveum.midpoint.util.exception.ExpressionEvaluationException: No
signature of method:
com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunct
ions.getExtensionPropertyValue() is applicable for argument types:
(ArrayList, String, String) values:
[[user:ceb7a7c1-c783-4713-bb13-f4ca167c2738(test_user)],
http://illinoisstate.edu/xml/ns/isuSchema, ...]

Possible solutions:
getExtensionPropertyValue(com.evolveum.midpoint.prism.Containerable,
java.lang.String, java.lang.String),
getExtensionPropertyValue(com.evolveum.midpoint.prism.Containerable,
java.lang.String),
getExtensionPropertyValues(com.evolveum.midpoint.prism.Containerable,
java.lang.String, java.lang.String),
getExtensionPropertyValue(com.evolveum.midpoint.prism.Containerable,
groovy.xml.QName),
getExtensionPropertyValue(com.evolveum.midpoint.prism.Containerable,
javax.xml.namespace.QName),
getExtensionPropertyValues(com.evolveum.midpoint.prism.Containerable,
groovy.xml.QName) in (new) body expression


Thank you,

Jeremiah Haywood
Identity and Access Management Administrator 
Office of Technology Solutions | Illinois State University
Phone Number (309) 438-3829



-----Original Message-----
From: midPoint <midpoint-bounces at lists.evolveum.com> On Behalf Of
midpoint-request at lists.evolveum.com
Sent: Tuesday, July 13, 2021 9:13 AM
To: midpoint at lists.evolveum.com
Subject: midPoint Digest, Vol 111, Issue 7

[This message came from an external source. If suspicious, report to
abuse at ilstu.edu<mailto:abuse at ilstu.edu>]

Send midPoint mailing list submissions to
        midpoint at lists.evolveum.com

To subscribe or unsubscribe via the World Wide Web, visit
 
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.evol
veum.com%2Fmailman%2Flistinfo%2Fmidpoint&data=04%7C01%7C%7C5b6a3e4771c74
474708708d946085c6f%7C085f983a0b694270b71d10695076bafe%7C1%7C0%7C63761782475
8251465%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6
Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=wZHaybnjBMmRr0MI3Ujh1v%2B5ieOUpSzPSc
uHhliybEQ%3D&reserved=0
or, via email, send a message with subject or body 'help' to
        midpoint-request at lists.evolveum.com

You can reach the person managing the list at
        midpoint-owner at lists.evolveum.com

When replying, please edit your Subject line so it is more specific than
"Re: Contents of midPoint digest..."


Today's Topics:

   1. Midpoint Query API and Extension Attributes (Haywood, Jeremiah)
   2. Re: Midpoint Query API and Extension Attributes (Ivan Noris)


----------------------------------------------------------------------

Message: 1
Date: Tue, 13 Jul 2021 13:57:15 +0000
From: "Haywood, Jeremiah" <jhaywo1 at ilstu.edu>
To: "midpoint at lists.evolveum.com" <midpoint at lists.evolveum.com>
Subject: [midPoint] Midpoint Query API and Extension Attributes
Message-ID:
 
<CH0PR03MB605025E7DD0313CCC3F4AD51E4149 at CH0PR03MB6050.namprd03.prod.outlook.
com>

Content-Type: text/plain; charset="utf-8"

Has anyone worked with the Midpoint query api and returning extension
attribute values for users? It seems the default schema attributes can be
accessed by name fairly easily. Have been looking at the UserType
(https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdownload.
evolveum.com%2Fmidpoint%2F4.2%2Fmidpoint-4.2-javadoc%2Fcom%2Fevolveu&dat
a=04%7C01%7C%7C5b6a3e4771c74474708708d946085c6f%7C085f983a0b694270b71d106950
76bafe%7C1%7C0%7C637617824758261420%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=HPGySzkg
c%2FJWZIHePtLIXWa8Y53%2FfJ6wnfVfsQwGsXQ%3D&reserved=0
m/midpoint/xml/ns/_public/common/common_3/UserType.html) class but can't
seem to find a method to directly access the extension attributes. Was
hoping there wouldn't be a need for regex.



Example:

// query for user

thisUser = midpoint.searchObjects(UserType.class, userQuery, null)



// returns value for givenName

thisUser.givenName



//returns an arraylist, with additional unwanted info

thisUser.extension



e.g.

[PCV(null):[PP({https://nam02.safelinks.protection.outlook.com/?url=http%3A%
2F%2Fcustomschema.com%2Fxml%2Fns%2FcustomSchema&data=04%7C01%7C%7C5b6a3e
4771c74474708708d946085c6f%7C085f983a0b694270b71d10695076bafe%7C1%7C0%7C6376
17824758261420%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiL
CJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=fH8tK7j6TuGNZkcK7lfGUlzAeUVQm
6zhvkukP2v1D84%3D&reserved=0}preferredFirstNa
me):[PPV(String:Luke)]]





Thank you,



Jeremiah Haywood

Identity and Access Management Administrator

Office of Technology Solutions | Illinois State University

Phone Number (309) 438-3829



-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.evo
lveum.com%2Fpipermail%2Fmidpoint%2Fattachments%2F20210713%2F1210fdf9%2Fattac
hment-0001.htm&data=04%7C01%7C%7C5b6a3e4771c74474708708d946085c6f%7C085f
983a0b694270b71d10695076bafe%7C1%7C0%7C637617824758261420%7CUnknown%7CTWFpbG
Zsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
000&sdata=Y7kJQ9YT3RaEoMPEdVbDo58dkivm%2B9A5zzvk%2BkXXr70%3D&reserve
d=0>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6756 bytes
Desc: not available
URL:
<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.evo
lveum.com%2Fpipermail%2Fmidpoint%2Fattachments%2F20210713%2F1210fdf9%2Fattac
hment-0001.bin&data=04%7C01%7C%7C5b6a3e4771c74474708708d946085c6f%7C085f
983a0b694270b71d10695076bafe%7C1%7C0%7C637617824758261420%7CUnknown%7CTWFpbG
Zsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
000&sdata=0umhJkGyRGNtUU2%2FcuMHdcxPt%2B2JMv44R8TYpBa3TRg%3D&reserve
d=0>

------------------------------

Message: 2
Date: Tue, 13 Jul 2021 16:13:11 +0200
From: Ivan Noris <ivan.noris at evolveum.com>
To: midpoint at lists.evolveum.com
Subject: Re: [midPoint] Midpoint Query API and Extension Attributes
Message-ID: <bf0f6991-e692-cfb9-bb13-157a2887ce62 at evolveum.com>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

Hi Jeremiah,

if you already have user object, you can use basic.getExtensionPropertyValue
/ basic.getExtensionPropertyValues function as in:

basic.getExtensionPropertyValue(thisUser,
"https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexample.co
m%2Fmidpoint&data=04%7C01%7C%7C5b6a3e4771c74474708708d946085c6f%7C085f98
3a0b694270b71d10695076bafe%7C1%7C0%7C637617824758261420%7CUnknown%7CTWFpbGZs
b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C300
0&sdata=WKoTpowOpxVE97zpvsjRDHTAWLHULSdox9VTHpuxHwQ%3D&reserved=0",
"empStatus")

In this example, "empStatus" is my extension attribute and
"https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexample.co
m%2Fmidpoint&data=04%7C01%7C%7C5b6a3e4771c74474708708d946085c6f%7C085f98
3a0b694270b71d10695076bafe%7C1%7C0%7C637617824758261420%7CUnknown%7CTWFpbGZs
b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C300
0&sdata=WKoTpowOpxVE97zpvsjRDHTAWLHULSdox9VTHpuxHwQ%3D&reserved=0"
is my extension schema namespace.

See also
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.evolv
eum.com%2Fmidpoint%2Freference%2Fexpressions%2Fexpressions%2Fscript%2Ffuncti
ons%2F%23basic-library&data=04%7C01%7C%7C5b6a3e4771c74474708708d946085c6
f%7C085f983a0b694270b71d10695076bafe%7C1%7C0%7C637617824758261420%7CUnknown%
7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn
0%3D%7C3000&sdata=2gLhcazZJyXcSp0FRQowYO0HKUd8WqGYM4KjNfh6YEo%3D&res
erved=0

Hope this helps.

Best regards,

Ivan

On 13. 7. 2021 15:57, Haywood, Jeremiah via midPoint wrote:
>
> Has anyone worked with the Midpoint query api and returning extension 
> attribute values for users? It seems the default schema attributes can 
> be accessed by name fairly easily. Have been looking at the UserType
> (https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdow
> nload.evolveum.com%2Fmidpoint%2F4.2%2Fmidpoint-4.2-javadoc%2Fcom%2Fevo
> lveum%2Fmidpoint%2Fxml%2Fns%2F_public%2Fcommon%2Fcommon_3%2FUserType.h
> tml&data=04%7C01%7C%7C5b6a3e4771c74474708708d946085c6f%7C085f983a0
> b694270b71d10695076bafe%7C1%7C0%7C637617824758261420%7CUnknown%7CTWFpb
> GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0
> %3D%7C3000&sdata=BfV7ixIKpuOrQFaY5w0qLC7L5SnxMBq%2F1bjyXRn5Iec%3D&
> amp;reserved=0
> <https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdow
> nload.evolveum.com%2Fmidpoint%2F4.2%2Fmidpoint-4.2-javadoc%2Fcom%2Fevo
> lveum%2Fmidpoint%2Fxml%2Fns%2F_public%2Fcommon%2Fcommon_3%2FUserType.h
> tml&data=04%7C01%7C%7C5b6a3e4771c74474708708d946085c6f%7C085f983a0
> b694270b71d10695076bafe%7C1%7C0%7C637617824758261420%7CUnknown%7CTWFpb
> GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0
> %3D%7C3000&sdata=BfV7ixIKpuOrQFaY5w0qLC7L5SnxMBq%2F1bjyXRn5Iec%3D&
> amp;reserved=0>) class but can't seem to find a method to directly 
> access the extension attributes. Was hoping there wouldn't be a need 
> for regex.
>
> Example:
>
> // query for user
>
> thisUser = midpoint.searchObjects(UserType.class, userQuery, null)
>
> // returns value for givenName
>
> thisUser.givenName
>
> //returns an arraylist, with additional unwanted info
>
> thisUser.extension
>
> e.g.
>
> [PCV(null):[PP({https://nam02.safelinks.protection.outlook.com/?url=ht
> tp%3A%2F%2Fcustomschema.com%2Fxml%2Fns%2FcustomSchema&data=04%7C01
> %7C%7C5b6a3e4771c74474708708d946085c6f%7C085f983a0b694270b71d10695076b
> afe%7C1%7C0%7C637617824758261420%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wL
> jAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata
> =fH8tK7j6TuGNZkcK7lfGUlzAeUVQm6zhvkukP2v1D84%3D&reserved=0}preferr
> edFirstName):[PPV(String:Luke)]]
>
> Thank you,
>
> Jeremiah Haywood
>
> Identity and Access Management Administrator
>
> Office of Technology Solutions | Illinois State University
>
> Phone Number (309) 438-3829
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.evolveum.com%2Fmailman%2Flistinfo%2Fmidpoint&data=04%7C01%7C%7C5
> b6a3e4771c74474708708d946085c6f%7C085f983a0b694270b71d10695076bafe%7C1
> %7C0%7C637617824758261420%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAi
> LCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=HoEdDG
> Hdh9lJaZFfW83F%2FVE%2FS8OEtzBUAOz9Iv003Sw%3D&reserved=0

--
Ivan Noris
Senior Identity Engineer
evolveum.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.evo
lveum.com%2Fpipermail%2Fmidpoint%2Fattachments%2F20210713%2Fc2bb9fd5%2Fattac
hment.htm&data=04%7C01%7C%7C5b6a3e4771c74474708708d946085c6f%7C085f983a0
b694270b71d10695076bafe%7C1%7C0%7C637617824758261420%7CUnknown%7CTWFpbGZsb3d
8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&a
mp;sdata=NAfcjnx58lmMmn70TK7VrUMtsGfq48zbIS62Uz6%2B6Tk%3D&reserved=0>

------------------------------

Subject: Digest Footer

_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.evol
veum.com%2Fmailman%2Flistinfo%2Fmidpoint&data=04%7C01%7C%7C5b6a3e4771c74
474708708d946085c6f%7C085f983a0b694270b71d10695076bafe%7C1%7C0%7C63761782475
8261420%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6
Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=HoEdDGHdh9lJaZFfW83F%2FVE%2FS8OEtzBU
AOz9Iv003Sw%3D&reserved=0


------------------------------

End of midPoint Digest, Vol 111, Issue 7
****************************************

_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com
https://lists.evolveum.com/mailman/listinfo/midpoint


More information about the midPoint mailing list