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

com.github.gentity.demogallery.Gallery 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.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import com.github.gentity.ToManySide;
import com.github.gentity.ToOneSide;

@Entity
@Table(name = "GALLERY")
public class Gallery implements Serializable
{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    protected Integer id;
    @Column(name = "NAME", length = 100, nullable = false)
    protected String name;
    @OneToMany(mappedBy = "gallery")
    protected List picture = new ArrayList();
    final static ToManySide , Picture> relationTo$picture = ToManySide.of((o -> o.picture), Picture.relationTo$gallery);
    @ManyToOne
    @JoinColumn(name = "OWNER_USER_ID", nullable = false)
    protected User ownerUser;
    final static ToOneSide relationTo$ownerUser = ToOneSide.of((o -> o.ownerUser), ((o,m) -> o.ownerUser = m), User.relationTo$gallery);
    @OneToMany(mappedBy = "gallery")
    protected List roleGalleryAccess = new ArrayList();
    final static ToManySide , RoleGalleryAccess> relationTo$roleGalleryAccess = ToManySide.of((o -> o.roleGalleryAccess), RoleGalleryAccess.relationTo$gallery);

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

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List getPicture() {
        return (relationTo$picture.get(this));
    }

    public User getOwnerUser() {
        return (relationTo$ownerUser.get(this));
    }

    public void setOwnerUser(User ownerUser) {
        relationTo$ownerUser.set(this, ownerUser);
    }

    public List getRoleGalleryAccess() {
        return (relationTo$roleGalleryAccess.get(this));
    }

    public static class Builder {

        private final Gallery instance = new Gallery();

        public Gallery build() {
            return instance;
        }

        public Gallery.Builder name(String name) {
            instance.name = name;
            return this;
        }

        public Gallery.Builder ownerUser(User ownerUser) {
            instance.ownerUser = ownerUser;
            return this;
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy