/* Copyright 2006 - 2010 Under Dusken 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 no.dusken.aranea.model; import javax.persistence.*; import javax.validation.constraints.Size; @Entity @Table(name = "page_image", uniqueConstraints = @UniqueConstraint(columnNames = { "page_ID", "image_ID"})) @SequenceGenerator(name = "page_image_seq", sequenceName = "page_image_id_seq") public class PageImage extends AraneaObject { @ManyToOne @JoinColumn(nullable = false) private Page page; @ManyToOne @JoinColumn(nullable = false) private Image image; @Column(length = 1000, nullable = true) @Size(max = 1000) private String text; @Column(nullable = false) private Integer paragraph = 1; public PageImage() {} public PageImage(Page page, Image image, String description, Integer paragraph) { this.page = page; this.image = image; this.text = description; this.paragraph = paragraph; } public String toString() { return "PageImage{" + "image=" + getImage() + ", text='" + getText() + '\'' + '}'; } public Page getPage() { return page; } public void setPage(Page page) { this.page = page; } public Image getImage() { return image; } public void setImage(Image image) { this.image = image; } public String getText() { return text; } public void setText(String text) { this.text = text; } public Integer getParagraph() { return paragraph; } public void setParagraph(Integer paragraph) { this.paragraph = paragraph; } }