| 1 | /** |
|---|
| 2 | * Copyright (C) 2007 EDIT |
|---|
| 3 | * European Distributed Institute of Taxonomy |
|---|
| 4 | * http://www.e-taxonomy.eu |
|---|
| 5 | * |
|---|
| 6 | * The contents of this file are subject to the Mozilla Public License Version 1.1 |
|---|
| 7 | * See LICENSE.TXT at the top of this package for the full license terms. |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | package eu.etaxonomy.cdm.model.media; |
|---|
| 11 | |
|---|
| 12 | import java.net.URI; |
|---|
| 13 | |
|---|
| 14 | import org.apache.log4j.Logger; |
|---|
| 15 | import org.hibernate.envers.Audited; |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | import javax.persistence.*; |
|---|
| 19 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 20 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 21 | import javax.xml.bind.annotation.XmlElement; |
|---|
| 22 | import javax.xml.bind.annotation.XmlRootElement; |
|---|
| 23 | import javax.xml.bind.annotation.XmlType; |
|---|
| 24 | |
|---|
| 25 | /** |
|---|
| 26 | * @author m.doering |
|---|
| 27 | * @version 1.0 |
|---|
| 28 | * @created 08-Nov-2007 13:06:35 |
|---|
| 29 | */ |
|---|
| 30 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 31 | @XmlType(name = "MovieFile", propOrder = { |
|---|
| 32 | "duration" |
|---|
| 33 | }) |
|---|
| 34 | @XmlRootElement(name = "MovieFile") |
|---|
| 35 | @Entity |
|---|
| 36 | @Audited |
|---|
| 37 | public class MovieFile extends MediaRepresentationPart { |
|---|
| 38 | private static final long serialVersionUID = 8650308822737671731L; |
|---|
| 39 | private static final Logger logger = Logger.getLogger(MovieFile.class); |
|---|
| 40 | |
|---|
| 41 | //Length of movie in seconds |
|---|
| 42 | @XmlElement(name = "Duration") |
|---|
| 43 | private int duration; |
|---|
| 44 | |
|---|
| 45 | public static MovieFile NewInstance(URI uri, Integer size){ |
|---|
| 46 | logger.debug("NewInstance"); |
|---|
| 47 | return new MovieFile(uri, size); |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | * Factory method |
|---|
| 52 | * @return |
|---|
| 53 | */ |
|---|
| 54 | public static MovieFile NewInstance(){ |
|---|
| 55 | return new MovieFile(); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | /** |
|---|
| 59 | * Constructor |
|---|
| 60 | */ |
|---|
| 61 | protected MovieFile() { |
|---|
| 62 | super(); |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | /** |
|---|
| 66 | * Constructor |
|---|
| 67 | */ |
|---|
| 68 | protected MovieFile(URI uri, Integer size) { |
|---|
| 69 | super(uri, size); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | /** |
|---|
| 74 | * The Length of the movie in seconds |
|---|
| 75 | * |
|---|
| 76 | * @return |
|---|
| 77 | */ |
|---|
| 78 | public int getDuration(){ |
|---|
| 79 | return this.duration; |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | /** |
|---|
| 83 | * Sets the Length of the movie in seconds |
|---|
| 84 | * @param duration duration |
|---|
| 85 | */ |
|---|
| 86 | public void setDuration(int duration){ |
|---|
| 87 | this.duration = duration; |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | } |
|---|