]>
git.argeo.org Git - gpl/argeo-slc.git/blob - SimpleAttachment.java
e9a44c959474e504cf4243f815b9a9d06ee32b8f
2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.core
.attachment
;
18 import java
.io
.Serializable
;
19 import java
.util
.UUID
;
21 import org
.argeo
.slc
.attachment
.Attachment
;
23 public class SimpleAttachment
implements Attachment
, Serializable
{
24 private static final long serialVersionUID
= 6615155908800610606L;
25 private String uuid
= UUID
.randomUUID().toString();
27 private String contentType
= "";
29 public SimpleAttachment() {
32 public SimpleAttachment(String uuid
, String name
, String contentType
) {
36 this.contentType
= contentType
;
39 public String
getUuid() {
43 public void setUuid(String uuid
) {
47 public String
getName() {
51 public void setName(String name
) {
55 public String
getContentType() {
59 public void setContentType(String contentType
) {
60 this.contentType
= contentType
;
63 public String
toString() {
64 return "Attachment #" + uuid
+ "(" + name
+ ", " + contentType
+ ")";
67 public boolean equals(Object obj
) {
68 if (obj
instanceof Attachment
) {
69 Attachment attachment
= (Attachment
) obj
;
70 if (uuid
!= null && attachment
.getUuid() != null)
71 return uuid
.equals(attachment
.getUuid());
73 if (name
!= null && attachment
.getName() != null)
74 return name
.equals(attachment
.getName());
76 return hashCode() == attachment
.hashCode();