KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > core > runtime > IActionParameter


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11  * the license for the specific language governing your rights and limitations.
12  *
13  * @created Apr 13, 2005
14  * @author James Dixon
15  *
16  */

17
18 package org.pentaho.core.runtime;
19
20 import java.util.List JavaDoc;
21 import java.util.Map JavaDoc;
22
23 import org.pentaho.core.connection.IPentahoResultSet;
24
25 /**
26  * An <code>IActionParameter</code> represents one input or output in an <tt>IActionSequence</tt>. The
27  * <tt>IActionParameter</tt> is made up of a name or key, and a value.
28  */

29 public interface IActionParameter {
30
31     /**
32      * Parameter type of <tt>String</tt>
33      */

34     public static final String JavaDoc TYPE_STRING = "string"; //$NON-NLS-1$
35

36     /**
37      * Parameter type of <code>int</code>
38      */

39     public static final String JavaDoc TYPE_INTEGER = "integer"; //$NON-NLS-1$
40
/**
41      * Parameter type of <tt>List</tt>.
42      */

43     public static final String JavaDoc TYPE_LIST = "list"; //$NON-NLS-1$
44
/**
45      * Parameter type indicating streamable content. @see <tt>RuntimeContext#getOutputStream(java.lang.String,java.lang.String,java.lang.String)</tt>
46      */

47     public static final String JavaDoc TYPE_CONTENT = "content"; //$NON-NLS-1$
48
/**
49      * Parameter type of <tt>Date</tt>
50      */

51     public static final String JavaDoc TYPE_DATE = "date"; //$NON-NLS-1$
52
/**
53      * Parameter type of <tt>IPentahoResultSet</tt>
54      */

55     public static final String JavaDoc TYPE_RESULT_SET = "resultset"; //$NON-NLS-1$
56
/**
57      * Parameter type of <tt>BigDecimal</tt>
58      */

59     public static final String JavaDoc TYPE_DECIMAL = "bigdecimal"; //$NON-NLS-1$
60
/**
61      * Parameter type indicating any type of <tt>Object</tt>
62      */

63     public static final String JavaDoc TYPE_OBJECT = "object"; //$NON-NLS-1$
64

65     /** This parameter allows prompting */
66     public static final int PROMPT_ALLOWED = 0;
67
68     /** This parameter needs to be prompted for a value */
69     public static final int PROMPT_NEEDED = 1;
70
71     /** This parameter does not allow prompting */
72     public static final int PROMPT_NEVER = 2;
73
74     /** A component has already specified a prompt for this parameter */
75     public static final int PROMPT_PENDING = 3;
76
77     /**
78      * Get the name, or the key for this ActionParameter.
79      *
80      * @return the ActionParameter name
81      */

82     public String JavaDoc getName();
83
84     /**
85      * Get the value for this ActionParameter as type String.
86      *
87      * @return the ActionParameter value as a String. getType() should be
88      * referenced first to be sure the value type is TYPE_STRING.
89      */

90     public String JavaDoc getStringValue();
91
92     /**
93      * Get the value for this ActionParameter as a generic Java Object.
94      *
95      * @return the ActionParameter value as an Object
96      */

97     public Object JavaDoc getValue();
98
99     /**
100      * Get the value for this ActionParameter as a java.util.List.
101      *
102      * @return the ActionParameter value as a List. getType() should be
103      * referenced first to be sure the value type is TYPE_LIST.
104      */

105     public List JavaDoc getValueAsList();
106
107     /**
108      * Get the value for this ActionParameter as a IPentahoResultSet
109      *
110      * @return the IPentahoResultSet getType() should be referenced first to be
111      * sure the value type is TYPE_RESULT_SET.
112      */

113     public IPentahoResultSet getValueAsResultSet();
114
115     /**
116      * Return the value type as one of the constants available in this class.
117      *
118      * @return valid return values are TYPE_STRING, TYPE_INTEGER, TYPE_LIST,
119      * TYPE_CONTENT or TYPE_DATE
120      */

121     public String JavaDoc getType();
122
123     /**
124      * Sets the value object for this ActionParameter.
125      *
126      * @param value
127      * the value Object to be set.
128      */

129     public void setValue(Object JavaDoc value);
130
131     /**
132      * @return List of where the parameter may come from (request, session, etc)
133      */

134     public List JavaDoc getVariables();
135
136     /**
137      * Check if this ActionParameter has a default value set.
138      *
139      * @return true if there is a default value, otherwise false
140      */

141     public boolean hasDefaultValue();
142
143     /**
144      * Check to se if a value has been set for this parameter. Default value
145      * does not count;
146      *
147      * @return true if this parameter has a non default value
148      */

149     public boolean hasValue();
150
151     /**
152      * Check to see if the value returned from thisActionParameter is indeed the
153      * default value instead of a value that was set.
154      *
155      * @return true if the parameter is using the default value, false otherwise
156      */

157     public boolean isDefaultValue();
158
159     /**
160      * Check to see if the value (includes the default value) is null.
161      *
162      * @return true if the value is null, otherwise false
163      */

164     public boolean isNull();
165
166     /**
167      * See if we need to do any cleanup here
168      *
169      */

170     public void dispose();
171
172     /**
173      * Returns the prompt status for this parameter.
174      *
175      * @return the status.
176      * @see IActionParameter#PROMPT_ALLOWED
177      * @see IActionParameter#PROMPT_NEVER
178      * @see IActionParameter#PROMPT_NEEDED
179      * @see IActionParameter#PROMPT_PENDING
180      */

181     public int getPromptStatus();
182
183     /**
184      * Sets the prompt status for this parameter.
185      *
186      * @param status
187      * The status to set.
188      * @return true if the set was successful or false if the current setting
189      * cannot be changed.
190      * @see IActionParameter#PROMPT_ALLOWED
191      * @see IActionParameter#PROMPT_NEVER
192      * @see IActionParameter#PROMPT_NEEDED
193      * @see IActionParameter#PROMPT_PENDING
194      */

195     public boolean setPromptStatus(int status);
196
197     // // Selection Support
198
/*
199      * Check to see if selections are set for this Parameter
200      */

201     public boolean hasSelections();
202
203     /**
204      * The display name to use when building a prompt.
205      * @return The display name for the prompt.
206      */

207     public String JavaDoc getSelectionDisplayName();
208     /**
209      * When building a parameter prompt page, what is the
210      * name of the prompt
211      * @param value
212      * @return name for the value
213      */

214     public String JavaDoc getSelectionNameForValue(String JavaDoc value);
215
216     /**
217      * @deprecated
218      * Unused in the platform
219      */

220     public Map JavaDoc getSelectionNameMap();
221     
222     /**
223      * @deprecated
224      * Unused in the platform
225      */

226     public List JavaDoc getSelectionValues();
227
228     /**
229      * @deprecated
230      * Unused in the platform
231      */

232     public void setParamSelections(List JavaDoc selValues, Map JavaDoc selNames, String JavaDoc displayname);
233
234 }
235
Popular Tags