| SuccessImpl.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portal.xmlrpc;
16
17 import com.liferay.portal.kernel.util.StringBundler;
18 import com.liferay.portal.kernel.xmlrpc.Success;
19 import com.liferay.portal.kernel.xmlrpc.XmlRpcException;
20
21 /**
22 * <a href="SuccessImpl.java.html"><b><i>View Source</i></b></a>
23 *
24 * @author Alexander Chow
25 * @author Brian Wing Shun Chan
26 */
27 public class SuccessImpl implements Success {
28
29 public SuccessImpl(String description) {
30 _description = description;
31 }
32
33 public String getDescription() {
34 return _description;
35 }
36
37 public String toString() {
38 return "XML-RPC success " + _description;
39 }
40
41 public String toXml() throws XmlRpcException {
42 StringBundler sb = new StringBundler(8);
43
44 sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
45
46 sb.append("<methodResponse>");
47 sb.append("<params>");
48 sb.append("<param>");
49 sb.append(XmlRpcParser.wrapValue(_description));
50 sb.append("</param>");
51 sb.append("</params>");
52 sb.append("</methodResponse>");
53
54 return sb.toString();
55 }
56
57 private String _description;
58
59 }