001: /*
002: * (C) Copyright 2000 - 2006 Nabh Information Systems, Inc.
003: *
004: * This program is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU General Public License
006: * as published by the Free Software Foundation; either version 2
007: * of the License, or (at your option) any later version.
008: *
009: * This program is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: *
014: * You should have received a copy of the GNU General Public License
015: * along with this program; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017: *
018: */
019: package com.nabhinc.portal.processor;
020:
021: import java.util.HashMap;
022: import java.util.Map;
023:
024: import com.nabhinc.portal.core.PortalActionProcessor;
025: import com.nabhinc.portal.core.PortalConstants;
026:
027: /**
028: *
029: *
030: * @author Padmanabh Dabke
031: * (c) 2006 Nabh Information Systems, Inc. All Rights Reserved.
032: */
033: public class ProcessorFactory {
034: public static Map<String, PortalActionProcessor> createProcessorMap() {
035: HashMap<String, PortalActionProcessor> map = new HashMap<String, PortalActionProcessor>();
036:
037: // The following require view permission on portal app and the current page
038: map
039: .put(PortalConstants.PORTAL_ACTION_VIEW,
040: new ViewProcessor());
041: map.put(PortalConstants.PORTAL_ACTION_RENDER,
042: new RenderProcessor());
043: map.put(PortalConstants.PORTAL_ACTION_RENDER_DEFAULT,
044: new RenderDefaultProcessor());
045: map.put(PortalConstants.PORTAL_ACTION_PROCESS_ACTION,
046: new ProcessActionProcessor());
047: map.put(PortalConstants.PORTAL_ACTION_DETACH,
048: new DetachProcessor());
049: map.put(PortalConstants.PORTAL_ACTION_CHANGE_MODE,
050: new ChangePortletModeProcessor());
051: map.put(PortalConstants.PORTAL_ACTION_CHANGE_STATE,
052: new ChangeWindowStateProcessor());
053: map.put(PortalConstants.PORTAL_ACTION_REFRESH,
054: new RefreshPortletProcessor());
055: map.put(PortalConstants.PORTAL_ACTION_SWITCH_MODE,
056: new SwitchModeProcessor());
057:
058: // Server side processing for select and cascading select is the same.
059: SelectProcessor pr = new SelectProcessor();
060: map.put(PortalConstants.PORTAL_ACTION_SELECT, pr);
061: map.put(PortalConstants.PORTAL_ACTION_CASCADING_SELECT, pr);
062:
063: // The following require edit permission on portal app and the current page
064: map.put(PortalConstants.PORTAL_ACTION_DELETE_PORTLET,
065: new DeletePortletProcessor());
066: map.put(PortalConstants.PORTAL_ACTION_ADD_PORTLET,
067: new AddPortletProcessor());
068: map.put(PortalConstants.PORTAL_ACTION_DELETE_NAV_OPTION,
069: new DeleteNavOptionProcessor());
070: map.put(PortalConstants.PORTAL_ACTION_ADD_OPTION,
071: new AddOptionProcessor());
072: map.put(PortalConstants.PORTAL_ACTION_RENAME,
073: new RenameProcessor());
074: map.put(PortalConstants.PORTAL_ACTION_REORDER_CONTENT,
075: new ReorderContentProcessor());
076: map
077: .put(
078: PortalConstants.PORTAL_ACTION_CHANGE_DESKTOP_WINDOW_PROP,
079: new ChangeDesktopWindowPropertyProcessor());
080: map.put(PortalConstants.PORTAL_ACTION_AJAX_POPUP_FORWARD,
081: new AJAXPopupForwarder());
082:
083: // Edit permission on portalApp
084: map.put(PortalConstants.PORTAL_ACTION_LOCK_PSITE,
085: new LockPsiteProcessor());
086: map.put(PortalConstants.PORTAL_ACTION_UNLOCK_PSITE,
087: new UnlockPsiteProcessor());
088:
089: // The following require admin permission on portal app
090: map.put(PortalConstants.PORTAL_ACTION_EDIT_PAGE,
091: new EditPageProcessor());
092: map.put(PortalConstants.PORTAL_ACTION_EDIT_PORTAL_APP,
093: new EditPortalAppProcessor());
094: map.put(PortalConstants.PORTAL_ACTION_CHANGE_TITLE,
095: new ChangeAppTitle());
096: map.put(PortalConstants.PORTAL_ACTION_CHANGE_TAGLINE,
097: new ChangeAppTagline());
098:
099: // Requires edit permission on portal app
100: map.put(PortalConstants.PORTAL_ACTION_NEW_PAGE,
101: new NewPageProcessor());
102: map.put(PortalConstants.PORTAL_ACTION_REORDER_PAGES,
103: new ReorderPagesProcessor());
104:
105: // Requires delete permission on current page and edit permission on the app
106: map.put(PortalConstants.PORTAL_ACTION_DELETE_PAGE,
107: new DeletePageProcessor());
108:
109: // Just requires user to be logged in
110: map.put(PortalConstants.PORTAL_ACTION_MANAGE_ACCOUNT,
111: new ManageAccountProcessor());
112:
113: return map;
114: }
115: }
|