1 31 32 package org.opencms.validation; 33 34 import org.opencms.i18n.CmsMessages; 35 36 import java.util.Date ; 37 import java.util.Iterator ; 38 import java.util.Locale ; 39 import java.util.Map ; 40 import java.util.Map.Entry; 41 42 51 public class CmsPointerLinkValidationResult { 52 53 54 private Map m_brokenLinks; 55 56 57 private Date m_validationDate; 58 59 64 public CmsPointerLinkValidationResult(Map brokenLinks) { 65 66 m_brokenLinks = brokenLinks; 67 m_validationDate = new Date (); 68 } 69 70 77 public String toHtml(Locale locale) { 78 79 CmsMessages mg = Messages.get().getBundle(locale); 80 if (m_brokenLinks.size() > 0) { 81 StringBuffer result = new StringBuffer (1024); 82 Iterator brokenLinks = m_brokenLinks.entrySet().iterator(); 83 result.append(mg.key(Messages.GUI_LINK_VALIDATION_RESULTS_INTRO_1, new Object [] {m_validationDate})).append( 84 "<ul>"); 85 while (brokenLinks.hasNext()) { 86 Entry link = (Map.Entry )brokenLinks.next(); 87 String linkPath = (String )link.getKey(); 88 String linkUrl = (String )link.getValue(); 89 String msg = mg.key(Messages.GUI_LINK_POINTING_TO_2, new Object [] {linkPath, linkUrl}); 90 result.append("<li>").append(msg).append("</li>"); 91 } 92 return result.append("</ul>").toString(); 93 } else { 94 return mg.key(Messages.GUI_LINK_VALIDATION_RESULTS_ALL_VALID_1, new Object [] {m_validationDate}); 95 } 96 } 97 } | Popular Tags |