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.taglib.aui;
16  
17  import com.liferay.taglib.util.IncludeTag;
18  
19  import javax.servlet.http.HttpServletRequest;
20  
21  /**
22   * <a href="WorkflowStatusTag.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Julio Camarero
25   * @author Jorge Ferrer
26   * @author Brian Wing Shun Chan
27   */
28  public class WorkflowStatusTag extends IncludeTag {
29  
30      public void setBean(Object bean) {
31          _bean = bean;
32      }
33  
34      public void setId(long id) {
35          setId(String.valueOf(id));
36      }
37  
38      public void setId(String id) {
39          _id = id;
40      }
41  
42      public void setModel(Class<?> model) {
43          _model = model;
44      }
45  
46      public void setStatus(int status) {
47          _status = status;
48      }
49  
50      public void setVersion(double version) {
51          _version = version;
52      }
53  
54      protected void cleanUp() {
55          _bean = null;
56          _id = null;
57          _model = null;
58          _status = 0;
59          _version = 0;
60      }
61  
62      protected String getPage() {
63          return _PAGE;
64      }
65  
66      protected boolean isCleanUpSetAttributes() {
67          return _CLEAN_UP_SET_ATTRIBUTES;
68      }
69  
70      protected void setAttributes(HttpServletRequest request) {
71          Object bean = _bean;
72  
73          if (bean == null) {
74              bean = pageContext.getAttribute("aui:model-context:bean");
75          }
76  
77          Class<?> model = _model;
78  
79          if (model == null) {
80              model = (Class<?>)pageContext.getAttribute(
81                  "aui:model-context:model");
82          }
83  
84          request.setAttribute("aui:workflow-status:bean", bean);
85          request.setAttribute("aui:workflow-status:id", _id);
86          request.setAttribute("aui:workflow-status:model", model);
87          request.setAttribute(
88              "aui:workflow-status:status", String.valueOf(_status));
89          request.setAttribute(
90              "aui:workflow-status:version", String.valueOf(_version));
91      }
92  
93      private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
94  
95      private static final String _PAGE =
96          "/html/taglib/aui/workflow_status/page.jsp";
97  
98      private Object _bean;
99      private String _id;
100     private Class<?> _model;
101     int _status;
102     private double _version;
103 
104 }