| 1 31 32 package org.opencms.setup.xml; 33 34 import org.opencms.configuration.CmsConfigurationManager; 35 import org.opencms.configuration.CmsSystemConfiguration; 36 37 import java.util.Collections ; 38 import java.util.List ; 39 40 import org.dom4j.Document; 41 import org.dom4j.Node; 42 43 52 public class CmsXmlAddContentNotification extends A_CmsSetupXmlUpdate { 53 54 55 private List m_xpaths; 56 57 60 public String getName() { 61 62 return "Add new Content Notification feature"; 63 } 64 65 68 public String getXmlFilename() { 69 70 return CmsSystemConfiguration.DEFAULT_XML_FILE_NAME; 71 } 72 73 76 protected boolean executeUpdate(Document document, String xpath) { 77 78 Node node = document.selectSingleNode(xpath); 79 if (node == null) { 80 if (xpath.equals(getXPathsToUpdate().get(0))) { 81 CmsSetupXmlHelper.setValue(document, xpath + "/" + CmsSystemConfiguration.N_NOTIFICATION_TIME, "365"); 82 CmsSetupXmlHelper.setValue( 83 document, 84 xpath + "/" + CmsSystemConfiguration.N_NOTIFICATION_PROJECT, 85 "Offline"); 86 } 87 return true; 88 } 89 return false; 90 } 91 92 95 protected String getCommonPath() { 96 97 return new StringBuffer ("/").append(CmsConfigurationManager.N_ROOT).append("/").append( 99 CmsSystemConfiguration.N_SYSTEM).toString(); 100 } 101 102 105 protected List getXPathsToUpdate() { 106 107 if (m_xpaths == null) { 108 StringBuffer xp = new StringBuffer (256); 110 xp.append("/").append(CmsConfigurationManager.N_ROOT); 111 xp.append("/").append(CmsSystemConfiguration.N_SYSTEM); 112 xp.append("/").append(CmsSystemConfiguration.N_CONTENT_NOTIFICATION); 113 m_xpaths = Collections.singletonList(xp.toString()); 114 } 115 return m_xpaths; 116 } 117 118 } | Popular Tags |