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.portlet.invitation.util;
16  
17  import com.liferay.portal.kernel.util.GetterUtil;
18  import com.liferay.portal.kernel.util.PropsKeys;
19  import com.liferay.portal.kernel.util.StringPool;
20  import com.liferay.portal.kernel.util.Validator;
21  import com.liferay.portal.util.ContentUtil;
22  import com.liferay.portal.util.PropsUtil;
23  
24  import javax.portlet.PortletPreferences;
25  
26  /**
27   * <a href="InvitationUtil.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class InvitationUtil {
32  
33      public static int getEmailMessageMaxRecipients() {
34          return GetterUtil.getInteger(PropsUtil.get(
35              PropsKeys.INVITATION_EMAIL_MAX_RECIPIENTS));
36      }
37  
38      public static String getEmailMessageBody(PortletPreferences preferences) {
39          String emailMessageBody = preferences.getValue(
40              "email-message-body", StringPool.BLANK);
41  
42          if (Validator.isNotNull(emailMessageBody)) {
43              return emailMessageBody;
44          }
45          else {
46              return ContentUtil.get(PropsUtil.get(
47                  PropsKeys.INVITATION_EMAIL_MESSAGE_BODY));
48          }
49      }
50  
51      public static String getEmailMessageSubject(
52          PortletPreferences preferences) {
53  
54          String emailMessageSubject = preferences.getValue(
55              "email-message-subject", StringPool.BLANK);
56  
57          if (Validator.isNotNull(emailMessageSubject)) {
58              return emailMessageSubject;
59          }
60          else {
61              return ContentUtil.get(PropsUtil.get(
62                  PropsKeys.INVITATION_EMAIL_MESSAGE_SUBJECT));
63          }
64      }
65  
66  }