Package hu.lacimol.tutorial.webwork

Source Code of hu.lacimol.tutorial.webwork.HelloAction

package hu.lacimol.tutorial.webwork;

import java.util.Map;
import java.util.TreeMap;

import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.user.UserUtils;
import com.atlassian.jira.web.action.JiraWebActionSupport;

public class HelloAction extends JiraWebActionSupport {

  private static final long serialVersionUID = 6545090412954507661L;

  private String userName;

  @Override
  protected String doExecute() throws Exception {
    log.debug("Entering doExecute");
    String loggedUserName = getLoggedUserName();
    User admin = UserUtils.getUser("admin");
    userName = loggedUserName != null ? loggedUserName : admin.getDisplayName();
    return SUCCESS;
  }

  public String getUserName() {
    return userName;
  }

  public String getLoggedUserName() {
    User loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
    return loggedInUser == null ? null : loggedInUser.getDisplayName();
  }

  public Map<String, Object> getCtx() {
    // rendezett velocity parameterek
    return new TreeMap<String, Object>(ComponentAccessor.getVelocityParamFactory().getDefaultVelocityParams());
  }

}
TOP

Related Classes of hu.lacimol.tutorial.webwork.HelloAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.