![]() |
|||
PovDocumentHtml.javaGo to the documentation of this file.00001 package org.net2map.pov.documentsManager; 00002 00003 import java.io.Serializable; 00004 import java.util.Iterator; 00005 00006 import org.apache.lucene.document.Document; 00007 import org.apache.lucene.document.DateField; 00008 00010 public class PovDocumentHtml extends PovDocument implements Serializable 00011 { 00012 private String sTitle; 00013 private String sSummary; 00014 00016 public PovDocumentHtml() 00017 { 00018 } 00019 00021 public String getTitle() 00022 { 00023 return sTitle; 00024 } 00025 00027 public void setTitle( String title ) 00028 { 00029 sTitle = title; 00030 } 00031 00033 public String getSummary() 00034 { 00035 return sSummary; 00036 } 00037 00039 public void setSummary( String summary ) 00040 { 00041 sSummary = summary; 00042 } 00043 00045 public void initialize(Document lucenedoc) 00046 { 00047 setUrl( lucenedoc.get( "url" ) ); 00048 setLastModified( DateField.stringToDate( lucenedoc.get( "modified" ) ) ); 00049 setTitle( lucenedoc.get( "title" ) ); 00050 setSummary( lucenedoc.get( "summary" ) ); 00051 } 00052 00054 public String toString() 00055 { 00056 String result = "\t"; 00057 if ( getTitle() != "" ) 00058 { 00059 result = getTitle(); 00060 } 00061 else 00062 { 00063 result = "No title"; 00064 } 00065 result += "\n\tUrl\t : " + getUrl(); 00066 result += "\n\tSummary\t : " + getSummary(); 00067 result += "\n\tModified : " + getLastModified(); 00068 result += "\n\t" + getCriteriasValues().toString() + "\n"; 00069 00070 return result; 00071 } 00072 00074 public String toXml() 00075 { 00076 String result = ""; 00077 String criteria = ""; 00078 result = "<Document>\n"; 00079 result += "<Url>" + getUrl() + "</Url>\n"; 00080 result += "<LastModified>" + DateField.dateToString( getLastModified() ) + "</LastModified>\n"; 00081 result += "<Title>" + getTitle() + "</Title>\n"; 00082 result += "<Summary>" + getSummary() + "</Summary>\n"; 00083 00084 Iterator it = getCriteriasValues().keySet().iterator(); 00085 while ( it.hasNext() ) 00086 { 00087 criteria = it.next().toString(); 00088 result += "<Criteria>"; 00089 result += "<Name>" + criteria + "</Name>"; 00090 result += "<Value>" + getCriteriasValues().get( criteria ) + "</Value>"; 00091 result += "</Criteria>\n"; 00092 } 00093 result += "</Document>\n"; 00094 return result; 00095 } 00096 } |
|||
|
Accueil | Téléchargement | Manuel
| Doc. technique | Sources CVS |
Faq | Nous contacter
©2003 - All Rights Reserved |
|||