Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to get object of ApplicationUser?

David Lemon June 10, 2013

I want to get ApplicationUser object, And i have 'IssueEvent event' and i have 'event.getUser'.

i am trying to do AttachmentManager.createAttachment(CreateAttachmentParamBean)

jira version 6.0.1 api version 4.2

where

public CreateAttachmentParamsBean(File file,
                                  String filename,
                                  String contentType,
                                  ApplicationUser author,
                                  Issue issue,
                                  Boolean zip,
                                  Boolean thumbnailable,
                                  Map<String,Object> attachmentProperties,
                                  Date createdTime,
                                  Boolean copySourceFile)

requires 'ApplicationUser author' .

I have tried this:
ApplicationUser applicationUser =
new DelegatingApplicationUser(key,user);

DelegatingApplicationUser
(String key, com.atlassian.crowd.embedded.api.User user)


what is key how do i get it?
 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
Ulrich Nack
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 10, 2013

Hi Sohil

try somthing like this:

import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.user.ApplicationUser;

        final String sEventUser;
        final User eventUser =  issueEvent.getUser();
        if (eventUser == null)
        {
            ... your error handling
        }
        else
        {
            sEventUser = eventUser.getName();
        }
        
        final ApplicationUser appUser = ApplicationUsers.from(eventUser);

I hope this can help you.

Regards,

Uli

David Lemon June 10, 2013

Thanks Ulrich but tell me what is this code doing??

if (eventUser == null)
        {
            ... your error handling
        }
        else
        {
            sEventUser = eventUser.getName();
        }

and what is the use of

sEventUser

Ulrich Nack
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 10, 2013

Hi Sohil,

I used the string sEventUser later in my plugin for logging.
I think you need only the line:

final ApplicationUser appUser = ApplicationUsers.from(eventUser);

Sorry if I confused you.

Regards,

Uli

Ramakrishna Anumalla March 30, 2016

Hi Ulrich,

How can i get ApplicationUsers??

final ApplicationUser appUser = ApplicationUsers.from(eventUser); is giving me error to declare ApplicationUsers class.

its not importing ApplicationUsers class


Please suggest.

TAGS
AUG Leaders

Atlassian Community Events