3838import javax .persistence .PreUpdate ;
3939import javax .persistence .Temporal ;
4040import javax .persistence .TemporalType ;
41+ import javax .validation .Valid ;
42+ import javax .validation .constraints .Size ;
4143import javax .xml .bind .annotation .XmlRootElement ;
4244import org .slf4j .Logger ;
4345import org .slf4j .LoggerFactory ;
@@ -63,10 +65,12 @@ public class DOECodeMetadata implements Serializable {
6365 * Saved - stored to the database without validation
6466 * Submitted - validated to business logic rules, and/or sent to OSTI
6567 * Approved - ready to be sent to SOLR/search services
68+ * Announced - sent to OSTI
6669 */
6770 public enum Status {
6871 Saved ,
6972 Submitted ,
73+ Announced ,
7074 Approved
7175 }
7276
@@ -251,6 +255,7 @@ public Boolean getOpenSource() {
251255 public void setOpenSource (Boolean openSource ) {
252256 this .openSource = openSource ;
253257 }
258+ @ Size (max = 255 , message = "Repository link is limited to 255 characters." )
254259 @ Column (name ="REPOSITORY_LINK" )
255260 public String getRepositoryLink () {
256261 return repositoryLink ;
@@ -287,6 +292,7 @@ public void setAccessLimitations(List<String> limitations) {
287292 */
288293 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
289294 @ JoinColumn (name ="OWNER_ID" , referencedColumnName = "CODE_ID" )
295+ @ Valid
290296 public List <Contributor > getContributors () {
291297 return this .contributors ;
292298 }
@@ -297,6 +303,7 @@ public List<Contributor> getContributors() {
297303 */
298304 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
299305 @ JoinColumn (name ="OWNER_ID" , referencedColumnName = "CODE_ID" )
306+ @ Valid
300307 public List <SponsoringOrganization > getSponsoringOrganizations () {
301308 return this .sponsoringOrganizations ;
302309 }
@@ -307,6 +314,7 @@ public List<SponsoringOrganization> getSponsoringOrganizations() {
307314 */
308315 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
309316 @ JoinColumn (name = "OWNER_ID" , referencedColumnName = "CODE_ID" )
317+ @ Valid
310318 public List <ContributingOrganization > getContributingOrganizations () {
311319 return this .contributingOrganizations ;
312320 }
@@ -317,29 +325,34 @@ public List<ContributingOrganization> getContributingOrganizations() {
317325 */
318326 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
319327 @ JoinColumn (name ="OWNER_ID" , referencedColumnName = "CODE_ID" )
328+ @ Valid
320329 public List <ResearchOrganization > getResearchOrganizations () {
321330 return this .researchOrganizations ;
322331 }
323332
333+ @ Size (max = 1000 , message = "Software title is limited to 1000 characters." )
324334 @ Column (name = "SOFTWARE_TITLE" , length = 1000 )
325335 public String getSoftwareTitle () {
326336 return softwareTitle ;
327337 }
328338 public void setSoftwareTitle (String softwareTitle ) {
329339 this .softwareTitle = softwareTitle ;
330340 }
341+ @ Size (max = 255 , message = "Acronym is limited to 255 characters." )
331342 public String getAcronym () {
332343 return acronym ;
333344 }
334345 public void setAcronym (String acronym ) {
335346 this .acronym = acronym ;
336347 }
348+ @ Size (max = 255 , message = "DOI is limited to 255 characters." )
337349 public String getDoi () {
338350 return doi ;
339351 }
340352 public void setDoi (String doi ) {
341353 this .doi = doi ;
342354 }
355+ @ Size (max = 4000 , message = "Description is limited to 4000 characters." )
343356 @ Column (length = 4000 , name = "description" )
344357 public String getDescription () {
345358 return description ;
@@ -361,20 +374,23 @@ public List<RelatedIdentifier> getRelatedIdentifiers() {
361374 return this .relatedIdentifiers ;
362375 }
363376
377+ @ Size (max = 255 , message = "Country is limited to 255 characters." )
364378 @ Column (name = "COUNTRY_OF_ORIGIN" )
365379 public String getCountryOfOrigin () {
366380 return countryOfOrigin ;
367381 }
368382 public void setCountryOfOrigin (String countryOfOrigin ) {
369383 this .countryOfOrigin = countryOfOrigin ;
370384 }
385+ @ Size (max = 500 , message = "Keywords are limited to 500 characters." )
371386 @ Column (length = 500 )
372387 public String getKeywords () {
373388 return keywords ;
374389 }
375390 public void setKeywords (String keywords ) {
376391 this .keywords = keywords ;
377392 }
393+ @ Size (max = 3000 , message = "Disclaimers are limited to 3000 characters." )
378394 @ Column (length = 3000 )
379395 public String getDisclaimers () {
380396 return disclaimers ;
@@ -396,6 +412,7 @@ public void setLicenses(List<String> licenses) {
396412 }
397413
398414
415+ @ Size (max = 255 , message = "Proprietary URL is limited to 255 characters." )
399416 @ Column (name ="PROPRIETARY_URL" )
400417 public String getProprietaryUrl () {
401418 return proprietaryUrl ;
@@ -411,6 +428,7 @@ public void setProprietaryUrl(String proprietaryUrl) {
411428 */
412429 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
413430 @ JoinColumn (name ="OWNER_ID" , referencedColumnName = "CODE_ID" )
431+ @ Valid
414432 public List <Developer > getDevelopers () {
415433 return developers ;
416434 }
@@ -457,27 +475,31 @@ public void setDevelopers(List<Developer> devlist) {
457475 this .developers = devlist ;
458476 }
459477
478+ @ Size (max = 255 , message = "Recipient name is limited to 255 characters." )
460479 @ Column (name = "RECIPIENT_NAME" )
461480 public String getRecipientName () {
462481 return recipientName ;
463482 }
464483 public void setRecipientName (String recipientName ) {
465484 this .recipientName = recipientName ;
466485 }
486+ @ Size (max = 255 , message = "Recipient email is limited to 255 characters." )
467487 @ Column (name ="RECIPIENT_EMAIL" )
468488 public String getRecipientEmail () {
469489 return recipientEmail ;
470490 }
471491 public void setRecipientEmail (String recipientEmail ) {
472492 this .recipientEmail = recipientEmail ;
473493 }
494+ @ Size (max = 255 , message = "Recipient phone is limited to 255 characters." )
474495 @ Column (name ="RECIPIENT_PHONE" )
475496 public String getRecipientPhone () {
476497 return recipientPhone ;
477498 }
478499 public void setRecipientPhone (String recipientPhone ) {
479500 this .recipientPhone = recipientPhone ;
480501 }
502+ @ Size (max = 255 , message = "Recipient organization is limited to 255 characters." )
481503 @ Column (name = "RECIPIENT_ORGANIZATION" )
482504 public String getRecipientOrg () {
483505 return recipientOrg ;
@@ -486,6 +508,7 @@ public void setRecipientOrg(String recipientOrg) {
486508 this .recipientOrg = recipientOrg ;
487509 }
488510
511+ @ Size (max = 255 , message = "Accession number is limited to 255 characters." )
489512 @ Column (name ="SITE_ACCESSION_NUMBER" )
490513 public String getSiteAccessionNumber () {
491514 return siteAccessionNumber ;
@@ -494,6 +517,7 @@ public void setSiteAccessionNumber(String siteAccessionNumber) {
494517 this .siteAccessionNumber = siteAccessionNumber ;
495518 }
496519
520+ @ Size (max = 1500 , message = "Other special requirements field is limited to 255 characters." )
497521 @ Column (name ="OTHER_SPECIAL_REQUIREMENTS" , length = 1500 )
498522 public String getOtherSpecialRequirements () {
499523 return otherSpecialRequirements ;
@@ -540,6 +564,7 @@ public Date getReleaseDate() {
540564 return this .releaseDate ;
541565 }
542566
567+ @ Size (max = 255 , message = "Landing page URL is limited to 255 characters." )
543568 @ Column (name ="LANDING_PAGE" )
544569 public String getLandingPage () {
545570 return landingPage ;
0 commit comments