Project

General

Profile

« Previous | Next » 

Revision db415600

Added by Katja Luther almost 13 years ago

moved all validation tests to model, except ValidationTest
wrote validation for references

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/Reference.java
22 22
import javax.persistence.Lob;
23 23
import javax.persistence.ManyToOne;
24 24
import javax.persistence.Transient;
25
import javax.validation.constraints.NotNull;
25 26
import javax.validation.constraints.Pattern;
26 27
import javax.xml.bind.annotation.XmlAccessType;
27 28
import javax.xml.bind.annotation.XmlAccessorType;
......
63 64
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
64 65
import eu.etaxonomy.cdm.validation.Level2;
65 66
import eu.etaxonomy.cdm.validation.annotation.NullOrNotEmpty;
67
import eu.etaxonomy.cdm.validation.annotation.InReference;
66 68

  
67 69
/**
68 70
 * The upmost (abstract) class for references (information sources). 
......
109 111
@Audited
110 112
@javax.persistence.Table(name="Reference")
111 113
@Table(appliesTo="Reference", indexes = { @org.hibernate.annotations.Index(name = "ReferenceTitleCacheIndex", columnNames = { "titleCache" }) })
112
//@InReference(groups = Level2.class)
114
@InReference(groups = Level2.class)
113 115
//public abstract class Reference<S extends IReferenceBaseCacheStrategy> extends IdentifiableMediaEntity<S> implements IParsable, IMergable, IMatchable, IArticle, IBook, IJournal, IBookSection,ICdDvd,IGeneric,IInProceedings, IProceedings, IPrintSeries, IReport, IThesis,IWebPage {
114 116
public class Reference<S extends IReferenceBaseCacheStrategy> extends IdentifiableMediaEntity<S> implements INomenclaturalReference, IArticle, IBook, IPatent, IDatabase, IJournal, IBookSection,ICdDvd,IGeneric,IInProceedings, IProceedings, IPrintSeries, IReport, IThesis,IWebPage, IPersonalCommunication, IReference, Cloneable {
115 117
	private static final long serialVersionUID = -2034764545042691295L;
......
125 127
	@Lob
126 128
	@Field(index=Index.TOKENIZED)
127 129
	@Match(MatchMode.EQUAL_REQUIRED)
128
	@NullOrNotEmpty
130
	@NullOrNotEmpty(groups = Level2.class)
129 131
	@Length(max = 4096)
130 132
	private String title;
131 133
	
......
224 226

  
225 227
//    @IndexedEmbedded
226 228
    @Cascade(CascadeType.SAVE_UPDATE)
227
    //@InReference(groups=Level2.class)
229
    @InReference(groups=Level2.class)
228 230
   	protected Reference inReference;
229 231
    
230 232
//    @XmlElement(name = "FullReference")
......
260 262
	@Length(max = 65536)
261 263
	private String referenceAbstract;  //abstract is a reserved term in Java
262 264
	
265
	
263 266
	//URIs like DOIs, LSIDs or Handles for this reference
264 267
	@XmlElement(name = "URI")
265 268
	@Field(index=org.hibernate.search.annotations.Index.UN_TOKENIZED)
266
	@NullOrNotEmpty
267
	@Length(max = 255)
268
	//TODO still needed since it is a java.net.URI now??
269
	@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}") 
269
	
270 270
	@Type(type="uriUserType")
271 271
	private URI uri;
272 272
	

Also available in: Unified diff