1 16 package org.outerj.daisy.books.store; 17 18 import org.outerx.daisy.x10Bookstoremeta.PublicationsInfoDocument; 19 20 import java.util.Date ; 21 import java.util.GregorianCalendar ; 22 23 27 public final class PublicationInfo { 28 private final String name; 29 private final String label; 30 private final String startResource; 31 private final long publishedBy; 32 private final Date publishedOn; 33 private String bookPackage; 34 35 public PublicationInfo(String name, String label, String startResource, String bookPackage, long publishedBy, Date publishedOn) { 36 if (name == null) 37 throw new IllegalArgumentException ("name argument can not be null"); 38 if (label == null) 39 throw new IllegalArgumentException ("label argument can not be null"); 40 if (startResource == null) 41 throw new IllegalArgumentException ("startResource argument can not be null"); 42 if (publishedOn == null) 43 throw new IllegalArgumentException ("publishedOn argument can not be null"); 44 45 this.name = name; 46 this.label = label; 47 this.startResource = startResource; 48 this.bookPackage = bookPackage; 49 this.publishedBy = publishedBy; 50 this.publishedOn = publishedOn; 51 } 52 53 public String getName() { 54 return name; 55 } 56 57 public String getLabel() { 58 return label; 59 } 60 61 public String getStartResource() { 62 return startResource; 63 } 64 65 public String getBookPackage() { 66 return bookPackage; 67 } 68 69 public long getPublishedBy() { 70 return publishedBy; 71 } 72 73 public Date getPublishedOn() { 74 return (Date )publishedOn.clone(); 75 } 76 77 public PublicationsInfoDocument.PublicationsInfo.PublicationInfo getXml() { 78 PublicationsInfoDocument.PublicationsInfo.PublicationInfo infoXml = PublicationsInfoDocument.PublicationsInfo.PublicationInfo.Factory.newInstance(); 79 infoXml.setName(name); 80 infoXml.setLabel(label); 81 infoXml.setStartResource(startResource); 82 if (bookPackage != null) 83 infoXml.setPackage(bookPackage); 84 infoXml.setPublishedBy(publishedBy); 85 GregorianCalendar calendar = new GregorianCalendar (); 86 calendar.setTime(publishedOn); 87 infoXml.setPublishedOn(calendar); 88 return infoXml; 89 } 90 } 91 | Popular Tags |