/** * 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_picture.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.genericdomain.domain.DomainObject; import org.bricket.plugin.picture.domain.Picture; 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 UserPicture extends DomainObject { /** * Enumeration of all default user picture types * * @author Henning Teek */ public enum Type { DEFAULT; } @Enumerated(EnumType.ORDINAL) @Column(nullable = false) private Type type; @OneToOne @JoinColumn(nullable = false) private User user; @OneToOne @JoinColumn(nullable = false) private Picture picture; public UserPicture() { } /** * @param user * @param picture */ public UserPicture(User user, Picture picture) { this.user = user; this.picture = picture; 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 user * the user to set */ public void setUser(User user) { this.user = user; } /** * @return the user */ public User getUser() { return user; } /** * @param picture * the picture to set */ public void setPicture(Picture picture) { this.picture = picture; } /** * @return the picture */ public Picture getPicture() { return picture; } }