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

com.github.gentity.demogallery.User 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.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "USER")
public class User implements Serializable
{

    @Id
    @Column(name = "ID", length = 36)
    protected String id;
    @Column(name = "USERNAME", length = 40, nullable = false)
    protected String username;
    @Column(name = "FIRST_NAME", length = 100)
    protected String firstName;
    @Column(name = "LAST_NAME", length = 100)
    protected String lastName;
    @OneToMany(mappedBy = "iconUser")
    protected List picture = new ArrayList();
    @OneToMany(mappedBy = "ownerUser")
    protected List gallery = new ArrayList();
    @ManyToMany
    @JoinTable(name = "USER_ROLE", joinColumns = {
        @JoinColumn(name = "USER_ID", referencedColumnName = "ID")
    })
    protected List role = new ArrayList();
    @ManyToMany
    @JoinTable(name = "USER_GROUP", joinColumns = {
        @JoinColumn(name = "USER_ID", referencedColumnName = "ID")
    })
    protected List group = new ArrayList();

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

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public List getPicture() {
        return picture;
    }

    public void setPicture(List picture) {
        this.picture = picture;
    }

    public List getGallery() {
        return gallery;
    }

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

    public List getRole() {
        return role;
    }

    public void setRole(List role) {
        this.role = role;
    }

    public List getGroup() {
        return group;
    }

    public void setGroup(List group) {
        this.group = group;
    }

    public static class Builder {

        private final User instance = new User();

        public User build() {
            return instance;
        }

        public User.Builder id(String id) {
            instance.id = id;
            return this;
        }

        public User.Builder username(String username) {
            instance.username = username;
            return this;
        }

        public User.Builder firstName(String firstName) {
            instance.firstName = firstName;
            return this;
        }

        public User.Builder lastName(String lastName) {
            instance.lastName = lastName;
            return this;
        }

        public User.Builder picture(List picture) {
            instance.picture = picture;
            return this;
        }

        public User.Builder gallery(List gallery) {
            instance.gallery = gallery;
            return this;
        }

        public User.Builder role(List role) {
            instance.role = role;
            return this;
        }

        public User.Builder group(List group) {
            instance.group = group;
            return this;
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy