]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/attachment/SimpleAttachment.java
Attachments management
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / attachment / SimpleAttachment.java
diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/attachment/SimpleAttachment.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/attachment/SimpleAttachment.java
new file mode 100644 (file)
index 0000000..f5ee9df
--- /dev/null
@@ -0,0 +1,49 @@
+package org.argeo.slc.core.attachment;
+
+public class SimpleAttachment implements Attachment {
+       private String uuid;
+       private String name;
+       private String contentType;
+
+       public String getUuid() {
+               return uuid;
+       }
+
+       public void setUuid(String uuid) {
+               this.uuid = uuid;
+       }
+
+       public String getName() {
+               return name;
+       }
+
+       public void setName(String name) {
+               this.name = name;
+       }
+
+       public String getContentType() {
+               return contentType;
+       }
+
+       public void setContentType(String contentType) {
+               this.contentType = contentType;
+       }
+
+       public String toString() {
+               return "Attachment #" + uuid + "(" + name + ", " + contentType + ")";
+       }
+
+       public boolean equals(Object obj) {
+               if (obj instanceof Attachment) {
+                       Attachment attachment = (Attachment) obj;
+                       if (uuid != null && attachment.getUuid() != null)
+                               return uuid.equals(attachment.getUuid());
+
+                       if (name != null && attachment.getName() != null)
+                               return name.equals(attachment.getName());
+
+                       return hashCode() == attachment.hashCode();
+               }
+               return false;
+       }
+}