View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.serializer.objects;
18  
19  import javolution.xml.*;
20  import javolution.xml.stream.XMLStreamException;
21  
22  import org.apache.commons.lang.StringEscapeUtils;
23  
24  public class JSGroup 
25  {
26  	// private int refID;
27  
28  	String name;
29  
30  	public JSGroup()
31  	{
32  		// refID = id;
33  	}
34  
35  	/****************************************************************************
36  	 * SERIALIZER
37  	 */
38  	private static final XMLFormat XML = new XMLFormat(JSGroup.class)
39  	{
40  	public void write(Object o, OutputElement xml) throws XMLStreamException
41  	{
42  
43  		try
44  		{
45  			JSGroup g = (JSGroup) o;
46  			xml.addText(g.getName());
47  		} catch (Exception e)
48  		{
49  			e.printStackTrace();
50  		}
51  	}
52  
53  	public void read(InputElement xml, Object o)
54  	{
55  		try
56  		{
57  			JSGroup g = (JSGroup) o;
58  			g.setName(StringEscapeUtils.unescapeHtml(xml.getText().toString()));
59  		} catch (Exception e)
60  		{
61  			e.printStackTrace();
62  		}
63  	}
64  	};
65  	/***
66  	 * @return Returns the name.
67  	 */
68  	public String getName()
69  	{
70  		return name;
71  	}
72  
73  	/***
74  	 * @param name
75  	 *            The name to set.
76  	 */
77  	public void setName(String name)
78  	{
79  		this.name = name;
80  	}
81  
82  }