PayloadFormData.java [src/csip/api/server] Revision: default Date:
/*
* $Id$
*
* This file is part of the Cloud Services Integration Platform (CSIP),
* a Model-as-a-Service framework, API and application suite.
*
* 2012-2022, Olaf David and others, OMSLab, Colorado State University.
*
* OMSLab licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*/
package csip.api.server;
import java.io.File;
import java.util.Collection;
/**
* PayloadFormData input
*
* @author od
*/
public interface PayloadFormData {
/**
* Check if the key exist.
*
* @param key The name key
* @return if payload form data is not null and contains key
*/
boolean hasKey(String key);
/**
* Check if Value exists.
*
* @param value value
* @return if payload form data is not null and contains value
*/
boolean hasValue(String value);
/**
* Check is a required key exists.
*
* @param name the key name
* @return this object
* @throws ServiceException if the parameter is not found.
*/
PayloadFormData require(String name) throws ServiceException;
/**
* Check is a required key exists.
*
* @param name the key name
* @return this object
* @throws ServiceException if the parameter is not found.
*/
PayloadFormData requireValue(String name) throws ServiceException;
/**
* Get the file input by form name.
*
* @param key the form key name
* @return the file in the workspace
* @throws ServiceException if file not found
*/
File getFile(String key) throws ServiceException;
/**
* Get the value of a given form name
*
* @param key the form key name
* @return the String value
* @throws ServiceException if key does not exist or is not a file
*/
String getString(String key) throws ServiceException;
/**
* Get all form names.
* @return the from names.
*/
Collection<String> getKeys();
/**
* Check if there is form data
* @return true is there is
*/
boolean hasFormData();
}