root/trunk/cdmlib/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/molecular/GenBankAccession.java

Revision 11867, 2.6 kB (checked in by a.mueller, 13 months ago)

make termbase.uri and GenBankAccession?.uri real java.net.URI #2340

  • 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.molecular;
11
12
13import java.net.URI;
14
15import eu.etaxonomy.cdm.model.common.VersionableEntity;
16import eu.etaxonomy.cdm.validation.Level2;
17import eu.etaxonomy.cdm.validation.annotation.NullOrNotEmpty;
18
19import org.apache.log4j.Logger;
20import org.hibernate.annotations.Type;
21import org.hibernate.envers.Audited;
22import org.hibernate.search.annotations.Field;
23import org.hibernate.validator.constraints.Length;
24
25import javax.persistence.*;
26import javax.validation.constraints.Pattern;
27import javax.xml.bind.annotation.XmlAccessType;
28import javax.xml.bind.annotation.XmlAccessorType;
29import javax.xml.bind.annotation.XmlElement;
30import javax.xml.bind.annotation.XmlRootElement;
31import javax.xml.bind.annotation.XmlType;
32
33/**
34 * @author m.doering
35 * @version 1.0
36 * @created 08-Nov-2007 13:06:25
37 */
38@XmlAccessorType(XmlAccessType.FIELD)
39@XmlType(name = "GenBankAccession", propOrder = {
40    "accessionNumber",
41    "uri"
42})
43@XmlRootElement(name = "GenBankAccession")
44@Entity
45@Audited
46public class GenBankAccession extends VersionableEntity {
47        private static final long serialVersionUID = -8179493118062601585L;
48        private static final Logger logger = Logger.getLogger(GenBankAccession.class);
49       
50        @XmlElement(name = "AccessionNumber")
51        private String accessionNumber;
52       
53        @XmlElement(name = "URI")
54        @Field(index=org.hibernate.search.annotations.Index.UN_TOKENIZED)
55        @NullOrNotEmpty
56        @Length(max = 255)
57        @Pattern(regexp = "^([a-z0-9+.-]+):(?://(?:((?:[a-z0-9-._~!$&'()*+,;=:]|%[0-9A-F]{2})*)@)?((?:[a-z0-9-._~!$&'()*+,;=]|%[0-9A-F]{2})*)(?::(\\d*))?(/(?:[a-z0-9-._~!$&'()*+,;=:@/]|%[0-9A-F]{2})*)?|(/?(?:[a-z0-9-._~!$&'()*+,;=:@]|%[0-9A-F]{2})+(?:[a-z0-9-._~!$&'()*+,;=:@/]|%[0-9A-F]{2})*)?)(?:\\?((?:[a-z0-9-._~!$&'()*+,;=:/?@]|%[0-9A-F]{2})*))?(?:#((?:[a-z0-9-._~!$&'()*+,;=:/?@]|%[0-9A-F]{2})*))?$", groups = Level2.class, message = "{eu.etaxonomy.cdm.model.reference.Reference.uri.message}") 
58        @Type(type="uriUserType")
59        private URI uri;
60       
61        public String getAccessionNumber(){
62                logger.debug("getAccessionNumber");
63                return this.accessionNumber;
64        }
65
66        /**
67         *
68         * @param accessionNumber    accessionNumber
69         */
70        public void setAccessionNumber(String accessionNumber){
71                this.accessionNumber = accessionNumber;
72        }
73
74        public URI getUri(){
75                return this.uri;
76        }
77
78        /**
79         *
80         * @param uri    uri
81         */
82        public void setUri(URI uri){
83                this.uri = uri;
84        }
85
86}
Note: See TracBrowser for help on using the browser.