001: /*
002: * (C) Copyright 2004 Nabh Information Systems, Inc.
003: *
004: * All copyright notices regarding Nabh's products MUST remain
005: * intact in the scripts and in the outputted HTML.
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public License
008: * as published by the Free Software Foundation; either version 2.1
009: * of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
019: *
020: */
021: package com.nabhinc.portlet.mvcportlet.core;
022:
023: import java.util.HashMap;
024:
025: import com.nabhinc.condition.Condition;
026:
027: /**
028: * Request configuration.
029: *
030: * @author Padmanabh Dabke
031: * (c) 2004 Nabh Information Systems, Inc. All Rights Reserved.
032: */
033: public class RequestConfig {
034: private String rcRequestType = null;
035: private ControllerPortletConfig rcGlobalConfig = null;
036: private Form rcForm = null;
037: private Condition rcPrecondition = null;
038: private HashMap rcProcessorResultMap = new HashMap();
039:
040: public String getRequestType() {
041: return rcRequestType;
042: }
043:
044: protected void setRequestType(String rType) {
045: rcRequestType = rType;
046: }
047:
048: public ControllerPortletConfig getControllerPortletConfig() {
049: return rcGlobalConfig;
050: }
051:
052: public void setControllerPortletConfig(
053: ControllerPortletConfig config) {
054: rcGlobalConfig = config;
055: }
056:
057: /**
058: *
059: * @return
060: */
061: public Form getForm() {
062: return rcForm;
063: }
064:
065: /**
066: *
067: * @param form
068: */
069: public void setForm(Form form) {
070: rcForm = form;
071: }
072:
073: /**
074: *
075: * @return
076: */
077: public Condition getPrecondition() {
078: return rcPrecondition;
079: }
080:
081: /**
082: *
083: * @param cond
084: */
085: public void setPrecondition(Condition cond) {
086: rcPrecondition = cond;
087: }
088:
089: /**
090: * Adds the ProcessorResult to the map with key provided.
091: * @param key
092: * @param result
093: */
094: @SuppressWarnings("unchecked")
095: public void addProcessorResult(String processor, String key,
096: ProcessorResult result) {
097: rcProcessorResultMap.put(constructResultKey(processor, key),
098: result);
099: }
100:
101: /**
102: * Returns the ProcessorResult object mapped with the key.
103: * @param key
104: * @return
105: */
106: public ProcessorResult getProcessorResult(String processor,
107: String key) {
108: ProcessorResult result = (ProcessorResult) rcProcessorResultMap
109: .get(constructResultKey(processor, key));
110: if (result == null)
111: return (ProcessorResult) rcProcessorResultMap
112: .get(constructResultKey("", key));
113: else
114: return result;
115: }
116:
117: public String constructResultKey(String processor, String key) {
118: if (processor == null)
119: processor = "";
120: return processor + ":" + key;
121: }
122:
123: }
|