]>
git.argeo.org Git - gpl/argeo-slc.git/blob - core/attachment/SimpleAttachment.java
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 public class SimpleAttachment
implements Attachment
, Serializable
{
22 private static final long serialVersionUID
= 6615155908800610606L;
23 private String uuid
= UUID
.randomUUID().toString();
25 private String contentType
= "";
27 public SimpleAttachment() {
30 public SimpleAttachment(String uuid
, String name
, String contentType
) {
34 this.contentType
= contentType
;
37 public String
getUuid() {
41 public void setUuid(String uuid
) {
45 public String
getName() {
49 public void setName(String name
) {
53 public String
getContentType() {
57 public void setContentType(String contentType
) {
58 this.contentType
= contentType
;
61 public String
toString() {
62 return "Attachment #" + uuid
+ "(" + name
+ ", " + contentType
+ ")";
65 public boolean equals(Object obj
) {
66 if (obj
instanceof Attachment
) {
67 Attachment attachment
= (Attachment
) obj
;
68 if (uuid
!= null && attachment
.getUuid() != null)
69 return uuid
.equals(attachment
.getUuid());
71 if (name
!= null && attachment
.getName() != null)
72 return name
.equals(attachment
.getName());
74 return hashCode() == attachment
.hashCode();