1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.sharepoint;
16  
17  import com.liferay.portal.kernel.util.StringBundler;
18  import com.liferay.portal.kernel.util.StringPool;
19  
20  /**
21   * <a href="Property.java.html"><b><i>View Source</i></b></a>
22   *
23   * @author Bruno Farache
24   */
25  public class Property implements ResponseElement {
26  
27      public static final String OPEN_PARAGRAPH = "<p>";
28  
29      public Property(String key, String value) {
30          this(key, value, true);
31      }
32  
33      public Property(String key, ResponseElement value) {
34          this(key, StringPool.NEW_LINE + value.parse(), false);
35      }
36  
37      public Property(String key, String value, boolean newLine) {
38          _key = key;
39          _value = value;
40          _newLine = newLine;
41      }
42  
43      public String parse() {
44          StringBundler sb = new StringBundler(5);
45  
46          sb.append(OPEN_PARAGRAPH);
47          sb.append(_key);
48          sb.append(StringPool.EQUAL);
49          sb.append(_value);
50  
51          if (_newLine) {
52              sb.append(StringPool.NEW_LINE);
53          }
54  
55          return sb.toString();
56      }
57  
58      private String _key;
59      private String _value;
60      private boolean _newLine;
61  
62  }