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.CollectionTable;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.ElementCollection;
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.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.github.gentity.ToOneSide;

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

    @ElementCollection
    @CollectionTable(name = "PICTURE_DATA", joinColumns = {
        @JoinColumn(name = "PICTURE_ID", referencedColumnName = "ID")
    })
    @Lob
    @Column(name = "DATA", nullable = false)
    protected List data = new ArrayList();
    @ElementCollection
    @CollectionTable(name = "PICTURE_KEYWORD", joinColumns = {
        @JoinColumn(name = "PICTURE_ID", referencedColumnName = "ID")
    })
    @Column(name = "KEYWORD", length = 100, nullable = false)
    protected List keyword = new ArrayList();
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    protected Integer id;
    @Column(name = "TITLE", length = 100)
    protected String title;
    @ManyToOne
    @JoinColumn(name = "GALLERY_ID", nullable = false)
    protected Gallery gallery;
    final static ToOneSide relationTo$gallery = ToOneSide.of((o -> o.gallery), ((o,m) -> o.gallery = m), Gallery.relationTo$picture);
    @ManyToOne
    @JoinColumn(name = "ICON_USER_ID")
    protected User iconUser;
    final static ToOneSide relationTo$iconUser = ToOneSide.of((o -> o.iconUser), ((o,m) -> o.iconUser = m), User.relationTo$picture);

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

    public List getData() {
        return data;
    }

    public void setData(List data) {
        this.data = data;
    }

    public List getKeyword() {
        return keyword;
    }

    public void setKeyword(List keyword) {
        this.keyword = keyword;
    }

    public Integer getId() {
        return id;
    }

    public String getTitle() {
        return title;
    }

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

    public Gallery getGallery() {
        return (relationTo$gallery.get(this));
    }

    public void setGallery(Gallery gallery) {
        relationTo$gallery.set(this, gallery);
    }

    public User getIconUser() {
        return (relationTo$iconUser.get(this));
    }

    public void setIconUser(User iconUser) {
        relationTo$iconUser.set(this, iconUser);
    }

    public static class Builder {

        private final Picture instance = new Picture();

        public Picture build() {
            return instance;
        }

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

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

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

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

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

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy