org.wallride.domain.Media Maven / Gradle / Ivy
/*
* Copyright 2014 Tagbangers, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wallride.domain;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name = "media")
@DynamicInsert
@DynamicUpdate
@SuppressWarnings("serial")
public class Media extends DomainObject {
public enum ResizeMode {
RESIZE,
CROP,
}
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
@Column(length = 50)
private String id;
@Column(length = 500, nullable = false)
private String mimeType;
@Column(length = 500)
private String originalName;
@ManyToMany(mappedBy = "medias")
private List posts;
@Override
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public String getOriginalName() {
return originalName;
}
public void setOriginalName(String originalName) {
this.originalName = originalName;
}
public List getPosts() {
return posts;
}
public void setPosts(List posts) {
this.posts = posts;
}
@Override
public String print() {
return getId() + " " + getOriginalName();
}
}