/** * Returns all currently matchign temporary attachments for a particular issue. If a null issue id * is provided, this should be interpreted as a newly created issue that doesn't have an id yet. * * @param issueId The id of the issue to get attachmetns for. May be null * @return a collection of temporary attachments for this issue sorted by creation date */ public Collection<TemporaryAttachment> getByIssueId(final Long issueId) { final ArrayList<TemporaryAttachment> ret = new ArrayList<TemporaryAttachment>( CollectionUtil.filter( temporaryAttachments.values(), new Predicate<TemporaryAttachment>() { public boolean evaluate(final TemporaryAttachment input) { return issueId == null && input.getIssueId() == null || (issueId != null && issueId.equals(input.getIssueId())); } })); Collections.sort(ret); return ret; }