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