| 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 | import javax.persistence.*; |
|---|
| 18 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 19 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 20 | import javax.xml.bind.annotation.XmlElement; |
|---|
| 21 | import javax.xml.bind.annotation.XmlRootElement; |
|---|
| 22 | import javax.xml.bind.annotation.XmlType; |
|---|
| 23 | |
|---|
| 24 | /** |
|---|
| 25 | * @author m.doering |
|---|
| 26 | * @version 1.0 |
|---|
| 27 | * @created 08-Nov-2007 13:06:11 |
|---|
| 28 | */ |
|---|
| 29 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 30 | @XmlType(name = "AudioFile", propOrder = { |
|---|
| 31 | "duration" |
|---|
| 32 | }) |
|---|
| 33 | @XmlRootElement(name = "AudioFile") |
|---|
| 34 | @Entity |
|---|
| 35 | @Audited |
|---|
| 36 | public class AudioFile extends MediaRepresentationPart { |
|---|
| 37 | private static final long serialVersionUID = 2327736023969971196L; |
|---|
| 38 | private static final Logger logger = Logger.getLogger(AudioFile.class); |
|---|
| 39 | |
|---|
| 40 | //length of recording in seconds |
|---|
| 41 | @XmlElement(name = "Duration") |
|---|
| 42 | private int duration; |
|---|
| 43 | |
|---|
| 44 | public static AudioFile NewInstance(URI uri, Integer size){ |
|---|
| 45 | logger.debug("NewInstance"); |
|---|
| 46 | return new AudioFile(uri, size); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | /** |
|---|
| 50 | * Factory method |
|---|
| 51 | * @return |
|---|
| 52 | */ |
|---|
| 53 | public static AudioFile NewInstance(){ |
|---|
| 54 | return new AudioFile(); |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | /** |
|---|
| 58 | * Constructor |
|---|
| 59 | */ |
|---|
| 60 | protected AudioFile() { |
|---|
| 61 | super(); |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | * Constructor |
|---|
| 66 | */ |
|---|
| 67 | protected AudioFile(URI uri, Integer size) { |
|---|
| 68 | super(uri, size); |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | public int getDuration(){ |
|---|
| 72 | return this.duration; |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | /** |
|---|
| 76 | * |
|---|
| 77 | * @param duration duration |
|---|
| 78 | */ |
|---|
| 79 | public void setDuration(int duration){ |
|---|
| 80 | this.duration = duration; |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | } |
|---|