001package ball.game.crossword.entity;
002/*-
003 * ##########################################################################
004 * Game Applications and Utilities
005 * $Id: Crossword.java 5285 2020-02-05 04:23:21Z ball $
006 * $HeadURL: svn+ssh://svn.hcf.dev/var/spool/scm/repository.svn/ball-game/trunk/src/main/java/ball/game/crossword/entity/Crossword.java $
007 * %%
008 * Copyright (C) 2010 - 2020 Allen D. Ball
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the "License");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 *
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 *
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an "AS IS" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * ##########################################################################
022 */
023import ball.persistence.entity.AbstractEntity;
024import java.util.ArrayList;
025import java.util.List;
026import javax.persistence.Column;
027import javax.persistence.Entity;
028import javax.persistence.GeneratedValue;
029import javax.persistence.Id;
030import javax.persistence.Lob;
031import javax.persistence.ManyToOne;
032import javax.persistence.OneToMany;
033import javax.persistence.Table;
034import lombok.EqualsAndHashCode;
035import lombok.Getter;
036import lombok.NoArgsConstructor;
037import lombok.Setter;
038import lombok.ToString;
039
040import static javax.persistence.CascadeType.ALL;
041import static javax.persistence.FetchType.LAZY;
042import static javax.persistence.GenerationType.IDENTITY;
043
044/**
045 * {@link Crossword} {@link Entity}.
046 *
047 * {@bean.info}
048 *
049 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball}
050 * @version $Revision: 5285 $
051 */
052@Entity
053@Table(catalog = "crossword", name = "crossword")
054@NoArgsConstructor @EqualsAndHashCode(callSuper = false) @ToString
055public class Crossword extends AbstractEntity {
056    @Id @GeneratedValue(strategy = IDENTITY)
057    private long id = -1;
058
059    @OneToMany(mappedBy = "crossword", cascade = ALL)
060    @Getter @Setter
061    private List<Header> headers = new ArrayList<>();
062
063    @ManyToOne(fetch = LAZY)
064    @Getter @Setter
065    private Grid grid = null;
066
067    @OneToMany(mappedBy = "crossword", cascade = ALL)
068    @Getter @Setter
069    private List<Clue> clues = new ArrayList<>();
070
071    @Column @Lob
072    @Getter @Setter
073    private String notes = null;
074}