001
014
015 package com.liferay.taglib.aui;
016
017 import com.liferay.portal.kernel.util.Validator;
018 import com.liferay.portal.kernel.workflow.WorkflowConstants;
019 import com.liferay.taglib.aui.base.BaseWorkflowStatusTag;
020
021 import javax.servlet.http.HttpServletRequest;
022
023
028 public class WorkflowStatusTag extends BaseWorkflowStatusTag {
029
030 @Override
031 protected String getPage() {
032 String markupView = getMarkupView();
033
034 if (Validator.isNotNull(markupView)) {
035 return
036 "/html/taglib/aui/workflow_status/" + markupView + "/page.jsp";
037 }
038
039 return "/html/taglib/aui/workflow_status/page.jsp";
040 }
041
042 @Override
043 protected boolean isCleanUpSetAttributes() {
044 return _CLEAN_UP_SET_ATTRIBUTES;
045 }
046
047 @Override
048 protected void setAttributes(HttpServletRequest request) {
049 super.setAttributes(request);
050
051 Object bean = getBean();
052
053 if (bean == null) {
054 bean = pageContext.getAttribute("aui:model-context:bean");
055 }
056
057 String helpMessage = getHelpMessage();
058
059 if (Validator.isNull(helpMessage) &&
060 (getStatus() == WorkflowConstants.STATUS_APPROVED) &&
061 Validator.isNotNull(getVersion())) {
062
063 helpMessage = _HELP_MESSAGE_DEFAULT;
064 }
065
066 Class<?> model = getModel();
067
068 if (model == null) {
069 model = (Class<?>)pageContext.getAttribute(
070 "aui:model-context:model");
071 }
072
073 setNamespacedAttribute(request, "bean", bean);
074 setNamespacedAttribute(request, "helpMessage", helpMessage);
075 setNamespacedAttribute(request, "model", model);
076 }
077
078 private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
079
080 private static final String _HELP_MESSAGE_DEFAULT =
081 "a-new-version-is-created-automatically-if-this-content-is-" +
082 "modified";
083
084 }