]> git.argeo.org Git - gpl/argeo-slc.git/blob - legacy/org.argeo.slc.spring/src/org/argeo/slc/core/attachment/SimpleAttachment.java
Adapt to changes in Argeo Commons
[gpl/argeo-slc.git] / legacy / org.argeo.slc.spring / src / org / argeo / slc / core / attachment / SimpleAttachment.java
1 package org.argeo.slc.core.attachment;
2
3 import java.io.Serializable;
4 import java.util.UUID;
5
6 import org.argeo.slc.attachment.Attachment;
7
8 public class SimpleAttachment implements Attachment, Serializable {
9 private static final long serialVersionUID = 6615155908800610606L;
10 private String uuid = UUID.randomUUID().toString();
11 private String name;
12 private String contentType = "";
13
14 public SimpleAttachment() {
15 }
16
17 public SimpleAttachment(String uuid, String name, String contentType) {
18 super();
19 this.uuid = uuid;
20 this.name = name;
21 this.contentType = contentType;
22 }
23
24 public String getUuid() {
25 return uuid;
26 }
27
28 public void setUuid(String uuid) {
29 this.uuid = uuid;
30 }
31
32 public String getName() {
33 return name;
34 }
35
36 public void setName(String name) {
37 this.name = name;
38 }
39
40 public String getContentType() {
41 return contentType;
42 }
43
44 public void setContentType(String contentType) {
45 this.contentType = contentType;
46 }
47
48 public String toString() {
49 return "Attachment #" + uuid + "(" + name + ", " + contentType + ")";
50 }
51
52 public boolean equals(Object obj) {
53 if (obj instanceof Attachment) {
54 Attachment attachment = (Attachment) obj;
55 if (uuid != null && attachment.getUuid() != null)
56 return uuid.equals(attachment.getUuid());
57
58 if (name != null && attachment.getName() != null)
59 return name.equals(attachment.getName());
60
61 return hashCode() == attachment.hashCode();
62 }
63 return false;
64 }
65 }