001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.taglib.ui;
016    
017    import com.liferay.portal.kernel.util.StringPool;
018    import com.liferay.taglib.util.IncludeTag;
019    
020    import javax.servlet.http.HttpServletRequest;
021    
022    /**
023     * @author Eudaldo Alonso
024     */
025    public class AssetMetadataTag extends IncludeTag {
026    
027            public String getClassName() {
028                    return _className;
029            }
030    
031            public long getClassPK() {
032                    return _classPK;
033            }
034    
035            public String[] getMetadataFields() {
036                    return _metadataFields;
037            }
038    
039            public boolean isFilterByMetadata() {
040                    return _filterByMetadata;
041            }
042    
043            public void setClassName(String className) {
044                    _className = className;
045            }
046    
047            public void setClassPK(long classPK) {
048                    _classPK = classPK;
049            }
050    
051            public void setFilterByMetadata(boolean filterByMetadata) {
052                    _filterByMetadata = filterByMetadata;
053            }
054    
055            public void setMetadataFields(String[] metadataFields) {
056                    _metadataFields = metadataFields;
057            }
058    
059            @Override
060            protected void cleanUp() {
061                    _className = StringPool.BLANK;
062                    _classPK = 0;
063                    _filterByMetadata = false;
064                    _metadataFields = null;
065            }
066    
067            @Override
068            protected String getPage() {
069                    return _PAGE;
070            }
071    
072            @Override
073            protected void setAttributes(HttpServletRequest request) {
074                    request.setAttribute("liferay-ui:asset-metadata:className", _className);
075                    request.setAttribute("liferay-ui:asset-metadata:classPK", _classPK);
076                    request.setAttribute(
077                            "liferay-ui:asset-metadata:filterByMetadata", _filterByMetadata);
078                    request.setAttribute(
079                            "liferay-ui:asset-metadata:metadataFields", _metadataFields);
080            }
081    
082            private static final String _PAGE =
083                    "/html/taglib/ui/asset_metadata/page.jsp";
084    
085            private String _className = StringPool.BLANK;
086            private long _classPK;
087            private boolean _filterByMetadata;
088            private String[] _metadataFields;
089    
090    }