@Override protected Object getBaseObject( String name ) { return renderContext.getParam( name ); }
private Integer nextGalleryId(RenderContext renderContext) { Integer galleryId = (Integer) renderContext.getParam("nextGalleryId"); if (galleryId == null) { galleryId = 0; } renderContext.addParam("nextGalleryId", galleryId + 1); return galleryId; }
/** * @inheritDoc */ public String locate(RenderContext context) { return searchIssueForKey((Issue) context.getParam(AtlassianWikiRenderer.ISSUE_CONTEXT_KEY)); }
public JiraAttachmentLink(GenericLinkParser parser, RenderContext context) throws ParseException { super(parser); Issue issue = (Issue) context.getParam(AtlassianWikiRenderer.ISSUE_CONTEXT_KEY); if(issue == null || issue.getGenericValue() == null) { throw new ParseException("Can not resolve attachment with name " + parser.getAttachmentName() + " no issue in context.", 0); } try { attachment = getAttachment(issue, parser.getAttachmentName()); if (attachment != null) { url = buildAttachmentUrl(context, attachment); setTitle(attachment.getFilename() + " attached to " + issue.getKey()); iconName = ATTACHMENT_ICON; } if (linkBody.startsWith("^") && linkBody.length() > 1) linkBody = linkBody.substring(1); } catch(Exception e) { // just don't create a link attachment = null; } }
public RendererAttachment getAttachment(RenderContext context, EmbeddedResource resource) { // Make sure we have an issue and a usable issueGV from the issue Issue issue = (Issue) context.getParam(AtlassianWikiRenderer.ISSUE_CONTEXT_KEY); if (resource.isInternal() && issue == null || issue.getGenericValue() == null) { log.debug("No usable issue stored in the context, unable to resolve filename '" + resource.getFilename() + "'"); throw new RuntimeException("No usable issue stored in the context, unable to resolve filename '" + resource.getFilename() + "'"); } Attachment attachment = null; Collection<Attachment> attachments; attachments = issue.getAttachments(); for (final Attachment tempAttachement : attachments) { if (tempAttachement.getFilename().equals(resource.getFilename())) { // Since the list is sorted by filename and date we know the first is the most recent attachment = tempAttachement; break; } } if (attachment == null) { return null; } else { return convertToRendererAttachment(attachment, context, resource); } }
public String execute(Map parameters, String body, RenderContext renderContext) throws MacroException if (renderContext.getParam("com.atlassian.plugin.repository.plugin.RepositoryMacro:running") != null)
Issue issue = (Issue) context.getParam(AtlassianWikiRenderer.ISSUE_CONTEXT_KEY); log.debug("Unable to create a link for issue: {}", ((issue == null) ? "null" : issue.getKey()));