001    /**
002     * Copyright (c) 2000-2013 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.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Roberto Diaz
023     */
024    public class RestoreEntryTag extends IncludeTag {
025    
026            public void setDuplicateEntryAction(String duplicateEntryAction) {
027                    _duplicateEntryAction = duplicateEntryAction;
028            }
029    
030            public void setOverrideMessage(String overrideMessage) {
031                    _overrideMessage = overrideMessage;
032            }
033    
034            public void setRenameMessage(String renameMessage) {
035                    _renameMessage = renameMessage;
036            }
037    
038            public void setRestoreEntryAction(String restoreEntryAction) {
039                    _restoreEntryAction = restoreEntryAction;
040            }
041    
042            @Override
043            protected void cleanUp() {
044                    _duplicateEntryAction = _DUPLICATE_ENTRY_ACTION;
045                    _overrideMessage = _OVERRIDE_MESSAGE;
046                    _renameMessage = _RENAME_MESSAGE;
047                    _restoreEntryAction = _RESTORE_ENTRY_ACTION;
048            }
049    
050            @Override
051            protected String getPage() {
052                    return _PAGE;
053            }
054    
055            @Override
056            protected boolean isCleanUpSetAttributes() {
057                    return _CLEAN_UP_SET_ATTRIBUTES;
058            }
059    
060            @Override
061            protected void setAttributes(HttpServletRequest request) {
062                    request.setAttribute(
063                            "liferay-ui:restore-entry:duplicateEntryAction",
064                            _duplicateEntryAction);
065                    request.setAttribute(
066                            "liferay-ui:restore-entry:overrideMessage", _overrideMessage);
067                    request.setAttribute(
068                            "liferay-ui:restore-entry:renameMessage", _renameMessage);
069                    request.setAttribute(
070                            "liferay-ui:restore-entry:restoreEntryAction", _restoreEntryAction);
071            }
072    
073            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
074    
075            private static final String _DUPLICATE_ENTRY_ACTION =
076                    "/trash/restore_entry";
077    
078            private static final String _OVERRIDE_MESSAGE =
079                    "overwrite-the-existing-entry-with-the-one-from-the-recycle-bin";
080    
081            private static final String _PAGE =
082                    "/html/taglib/ui/restore_entry/page.jsp";
083    
084            private static final String _RENAME_MESSAGE =
085                    "keep-both-entries-and-rename-the-entry-from-the-recycle-bin-as";
086    
087            private static final String _RESTORE_ENTRY_ACTION = "/trash/edit_entry";
088    
089            private String _duplicateEntryAction = _DUPLICATE_ENTRY_ACTION;
090            private String _overrideMessage = _OVERRIDE_MESSAGE;
091            private String _renameMessage = _RENAME_MESSAGE;
092            private String _restoreEntryAction = _RESTORE_ENTRY_ACTION;
093    
094    }