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.taglib.util.IncludeTag;
018    
019    import javax.portlet.PortletURL;
020    
021    import javax.servlet.http.HttpServletRequest;
022    
023    /**
024     * @author Roberto Diaz
025     */
026    public class RestoreEntryTag extends IncludeTag {
027    
028            public void setOverrideMessage(String overrideMessage) {
029                    _overrideMessage = overrideMessage;
030            }
031    
032            public void setRenameMessage(String renameMessage) {
033                    _renameMessage = renameMessage;
034            }
035    
036            public void setRestoreURL(PortletURL restoreURL) {
037                    _restoreURL = restoreURL;
038            }
039    
040            @Override
041            protected void cleanUp() {
042                    _overrideMessage = _OVERRIDE_MESSAGE;
043                    _renameMessage = _RENAME_MESSAGE;
044                    _restoreURL = null;
045            }
046    
047            @Override
048            protected String getPage() {
049                    return _PAGE;
050            }
051    
052            @Override
053            protected boolean isCleanUpSetAttributes() {
054                    return _CLEAN_UP_SET_ATTRIBUTES;
055            }
056    
057            @Override
058            protected void setAttributes(HttpServletRequest request) {
059                    request.setAttribute(
060                            "liferay-ui:restore-entry:overrideMessage", _overrideMessage);
061                    request.setAttribute(
062                            "liferay-ui:restore-entry:renameMessage", _renameMessage);
063                    request.setAttribute(
064                            "liferay-ui:restore-entry:restoreURL", _restoreURL);
065            }
066    
067            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
068    
069            private static final String _OVERRIDE_MESSAGE =
070                    "overwrite-the-existing-entry-with-the-one-from-the-recycle-bin";
071    
072            private static final String _PAGE =
073                    "/html/taglib/ui/restore_entry/page.jsp";
074    
075            private static final String _RENAME_MESSAGE =
076                    "keep-both-entries-and-rename-the-entry-from-the-recycle-bin-as";
077    
078            private String _overrideMessage = _OVERRIDE_MESSAGE;
079            private String _renameMessage = _RENAME_MESSAGE;
080            private PortletURL _restoreURL;
081    
082    }