root/trunk/cdmlib/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/Figure.java

Revision 12706, 2.0 kB (checked in by a.mueller, 9 months ago)

change name of ReferencedMedia? to ReferencedMediaBase? (#2381)

  • Property svn:keywords set to Id
Line 
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
10package eu.etaxonomy.cdm.model.common;
11
12
13import java.net.URI;
14
15import org.apache.log4j.Logger;
16import org.hibernate.envers.Audited;
17
18import eu.etaxonomy.cdm.model.media.ImageFile;
19import eu.etaxonomy.cdm.model.media.Media;
20import eu.etaxonomy.cdm.model.media.MediaRepresentation;
21import eu.etaxonomy.cdm.model.media.ReferencedMediaBase;
22
23import javax.persistence.*;
24import javax.xml.bind.annotation.XmlAccessType;
25import javax.xml.bind.annotation.XmlAccessorType;
26import javax.xml.bind.annotation.XmlType;
27
28/**
29 * @author m.doering
30 * @version 1.0
31 * @created 08-Nov-2007 13:06:25
32 */
33@XmlAccessorType(XmlAccessType.FIELD)
34@XmlType(name = "Figure")
35@Entity
36@Audited
37public class Figure extends ReferencedMediaBase {
38        private static final long serialVersionUID = -1712467725277327725L;
39        @SuppressWarnings("unused")
40        private static final Logger logger = Logger.getLogger(Figure.class);
41       
42        /**
43         * Factory method
44         * @return
45         */
46        public static Figure NewInstance(){
47                return new Figure();
48        }
49       
50    /**
51     * Factory method which creates a new figure, adds a reprsentation including mime type and suffix information
52     * and adds to the later a representation part for a given uri and size
53     * Returns <code>null</code> if uri is empty
54     * @return Media
55     */
56   public static Media NewInstance(URI uri, Integer size, String mimeType, String suffix){
57        MediaRepresentation representation = MediaRepresentation.NewInstance(mimeType, suffix, uri, size, ImageFile.class);
58        if (representation == null){
59            return null;
60        }
61        Figure figure = Figure.NewInstance();
62        figure.addRepresentation(representation);
63        return figure;
64    }
65       
66        /**
67         * Constructor
68         */
69        protected Figure() {
70                super();
71        }
72       
73}
Note: See TracBrowser for help on using the browser.