/** * Copyright 2011 the original author or authors. * * 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.bricket.plugin.user_gallery.domain; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import org.bricket.plugin.gallery.domain.Gallery; import org.bricket.plugin.genericdomain.domain.DomainObject; import org.bricket.plugin.user.domain.User; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; /** * @author Ingo Renner * @author Henning Teek * */ @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) @Entity public class UserGallery extends DomainObject { /** * Enumeration of all default gallery user types * * @author Henning Teek */ public enum Type { DEFAULT; } @Enumerated(EnumType.ORDINAL) @Column(nullable = false) private Type type; @OneToOne @JoinColumn(nullable = false) private Gallery gallery; @OneToOne @JoinColumn(nullable = false) private User user; public UserGallery() { } /** * @param gallery * @param user */ public UserGallery(Gallery gallery, User user) { this.gallery = gallery; this.user = user; this.type = Type.DEFAULT; } /** * @param type * the type to set */ public void setType(Type type) { this.type = type; } /** * @return the type */ public Type getType() { return type; } /** * @param gallery * the gallery to set */ public void setGallery(Gallery gallery) { this.gallery = gallery; } /** * @return the gallery */ public Gallery getGallery() { return gallery; } /** * @param user * the user to set */ public void setUser(User user) { this.user = user; } /** * @return the user */ public User getUser() { return user; } }