1 package org.nextime.ion.backoffice.action.content; 2 3 import javax.servlet.jsp.JspException ; 4 import javax.servlet.jsp.tagext.TagSupport ; 5 6 import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; 7 8 import org.nextime.ion.framework.business.Publication; 9 import org.nextime.ion.framework.business.User; 10 import org.nextime.ion.framework.mapping.Mapping; 11 12 public class WorkflowActionsTag extends TagSupport { 13 14 protected String var; 15 protected String publication; 16 protected String user; 17 protected String version; 18 19 public int doStartTag() throws JspException { 20 evaluateExpressions(); 21 try { 22 Mapping.begin(); 23 pageContext.setAttribute( 24 var, 25 Publication 26 .getInstance(publication) 27 .getVersion(Integer.parseInt(getVersion())) 28 .getWorkflow(User.getInstance(user)) 29 .getAvailableActions()); 30 } catch (Exception e) { 31 throw new JspException (e); 32 } finally { 33 Mapping.rollback(); 34 } 35 return (EVAL_BODY_INCLUDE); 36 } 37 38 public int doEndTag() throws JspException { 39 return (EVAL_PAGE); 40 } 41 42 private void evaluateExpressions() throws JspException { 43 if (user != null) { 44 user = 45 ExpressionEvaluatorManager.evaluate( 46 "user", 47 user, 48 Object .class, 49 this, 50 pageContext) 51 + ""; 52 } 53 if (publication != null) { 54 publication = 55 ExpressionEvaluatorManager.evaluate( 56 "publication", 57 publication, 58 Object .class, 59 this, 60 pageContext) 61 + ""; 62 } 63 if (version != null) { 64 version = 65 ExpressionEvaluatorManager.evaluate( 66 "version", 67 version, 68 Object .class, 69 this, 70 pageContext) 71 + ""; 72 } 73 } 74 75 79 public String getPublication() { 80 return publication; 81 } 82 83 87 public String getUser() { 88 return user; 89 } 90 91 95 public String getVar() { 96 return var; 97 } 98 99 103 public void setPublication(String publication) { 104 this.publication = publication; 105 } 106 107 111 public void setUser(String user) { 112 this.user = user; 113 } 114 115 119 public void setVar(String var) { 120 this.var = var; 121 } 122 123 127 public String getVersion() { 128 return version; 129 } 130 131 135 public void setVersion(String version) { 136 this.version = version; 137 } 138 139 } 140 | Popular Tags |