/* * * Copyright 2013 Entando S.r.l. (http://www.entando.com) All rights reserved. * * This file is part of Entando software. * Entando is a free software; * You can redistribute it and/or modify it * under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; version 2. * * See the file License for the specific language governing permissions * and limitations under the License * * * * Copyright 2013 Entando S.r.l. (http://www.entando.com) All rights reserved. * */ package com.agiletec.plugins.jpfastcontentedit.aps.tags; import java.util.Set; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.TagSupport; import com.agiletec.aps.system.ApsSystemUtils; public class IsContentAllowedTag extends TagSupport { @Override public int doStartTag() throws JspException { try { Set<String> contentIds = (Set<String>) this.pageContext.getAttribute(this.getListName()); if (null == contentIds || contentIds.isEmpty()) return SKIP_BODY; if (contentIds.contains(this.getContentId())) { return EVAL_BODY_INCLUDE; } else { return SKIP_BODY; } } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "doStartTag"); throw new JspException("Error during tag initialization ", t); } } public String getListName() { return _listName; } public void setListName(String listName) { this._listName = listName; } public String getContentId() { return _contentId; } public void setContentId(String contentId) { this._contentId = contentId; } private String _listName; private String _contentId; }