/* * Computoser is a music-composition algorithm and a website to present the results * Copyright (C) 2012-2014 Bozhidar Bozhanov * * Computoser is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * Computoser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Computoser. If not, see <http://www.gnu.org/licenses/>. */ package com.music.model.persistent; import java.math.BigDecimal; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; /** * A manually curated pack for download by customers * @author Bozhidar * */ @Entity public class PiecePack { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "id", columnDefinition = "INT(11) UNSIGNED") private Long id; @ManyToMany(fetch=FetchType.EAGER) @JoinTable(name="PiecePackPieces", joinColumns=@JoinColumn(name="piecePackId"), inverseJoinColumns=@JoinColumn(name="pieceId")) private Set<Piece> pieces; @Column private BigDecimal price = BigDecimal.ZERO; @Column private String name; @Column private String description; @Column(nullable=false) private int priority; @Column(nullable=false) private int downloads; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Set<Piece> getPieces() { return pieces; } public void setPieces(Set<Piece> pieces) { this.pieces = pieces; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public int getPriority() { return priority; } public void setPriority(int priority) { this.priority = priority; } public int getDownloads() { return downloads; } public void setDownloads(int downloads) { this.downloads = downloads; } }