本文整理了Java中com.atlassian.jira.issue.attachment.Attachment
类的一些代码示例,展示了Attachment
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attachment
类的具体详情如下:
包路径:com.atlassian.jira.issue.attachment.Attachment
类名称:Attachment
暂无
代码示例来源:origin: com.atlassian.jira.plugins/atlassian-jira-rpc-plugin
public RemoteAttachment(Attachment attachment)
{
super(attachment.getId().toString());
author = getUsernameFor(attachment.getAuthorObject());
created = attachment.getCreated();
filename = attachment.getFilename();
filesize = attachment.getFilesize();
mimetype = attachment.getMimetype();
}
代码示例来源:origin: com.atlassian.jira/jira-core
/**
* @param attachment the attachment
* @return the issue to which this attachment is attached
*/
private Issue getIssue(Attachment attachment)
{
Long issueId = attachment.getIssueId();
Issue issue = issueById.get(issueId);
if (issue == null)
{
issue = attachment.getIssue();
issueById.put(issueId, issue);
}
return issue;
}
代码示例来源:origin: com.atlassian.jira/jira-core
Issue getAndVerifyIssue(Attachment attachment, ErrorCollection errorCollection)
{
Issue issue = attachment.getIssueObject();
if (issue == null)
{
errorCollection.addErrorMessage(getText("attachment.service.error.null.issue.for.attachment", attachment.getId().toString()));
return null;
}
return issue;
}
代码示例来源:origin: com.atlassian.jira/jira-core
private RendererAttachment convertToRendererAttachment(Attachment attachment, RenderContext context, EmbeddedResource resource)
{
return new RendererAttachment(attachment.getId().longValue(), attachment.getFilename(), attachment.getMimetype(),
attachment.getAuthorKey(), null, buildAttachmentUrl(context, attachment), null, null, attachment.getCreated());
}
代码示例来源:origin: com.atlassian.jira/jira-api
static AttachmentAdapter fromAttachment(final Attachment attachment)
{
return new AttachmentAdapter(attachment.getId(), attachment.getFilename());
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
public int compare(final Attachment a1, final Attachment a2)
{
final String filename1 = a1.getFilename();
final String filename2 = a2.getFilename();
if ((filename1 == null) && (filename2 == null))
{
return 0;
}
if (filename1 == null)
{
return -1; // non null values are greater than null values
}
if (filename2 == null)
{
return 1; // non null values are greater than null values
}
return collator.compare(filename1, filename2);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
private StoreAttachmentBean mapAttachmentToStoreBean(final Attachment metadata, final StoreAttachmentBean.Builder builder)
{
return builder
.withId(metadata.getId())
.withFileName(metadata.getFilename())
.withSize(metadata.getFilesize())
.withIssueKey(metadata.getIssue().getKey())
.withOriginalProjectKey(metadata.getIssue().getProjectObject().getOriginalKey())
.build();
}
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
@Override
public HumanReadableArchive format(final AttachmentArchive archive, final Attachment attachment)
{
final Long id = attachment.getId();
final List<AttachmentArchiveEntry> entries = archive.getEntries();
final Collection<HumanReadableArchiveEntry> convertedEntries = convertEntries(entries);
final String name = attachment.getFilename();
final int totalEntryCount = archive.getTotalEntryCount();
final String mediaType = attachment.getMimetype();
return new HumanReadableArchive(id, name, convertedEntries, totalEntryCount, mediaType);
}
代码示例来源:origin: com.atlassian.jira/jira-core
private <A> Map<Long, A> fillMap(final List<Attachment> attachments, final Function<Attachment, A> f)
{
final ImmutableMap.Builder<Long, A> builder = ImmutableMap.builder();
for (final Attachment attachment : attachments) {
builder.put(attachment.getId(), f.apply(attachment));
}
return builder.build();
}
代码示例来源:origin: com.atlassian.jira.plugins/jira-healthcheck-plugin
latestAttachment.getCreated().getTime() - THIRTY_SECONDS_IN_MILLIS);
+ "before was found", THIRTY_SECONDS_IN_MILLIS);
return supportHealthStatusBuilder.major(ATTACHMENT_ERROR, latestAttachment.getFilename(),
latestAttachment.getIssue().getKey());
return supportHealthStatusBuilder.major(ATTACHMENT_ERROR, previousAttachment.getFilename(),
previousAttachment.getIssue().getKey());
latestAttachment.getFilename(), latestAttachment.getIssue().getKey(),
previousAttachment.getFilename(), previousAttachment.getIssue().getKey());
return supportHealthStatusBuilder.ok(ATTACHMENT_AOK, latestAttachment.getFilename(),
latestAttachment.getIssue().getKey());
代码示例来源:origin: com.atlassian.streams/streams-jira-plugin
@Override
public ActivityObject apply(Attachment attachment) {
final StreamsUriBuilder idBuilder = new StreamsUriBuilder().setUrl(issueUriBuilder.getIssueUri(baseUri, attachment.getIssueObject()).toASCIIString()).setTimestamp(attachment.getCreated());
return new ActivityObject(ActivityObject.params().
id(idBuilder.getUri().toASCIIString()).
activityObjectType(file()).
title(some(attachment.getFilename())).
alternateLinkUri(issueUriBuilder.getAttachmentUri(baseUri, attachment)));
}
};
代码示例来源:origin: com.atlassian.cpji/cpji-jira-plugin
@Override
protected void modifyRequest(ApplicationLinkRequest request) {
RequestFilePart requestFilePart = new RequestFilePart(attachment.getMimetype(), attachment.getFilename(), attachmentFile, "file");
request.setFiles(ImmutableList.of(requestFilePart));
request.addHeader("X-Atlassian-Token", "nocheck");
}
});
代码示例来源:origin: com.atlassian.jira/jira-core
private RendererAttachment convertToRendererAttachment(ThumbnailedImage thumbnail, Attachment attachment, RenderContext context, EmbeddedResource resource)
{
return new RendererAttachment(thumbnail.getAttachmentId(), thumbnail.getFilename(), attachment.getMimetype(),
attachment.getAuthorKey(), null, thumbnail.getImageURL(), null, null, attachment.getCreated());
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public Attachment setZip(final Attachment attachment, final boolean zip)
{
final GenericValue attachmentGV;
try
{
attachmentGV = ofBizDelegator.findById(AttachmentConstants.ATTACHMENT_ENTITY_NAME, attachment.getId());
attachmentGV.put("zip", zip ? IS_ZIP : NOT_ZIP);
attachmentGV.store();
}
catch (DataAccessException e)
{
log.error("Unable to find a file attachment with id: " + attachment.getId());
throw e;
}
catch (GenericEntityException e)
{
log.error("Unable to find a file attachment with id: " + attachment.getId());
throw new DataAccessException(e);
}
return new Attachment(issueManager, attachmentGV, attachment.getProperties());
}
代码示例来源:origin: com.atlassian.jira/jira-core
/**
* Sets the content type, content length and "Content-Disposition" header
* of the response based on the values of the attachement found.
*
* @param request HTTP request
* @param response HTTP response
* @throws AttachmentNotFoundException
* @throws IOException
*/
protected void setResponseHeaders(HttpServletRequest request, HttpServletResponse response)
throws AttachmentNotFoundException, IOException
{
final Attachment attachment = getAttachment(attachmentQuery(request));
response.setContentType(attachment.getMimetype());
response.setContentLength(attachment.getFilesize().intValue());
getMimeSniffingKit().setAttachmentResponseHeaders(attachment, request.getHeader(USER_AGENT_HEADER), response);
HttpResponseHeaders.cachePrivatelyForAboutOneYear(response);
}
代码示例来源:origin: com.atlassian.jira/jira-core
/**
* Determines whether the specified attachment is the latest file uploaded amongst the group of files
* with the same name in the underlying list.
* @param attachment The attachment in play. Should not be null.
* @return true if this is the latest (or only) file with this name; otherwise false.
*/
public boolean isLatestVersion(Attachment attachment)
{
notNull("attachment" , attachment);
final TreeSet<Attachment> namedAttachments = fileNameGroupingMap.get(attachment.getFilename());
if (namedAttachments != null)
{
return (namedAttachments.size() == 1) || (namedAttachments.last().equals(attachment));
}
return false;
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
if (attachment.isThumbnailable() != null)
return attachment.isThumbnailable();
if (isSupportedImage.claim())
final String mimeType = mimeManager.getSuggestedMimeType(attachment.getFilename());
thumbnailable = ThumbnailUtil.isMimeTypeSupported(mimeType);
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public boolean isThumbnailable(final Attachment attachment)
{
return isThumbnailable(attachment.getIssueObject(), attachment);
}
代码示例来源:origin: com.atlassian.jira.plugins/jira-healthcheck-plugin
@Override
public Boolean withInputStream(InputStream inputStream) throws IOException
{
return inputStream != null && inputStream.available() == attachment.getFilesize();
}
});
代码示例来源:origin: com.atlassian.jira/jira-core
public int compare(final Attachment attachment1, final Attachment attachment2)
{
final Timestamp created1 = attachment1.getCreated();
final Timestamp created2 = attachment2.getCreated();
if ((created1 == null) && (created2 == null))
{
return 0;
}
if (created1 == null)
{
return 1;
}
if (created2 == null)
{
return -1;
}
return created1.compareTo(created2);
}
}
内容来源于网络,如有侵权,请联系作者删除!