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.taglib.ui;
16  
17  import com.liferay.portal.kernel.util.MethodKey;
18  import com.liferay.portal.kernel.util.PortalClassInvoker;
19  import com.liferay.portal.kernel.util.StringPool;
20  import com.liferay.taglib.util.IncludeTag;
21  
22  import javax.servlet.jsp.JspException;
23  import javax.servlet.jsp.PageContext;
24  
25  /**
26   * <a href="InputPermissionsTag.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   * @author Wilson S. Man
30   */
31  public class InputPermissionsTag extends IncludeTag {
32  
33      public static String doTag(
34              String formName, String modelName, PageContext pageContext)
35          throws Exception {
36  
37          return doTag(_PAGE, formName, modelName, pageContext);
38      }
39  
40      public static String doTag(
41              String page, String formName, String modelName,
42              PageContext pageContext)
43          throws Exception {
44  
45          Object returnObj = PortalClassInvoker.invoke(
46              false, _doEndTagMethodKey, page, formName, modelName, pageContext);
47  
48          if (returnObj != null) {
49              return returnObj.toString();
50          }
51          else {
52              return StringPool.BLANK;
53          }
54      }
55  
56      public int doEndTag() throws JspException {
57          try {
58              doTag(getPage(), _formName, _modelName, pageContext);
59  
60              return EVAL_PAGE;
61          }
62          catch (Exception e) {
63              throw new JspException(e);
64          }
65      }
66  
67      public void setFormName(String formName) {
68          _formName = formName;
69      }
70  
71      public void setModelName(String modelName) {
72          _modelName = modelName;
73      }
74  
75      protected String getDefaultPage() {
76          return _PAGE;
77      }
78  
79      private static final String _TAG_CLASS =
80          "com.liferay.portal.servlet.taglib.ui.InputPermissionsTagUtil";
81  
82      private static final String _PAGE =
83          "/html/taglib/ui/input_permissions/page.jsp";
84  
85      private static MethodKey _doEndTagMethodKey = new MethodKey(
86          _TAG_CLASS, "doEndTag", String.class, String.class, String.class,
87          PageContext.class);
88  
89      private String _formName = "fm";
90      private String _modelName = null;
91  
92  }