KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > setup > xml > CmsXmlAddPublishButtonAppearance


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/setup/xml/CmsXmlAddPublishButtonAppearance.java,v $
3  * Date : $Date: 2006/03/27 14:52:44 $
4  * Version: $Revision: 1.2 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.setup.xml;
33
34 import org.opencms.configuration.CmsConfigurationManager;
35 import org.opencms.configuration.CmsWorkplaceConfiguration;
36
37 import java.util.Collections JavaDoc;
38 import java.util.List JavaDoc;
39
40 import org.dom4j.Document;
41 import org.dom4j.Node;
42
43 /**
44  * Adds the new publish button appearance node.<p>
45  *
46  * @author Michael Moossen
47  *
48  * @version $Revision: 1.2 $
49  *
50  * @since 6.1.8
51  */

52 public class CmsXmlAddPublishButtonAppearance extends A_CmsXmlWorkplace {
53
54     /** List of xpaths to update. */
55     private List JavaDoc m_xpaths;
56
57     /**
58      * @see org.opencms.setup.xml.I_CmsSetupXmlUpdate#getName()
59      */

60     public String JavaDoc getName() {
61
62         return "Add new Publish button appearance node";
63     }
64
65     /**
66      * @see org.opencms.setup.xml.A_CmsSetupXmlUpdate#executeUpdate(org.dom4j.Document, java.lang.String)
67      */

68     protected boolean executeUpdate(Document document, String JavaDoc xpath) {
69
70         Node node = document.selectSingleNode(xpath);
71         if (node == null) {
72             CmsSetupXmlHelper.setValue(document, xpath, "always");
73             return true;
74         }
75         return false;
76     }
77
78     /**
79      * @see org.opencms.setup.xml.A_CmsSetupXmlUpdate#getCommonPath()
80      */

81     protected String JavaDoc getCommonPath() {
82
83         // /opencms/workplace/default-preferences/workplace-preferences/workplace-generaloptions
84
StringBuffer JavaDoc xp = new StringBuffer JavaDoc(256);
85         xp.append("/").append(CmsConfigurationManager.N_ROOT);
86         xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACE);
87         xp.append("/").append(CmsWorkplaceConfiguration.N_DEFAULTPREFERENCES);
88         xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACEPREFERENCES);
89         xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS);
90         return xp.toString();
91     }
92
93     /**
94      * @see org.opencms.setup.xml.A_CmsSetupXmlUpdate#getXPathsToUpdate()
95      */

96     protected List JavaDoc getXPathsToUpdate() {
97
98         if (m_xpaths == null) {
99             // /opencms/workplace/default-preferences/workplace-preferences/workplace-generaloptions/publishbuttonappearance
100
StringBuffer JavaDoc xp = new StringBuffer JavaDoc(256);
101             xp.append("/").append(CmsConfigurationManager.N_ROOT);
102             xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACE);
103             xp.append("/").append(CmsWorkplaceConfiguration.N_DEFAULTPREFERENCES);
104             xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACEPREFERENCES);
105             xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS);
106             xp.append("/").append(CmsWorkplaceConfiguration.N_PUBLISHBUTTONAPPEARANCE);
107             m_xpaths = Collections.singletonList(xp.toString());
108         }
109         return m_xpaths;
110     }
111 }
Popular Tags