]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/attachment/SimpleAttachment.java
1c1f13eb9319ec98b8157c87a0166757b780efcc
[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 String getUuid() {
11 return uuid;
12 }
13
14 public void setUuid(String uuid) {
15 this.uuid = uuid;
16 }
17
18 public String getName() {
19 return name;
20 }
21
22 public void setName(String name) {
23 this.name = name;
24 }
25
26 public String getContentType() {
27 return contentType;
28 }
29
30 public void setContentType(String contentType) {
31 this.contentType = contentType;
32 }
33
34 public String toString() {
35 return "Attachment #" + uuid + "(" + name + ", " + contentType + ")";
36 }
37
38 public boolean equals(Object obj) {
39 if (obj instanceof Attachment) {
40 Attachment attachment = (Attachment) obj;
41 if (uuid != null && attachment.getUuid() != null)
42 return uuid.equals(attachment.getUuid());
43
44 if (name != null && attachment.getName() != null)
45 return name.equals(attachment.getName());
46
47 return hashCode() == attachment.hashCode();
48 }
49 return false;
50 }
51 }