1
2
3
4 package org.itracker.web.ptos;
5
6 import org.itracker.model.IssueAttachment;
7
8 import java.util.ArrayList;
9 import java.util.Collections;
10 import java.util.List;
11
12
13
14
15
16
17 public class ListAttachmentsPTO {
18 boolean hasAttachments = false;
19 long sizeOfAllAttachments = 0;
20 List<IssueAttachment> attachments = new ArrayList<IssueAttachment>();
21
22
23
24
25 public boolean isHasAttachments() {
26 return hasAttachments;
27 }
28
29
30
31
32 public void setHasAttachments(boolean hasAttachments) {
33 this.hasAttachments = hasAttachments;
34 }
35
36
37
38
39 public long getSizeOfAllAttachments() {
40 return sizeOfAllAttachments;
41 }
42
43
44
45
46 public void setSizeOfAllAttachments(long sizeOfAllAttachments) {
47 this.sizeOfAllAttachments = sizeOfAllAttachments;
48 }
49
50
51
52
53 public List<IssueAttachment> getAttachments() {
54 return attachments;
55 }
56
57
58
59
60 public void setAttachments(List<IssueAttachment> attachments) {
61 this.attachments = attachments;
62 if (attachments.size() > 0) {
63 hasAttachments = true;
64 Collections.sort(attachments, IssueAttachment.ID_COMPARATOR);
65 for (IssueAttachment issueAttachment : attachments) {
66 sizeOfAllAttachments += issueAttachment.getSize();
67 }
68 }
69 }
70
71
72 }