| 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.molecular; |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | import java.net.URI; |
|---|
| 14 | |
|---|
| 15 | import eu.etaxonomy.cdm.model.common.VersionableEntity; |
|---|
| 16 | import eu.etaxonomy.cdm.validation.Level2; |
|---|
| 17 | import eu.etaxonomy.cdm.validation.annotation.NullOrNotEmpty; |
|---|
| 18 | |
|---|
| 19 | import org.apache.log4j.Logger; |
|---|
| 20 | import org.hibernate.annotations.Type; |
|---|
| 21 | import org.hibernate.envers.Audited; |
|---|
| 22 | import org.hibernate.search.annotations.Field; |
|---|
| 23 | import org.hibernate.validator.constraints.Length; |
|---|
| 24 | |
|---|
| 25 | import javax.persistence.*; |
|---|
| 26 | import javax.validation.constraints.Pattern; |
|---|
| 27 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 28 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 29 | import javax.xml.bind.annotation.XmlElement; |
|---|
| 30 | import javax.xml.bind.annotation.XmlRootElement; |
|---|
| 31 | import 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 |
|---|
| 46 | public 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 | } |
|---|