Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cast DelegatingApplicationUser to ApplicationUser?

Paul Tiseo
Contributor
June 8, 2018

In a script, I call:

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

Seems to work just fine in:

def eitherRequestTypes = requestTypeService.getRequestTypes(currentUser, requestTypeQuery)

But, later on, I call:

def portal = portalService.getPortalForProject(currentUser, portalId)

This gives me an error:

No signature of method: com.atlassian.servicedesk.internal.feature.customer.portal.PortalServiceImpl.getPortalForProject() is applicable for argument types: (com.atlassian.jira.user.DelegatingApplicationUser, java.lang.Integer)

What? :) Do I cast it? Should I have used another way to get an ApplicationUser? Why does it work in one method that has the same signature as another in the same software?

2 answers

1 accepted

2 votes
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 8, 2018

Hello @Paul Tiseo

There is problem not in ApplicationUser.
getPortalForProject need AplicationUser and Project object, but you input Integer.

referred
https://docs.atlassian.com/jira-servicedesk/3.8.2/com/atlassian/servicedesk/api/portal/PortalService.html

Paul Tiseo
Contributor
June 8, 2018

Yes! You got it. The error was misleading me. I was calling getPortalForProject() instead of getPortalForId().

(You are making lots of points off of me this week! :) )

Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 8, 2018

hehe :) feel free to ask! Did my answer about get transition ids and names help you?

Paul Tiseo
Contributor
June 11, 2018

I haven't had the time to drill down on that one yet. Probably this week.

1 vote
Thanos Batagiannis [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 8, 2018

Hey Paul,

How do you get the portalService ?

Paul Tiseo
Contributor
June 8, 2018

I think you were on the right track. I was using the wrong method by mistake, but the error was taking me elsewhere.

Suggest an answer

Log in or Sign up to answer