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
@@ -270,6 +274,7 @@ public Boolean getOpenSource() {
270274 public void setOpenSource (Boolean openSource ) {
271275 this .openSource = openSource ;
272276 }
277+ @ Size (max = 255 , message = "Repository link is limited to 255 characters." )
273278 @ Column (name ="REPOSITORY_LINK" )
274279 public String getRepositoryLink () {
275280 return repositoryLink ;
@@ -306,6 +311,7 @@ public void setAccessLimitations(List<String> limitations) {
306311 */
307312 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
308313 @ JoinColumn (name ="OWNER_ID" , referencedColumnName = "CODE_ID" )
314+ @ Valid
309315 public List <Contributor > getContributors () {
310316 return this .contributors ;
311317 }
@@ -316,6 +322,7 @@ public List<Contributor> getContributors() {
316322 */
317323 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
318324 @ JoinColumn (name ="OWNER_ID" , referencedColumnName = "CODE_ID" )
325+ @ Valid
319326 public List <SponsoringOrganization > getSponsoringOrganizations () {
320327 return this .sponsoringOrganizations ;
321328 }
@@ -326,6 +333,7 @@ public List<SponsoringOrganization> getSponsoringOrganizations() {
326333 */
327334 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
328335 @ JoinColumn (name = "OWNER_ID" , referencedColumnName = "CODE_ID" )
336+ @ Valid
329337 public List <ContributingOrganization > getContributingOrganizations () {
330338 return this .contributingOrganizations ;
331339 }
@@ -336,29 +344,34 @@ public List<ContributingOrganization> getContributingOrganizations() {
336344 */
337345 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
338346 @ JoinColumn (name ="OWNER_ID" , referencedColumnName = "CODE_ID" )
347+ @ Valid
339348 public List <ResearchOrganization > getResearchOrganizations () {
340349 return this .researchOrganizations ;
341350 }
342351
352+ @ Size (max = 1000 , message = "Software title is limited to 1000 characters." )
343353 @ Column (name = "SOFTWARE_TITLE" , length = 1000 )
344354 public String getSoftwareTitle () {
345355 return softwareTitle ;
346356 }
347357 public void setSoftwareTitle (String softwareTitle ) {
348358 this .softwareTitle = softwareTitle ;
349359 }
360+ @ Size (max = 255 , message = "Acronym is limited to 255 characters." )
350361 public String getAcronym () {
351362 return acronym ;
352363 }
353364 public void setAcronym (String acronym ) {
354365 this .acronym = acronym ;
355366 }
367+ @ Size (max = 255 , message = "DOI is limited to 255 characters." )
356368 public String getDoi () {
357369 return doi ;
358370 }
359371 public void setDoi (String doi ) {
360372 this .doi = doi ;
361373 }
374+ @ Size (max = 4000 , message = "Description is limited to 4000 characters." )
362375 @ Column (length = 4000 , name = "description" )
363376 public String getDescription () {
364377 return description ;
@@ -380,20 +393,23 @@ public List<RelatedIdentifier> getRelatedIdentifiers() {
380393 return this .relatedIdentifiers ;
381394 }
382395
396+ @ Size (max = 255 , message = "Country is limited to 255 characters." )
383397 @ Column (name = "COUNTRY_OF_ORIGIN" )
384398 public String getCountryOfOrigin () {
385399 return countryOfOrigin ;
386400 }
387401 public void setCountryOfOrigin (String countryOfOrigin ) {
388402 this .countryOfOrigin = countryOfOrigin ;
389403 }
404+ @ Size (max = 500 , message = "Keywords are limited to 500 characters." )
390405 @ Column (length = 500 )
391406 public String getKeywords () {
392407 return keywords ;
393408 }
394409 public void setKeywords (String keywords ) {
395410 this .keywords = keywords ;
396411 }
412+ @ Size (max = 3000 , message = "Disclaimers are limited to 3000 characters." )
397413 @ Column (length = 3000 )
398414 public String getDisclaimers () {
399415 return disclaimers ;
@@ -415,6 +431,7 @@ public void setLicenses(List<String> licenses) {
415431 }
416432
417433
434+ @ Size (max = 255 , message = "Proprietary URL is limited to 255 characters." )
418435 @ Column (name ="PROPRIETARY_URL" )
419436 public String getProprietaryUrl () {
420437 return proprietaryUrl ;
@@ -430,6 +447,7 @@ public void setProprietaryUrl(String proprietaryUrl) {
430447 */
431448 @ OneToMany (cascade = CascadeType .ALL , orphanRemoval = true )
432449 @ JoinColumn (name ="OWNER_ID" , referencedColumnName = "CODE_ID" )
450+ @ Valid
433451 public List <Developer > getDevelopers () {
434452 return developers ;
435453 }
@@ -476,27 +494,31 @@ public void setDevelopers(List<Developer> devlist) {
476494 this .developers = devlist ;
477495 }
478496
497+ @ Size (max = 255 , message = "Recipient name is limited to 255 characters." )
479498 @ Column (name = "RECIPIENT_NAME" )
480499 public String getRecipientName () {
481500 return recipientName ;
482501 }
483502 public void setRecipientName (String recipientName ) {
484503 this .recipientName = recipientName ;
485504 }
505+ @ Size (max = 255 , message = "Recipient email is limited to 255 characters." )
486506 @ Column (name ="RECIPIENT_EMAIL" )
487507 public String getRecipientEmail () {
488508 return recipientEmail ;
489509 }
490510 public void setRecipientEmail (String recipientEmail ) {
491511 this .recipientEmail = recipientEmail ;
492512 }
513+ @ Size (max = 255 , message = "Recipient phone is limited to 255 characters." )
493514 @ Column (name ="RECIPIENT_PHONE" )
494515 public String getRecipientPhone () {
495516 return recipientPhone ;
496517 }
497518 public void setRecipientPhone (String recipientPhone ) {
498519 this .recipientPhone = recipientPhone ;
499520 }
521+ @ Size (max = 255 , message = "Recipient organization is limited to 255 characters." )
500522 @ Column (name = "RECIPIENT_ORGANIZATION" )
501523 public String getRecipientOrg () {
502524 return recipientOrg ;
@@ -505,6 +527,7 @@ public void setRecipientOrg(String recipientOrg) {
505527 this .recipientOrg = recipientOrg ;
506528 }
507529
530+ @ Size (max = 255 , message = "Accession number is limited to 255 characters." )
508531 @ Column (name ="SITE_ACCESSION_NUMBER" )
509532 public String getSiteAccessionNumber () {
510533 return siteAccessionNumber ;
@@ -513,6 +536,7 @@ public void setSiteAccessionNumber(String siteAccessionNumber) {
513536 this .siteAccessionNumber = siteAccessionNumber ;
514537 }
515538
539+ @ Size (max = 1500 , message = "Other special requirements field is limited to 255 characters." )
516540 @ Column (name ="OTHER_SPECIAL_REQUIREMENTS" , length = 1500 )
517541 public String getOtherSpecialRequirements () {
518542 return otherSpecialRequirements ;
@@ -559,6 +583,7 @@ public Date getReleaseDate() {
559583 return this .releaseDate ;
560584 }
561585
586+ @ Size (max = 255 , message = "Landing page URL is limited to 255 characters." )
562587 @ Column (name ="LANDING_PAGE" )
563588 public String getLandingPage () {
564589 return landingPage ;
0 commit comments