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 javax.portlet.PortletException;
024:
025: /**
026: * The result mapping of a Request Processor.
027: *
028: * @author Padmanabh Dabke
029: * (c) 2004 Nabh Information Systems, Inc. All Rights Reserved.
030: */
031: public class ProcessorResult {
032: public static final int TYPE_RENDER = 0;
033: public static final int TYPE_REDIRECT = 1;
034: public static final int TYPE_PROCESS = 2;
035:
036: private int prType = TYPE_RENDER;
037: private String prValue = null;
038: private MessageInfo prMessageInfo = null;
039: private String prWindowState = null;
040: private String prPortletMode = null;
041: private String prSetRenderParameters = null;
042: private String prParams = null;
043:
044: public ProcessorResult(int type, String value, MessageInfo mInfo,
045: String pMode, String winState, String setRenderParams,
046: String params) throws PortletException {
047:
048: if (setRenderParams != null && type != TYPE_RENDER) {
049: throw new PortletException(
050: "You cannot specify setRenderParameters attribute for process/redirect result mappng.");
051: }
052:
053: prType = type;
054: prValue = value;
055: prMessageInfo = mInfo;
056: prPortletMode = pMode;
057: prWindowState = winState;
058: prSetRenderParameters = setRenderParams;
059: prParams = params;
060: }
061:
062: public int getType() {
063: return prType;
064: }
065:
066: public void setType(int type) {
067: prType = type;
068: }
069:
070: public String getValue() {
071: return prValue;
072: }
073:
074: public void setValue(String value) {
075: prValue = value;
076: }
077:
078: /**
079: * Returns a message info (i.e. the type of message and message key)
080: * corresponding to a result string returned by the ActionProcessor.
081: * This will be passed on to the subsequent render call as a parameter.
082: * This can be used by the JSP to display info/status/warning/error
083: * messages. Please look at nav.jsp provided in the distribution for
084: * the usage.
085: * @return MessageInfo object associated with processor result.
086: */
087: public MessageInfo getMessageInfo() {
088: return prMessageInfo;
089: }
090:
091: public void setMessageInfo(MessageInfo mInfo) {
092: prMessageInfo = mInfo;
093: }
094:
095: public String getWindowState() {
096: return prWindowState;
097: }
098:
099: public void setWindowState(String winState) {
100: prWindowState = winState;
101: }
102:
103: public String getPortletMode() {
104: return prPortletMode;
105: }
106:
107: public void setPortletMode(String pMode) {
108: prPortletMode = pMode;
109: }
110:
111: public String getSetRenderParameters() {
112: return prSetRenderParameters;
113: }
114:
115: public String getParams() {
116: return prParams;
117: }
118: }
|