1 23 24 package org.infoglue.cms.entities.publishing; 25 26 import java.util.ArrayList ; 27 import java.util.Date ; 28 import java.util.List ; 29 30 import org.infoglue.cms.entities.kernel.BaseEntityVO; 31 import org.infoglue.cms.entities.kernel.ValidatableEntityVO; 32 import org.infoglue.cms.entities.publishing.impl.simple.PublicationImpl; 33 import org.infoglue.cms.util.validators.ConstraintRule; 34 import org.infoglue.cms.util.validators.Range; 35 36 40 public class PublicationVO extends ValidatableEntityVO implements BaseEntityVO 41 { 42 private Integer publicationId; 43 private Integer repositoryId; 44 private String name; 45 private String description = "No description";; 46 private Date publicationDateTime; 47 private String publisher = null; 48 private List publicationDetails = new ArrayList (); 49 50 public Integer getId() 51 { 52 return getPublicationId(); 53 } 54 55 public Integer getPublicationId() 56 { 57 return this.publicationId; 58 } 59 60 public void setPublicationId(Integer publicationId) 61 { 62 this.publicationId = publicationId; 63 } 64 65 public Integer getRepositoryId() 66 { 67 return repositoryId; 68 } 69 70 public void setRepositoryId(Integer repositoryId) 71 { 72 this.repositoryId = repositoryId; 73 } 74 75 public String getName() 76 { 77 return this.name; 78 } 79 80 public void setName(String name) 81 { 82 this.name = name; 83 } 84 85 public String getDescription() 86 { 87 return this.description; 88 } 89 90 public void setDescription(String description) 91 { 92 if(description != null && !description.equals("")) 93 this.description = description; 94 } 95 96 public Date getPublicationDateTime() 97 { 98 return this.publicationDateTime; 99 } 100 101 public void setPublicationDateTime(Date publicationDateTime) 102 { 103 this.publicationDateTime = publicationDateTime; 104 } 105 106 public String getPublisher() 107 { 108 return this.publisher; 109 } 110 111 public void setPublisher(String publisher) 112 { 113 this.publisher = publisher; 114 } 115 116 public List getPublicationDetails() 117 { 118 return publicationDetails; 119 } 120 121 public void setPublicationDetails(List c) 122 { 123 publicationDetails = (c != null)? c : new ArrayList (); 124 } 125 126 public void PrepareValidation() 127 { 128 135 rules.setEntityClass(PublicationImpl.class); 141 142 ConstraintRule cr = new ConstraintRule(org.infoglue.cms.util.validators.Constants.STRING, "Publication.name"); 145 146 cr.setValidRange(new Range(2, 50) ); 148 cr.unique=true; cr.required=true; cr.setValue(name); 151 152 rules.addRule(cr); 154 155 cr = new ConstraintRule(org.infoglue.cms.util.validators.Constants.STRING, "Publication.description"); 158 159 cr.setValidRange(new Range(2, 50) ); 161 cr.unique=false; cr.required=true; cr.setValue(description); 164 165 rules.addRule(cr); 167 } 168 } 169 170 | Popular Tags |