All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.gentity.demogallery.Picture Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version

package com.github.gentity.demogallery;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "PICTURE")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "DTYPE", length = 8)
@DiscriminatorValue("PICT")
public class Picture implements Serializable
{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    protected Integer id;
    @Column(name = "TITLE", length = 100)
    protected String title;
    @OneToMany(mappedBy = "picture")
    protected List pictureKeyword = new ArrayList();
    @ManyToOne
    @JoinColumn(name = "GALLERY_ID", nullable = false)
    protected Gallery gallery;
    @ManyToOne
    @JoinColumn(name = "ICON_USER_ID")
    protected User iconUser;
    @OneToOne(mappedBy = "picture")
    protected PictureData pictureData;

    public static Picture.Builder builder() {
        return new Picture.Builder();
    }

    public Integer getId() {
        return id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public List getPictureKeyword() {
        return pictureKeyword;
    }

    public void setPictureKeyword(List pictureKeyword) {
        this.pictureKeyword = pictureKeyword;
    }

    public Gallery getGallery() {
        return gallery;
    }

    public void setGallery(Gallery gallery) {
        this.gallery = gallery;
    }

    public User getIconUser() {
        return iconUser;
    }

    public void setIconUser(User iconUser) {
        this.iconUser = iconUser;
    }

    public PictureData getPictureData() {
        return pictureData;
    }

    public void setPictureData(PictureData pictureData) {
        this.pictureData = pictureData;
    }

    public static class Builder {

        private final Picture instance = new Picture();

        public Picture build() {
            return instance;
        }

        public Picture.Builder title(String title) {
            instance.title = title;
            return this;
        }

        public Picture.Builder pictureKeyword(List pictureKeyword) {
            instance.pictureKeyword = pictureKeyword;
            return this;
        }

        public Picture.Builder gallery(Gallery gallery) {
            instance.gallery = gallery;
            return this;
        }

        public Picture.Builder iconUser(User iconUser) {
            instance.iconUser = iconUser;
            return this;
        }

        public Picture.Builder pictureData(PictureData pictureData) {
            instance.pictureData = pictureData;
            return this;
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy