KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > deliver > taglib > management > UserPropertiesAttributeParameterTag


1 /* ===============================================================================
2 *
3 * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4 *
5 * ===============================================================================
6 *
7 * Copyright (C)
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 2, as published by the
11 * Free Software Foundation. See the file LICENSE.html for more information.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19 * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20 *
21 * ===============================================================================
22 */

23 package org.infoglue.deliver.taglib.management;
24
25 import java.util.HashMap JavaDoc;
26 import java.util.Map JavaDoc;
27
28 import javax.servlet.jsp.JspException JavaDoc;
29 import javax.servlet.jsp.JspTagException JavaDoc;
30
31 import org.infoglue.deliver.taglib.AbstractTag;
32
33 /**
34  * This class implements the <content:contentVersionAttributeParameter> tag, which adds a attributes
35  * to the list of attributes in the contentVersion.
36  *
37  * Note! This tag must have a <content:contentVersionParameter> ancestor.
38  */

39 public class UserPropertiesAttributeParameterTag extends AbstractTag
40 {
41     /**
42      * The universal version identifier.
43      */

44     private static final long serialVersionUID = 4482006814634520239L;
45
46     /**
47      * The name of the parameter.
48      */

49     private String JavaDoc name;
50     
51     /**
52      * The value of the parameter.
53      */

54     private String JavaDoc value;
55     
56     /**
57      * Default constructor.
58      */

59     public UserPropertiesAttributeParameterTag()
60     {
61         super();
62     }
63
64     /**
65      * Adds a parameter with the specified name and value to the parameters
66      * of the parent tag.
67      *
68      * @return indication of whether to continue evaluating the JSP page.
69      * @throws JspException if an error occurred while processing this tag.
70      */

71     public int doEndTag() throws JspException JavaDoc
72     {
73         addUserPropertiesAttribute();
74         return EVAL_PAGE;
75     }
76
77
78     /**
79      * Adds the content version to the ancestor tag.
80      *
81      * @throws JspException if the ancestor tag isn't a url tag.
82      */

83     protected void addUserPropertiesAttribute() throws JspException JavaDoc
84     {
85         final RemoteUserPropertiesServiceTag parent = (RemoteUserPropertiesServiceTag) findAncestorWithClass(this, RemoteUserPropertiesServiceTag.class);
86         if(parent == null)
87         {
88             throw new JspTagException JavaDoc("UserPropertiesAttributeParameterTag must have a RemoteUserPropertiesServiceTag ancestor.");
89         }
90         ((RemoteUserPropertiesServiceTag) parent).addUserPropertiesAttribute(name, value);
91     }
92     
93     /**
94      * Sets the name attribute.
95      *
96      * @param name the name to use.
97      * @throws JspException if an error occurs while evaluating name parameter.
98      */

99     public void setName(final String JavaDoc name) throws JspException JavaDoc
100     {
101         this.name = evaluateString("parameter", "name", name);
102     }
103
104     /**
105      * Sets the value attribute.
106      *
107      * @param value the value to use.
108      * @throws JspException if an error occurs while evaluating value parameter.
109      */

110     public void setValue(final String JavaDoc value) throws JspException JavaDoc
111     {
112         this.value = evaluateString("parameter", "value", value);
113     }
114 }
115
Popular Tags