use of org.pentaho.platform.api.engine.IActionParameter in project pentaho-platform by pentaho.
the class RuntimeContext method executeSequence.
@SuppressWarnings({ "unchecked" })
public void executeSequence(final IActionSequence sequence, final IActionCompleteListener doneListener, final IExecutionListener execListener, final boolean async) throws ActionSequenceException {
String loopParamName = sequence.getLoopParameter();
boolean peekOnly = sequence.getLoopUsingPeek();
Object loopList;
IActionParameter loopParm = null;
if (loopParamName == null) {
loopList = new ArrayList<Integer>();
((ArrayList) loopList).add(new Integer(0));
} else {
loopParm = getLoopParameter(loopParamName);
loopList = loopParm.getValue();
// If the loop list is an array, convert it to an array list for processing
if (loopList instanceof Object[]) {
loopList = Arrays.asList((Object[]) loopList);
}
}
if (loopList instanceof List) {
executeLoop(loopParm, (List) loopList, sequence, doneListener, execListener, async);
if (loopParm != null) {
// replace the loop param in case the last loop muggled it
addInputParameter(loopParm.getName(), loopParm);
}
} else if (loopList instanceof IPentahoResultSet) {
executeLoop(loopParm, (IPentahoResultSet) loopList, sequence, doneListener, execListener, async, peekOnly);
}
}
use of org.pentaho.platform.api.engine.IActionParameter in project pentaho-platform by pentaho.
the class RuntimeContext method getInputStream.
public InputStream getInputStream(final String parameterName) {
InputStream inputStream = null;
IActionParameter inputParameter = getInputParameter(parameterName);
if (inputParameter == null) {
throw new InvalidParameterException(Messages.getInstance().getErrorString("RuntimeContext.ERROR_0019_INVALID_INPUT_REQUEST", parameterName, // $NON-NLS-1$
actionSequence.getSequenceName()));
}
Object value = inputParameter.getValue();
if (value instanceof IContentItem) {
IContentItem contentItem = (IContentItem) value;
inputStream = contentItem.getInputStream();
}
return inputStream;
}
use of org.pentaho.platform.api.engine.IActionParameter in project pentaho-platform by pentaho.
the class RuntimeContext method getInputParameterValue.
// IRuntimeContext input and output methods
public Object getInputParameterValue(final String name) {
Object value = null;
IActionParameter actionParameter = paramManager.getCurrentInput(name);
if (actionParameter == null) {
// TODO need to know from the action definition if this is ok or not
warn(Messages.getInstance().getErrorString("RuntimeContext.ERROR_0019_INVALID_INPUT_REQUEST", name, // $NON-NLS-1$
actionSequence.getSequenceName()));
} else {
value = actionParameter.getValue();
}
return value;
}
use of org.pentaho.platform.api.engine.IActionParameter in project pentaho-platform by pentaho.
the class RuntimeContext method getDataSource.
public IPentahoStreamSource getDataSource(final String parameterName) {
IPentahoStreamSource dataSource = null;
// TODO Temp workaround for content repos bug
IActionParameter actionParameter = paramManager.getCurrentInput(parameterName);
if (actionParameter == null) {
throw new InvalidParameterException(Messages.getInstance().getErrorString("RuntimeContext.ERROR_0019_INVALID_INPUT_REQUEST", parameterName, // $NON-NLS-1$
actionSequence.getSequenceName()));
}
Object locObj = actionParameter.getValue();
if (locObj != null) {
if (locObj instanceof IContentItem) {
// At this point we have an IContentItem so why do anything else?
dataSource = ((IContentItem) locObj).getDataSource();
}
}
// This will return null if the locObj is null
return dataSource;
}
use of org.pentaho.platform.api.engine.IActionParameter in project pentaho-platform by pentaho.
the class ComponentBase method addTempParameterObject.
protected void addTempParameterObject(final String name, final Object paramObject) {
// $NON-NLS-1$
String pType = "object";
IActionParameter actionParameter = new ActionParameter(name, pType, paramObject, null, null);
addTempParameter(name, actionParameter);
}
Aggregations