@POST
@Path("/initjqldlg")
@Produces({MediaType.APPLICATION_JSON})
public Response initJqlDialog(@Context HttpServletRequest req)
{
JiraAuthenticationContext authCtx = ComponentManager.getInstance().getJiraAuthenticationContext();
I18nHelper i18n = authCtx.getI18nHelper();
User user = authCtx.getLoggedInUser();
if (user == null)
{
log.error("QueryFieldsService::initJclDialog - User is not logged");
return Response.ok(i18n.getText("queryfields.error.notlogged")).status(401).build();
}
String cfIdStr = req.getParameter("cfId");
String prIdStr = req.getParameter("prId");
String type = req.getParameter("type");
if (!Utils.isValidStr(cfIdStr) || !Utils.isValidStr(prIdStr) || !Utils.isValidStr(type))
{
log.error("QueryFieldsService::initJclDialog - Required parameters are not set");
return Response.ok(i18n.getText("queryfields.error.notrequiredparms")).status(500).build();
}
long cfId;
long prId;
try
{
cfId = Long.parseLong(cfIdStr);
prId = Long.parseLong(prIdStr);
}
catch (NumberFormatException nex)
{
log.error("QueryFieldsService::initJclDialog - Parameters are not valid");
return Response.ok(i18n.getText("queryfields.error.notvalidparms")).status(500).build();
}
XsrfTokenGenerator xsrfTokenGenerator = ComponentManager.getComponentInstanceOfType(XsrfTokenGenerator.class);
String atl_token = xsrfTokenGenerator.generateToken(req);
Map<String, Object> params = new HashMap<String, Object>();
params.put("i18n", authCtx.getI18nHelper());
params.put("baseUrl", Utils.getBaseUrl(req));
params.put("atl_token", atl_token);
params.put("cfId", cfId);
params.put("prId", prId);
params.put("type", type);