public class Result extends SerializableUWSObject
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_RESULT_NAME |
protected java.lang.String |
href
[Optional] The readable URL which points toward the result file.
|
protected java.lang.String |
id
[Required ; Default="result"] Name or ID of this result.
|
protected java.lang.String |
mimeType
[Optional] The MIME type of the result.
|
protected boolean |
redirection
Tells whether a redirection toward the given URL is required to get the result content.
|
protected long |
size
[Optional] The size of the corresponding result file.
|
protected java.lang.String |
type
[Optional] The XLINK URL type (simple (default), extended, locator, arc, resource, title or none ; see http://www.w3.org/TR/xlink/#linking-elements for more details).
|
Constructor and Description |
---|
Result(java.lang.String name,
java.lang.String resultType,
java.lang.String resultUrl,
boolean redirection)
Builds MANUALLY a result with an ID/name, a result type and the URL toward the file which contains the result content.
|
Result(UWSJob job,
java.lang.String name)
Builds a result with just a name/ID.
|
Result(UWSJob job,
java.lang.String name,
java.lang.String resultUrl)
Builds a result with an ID/name and the URL toward the file which contains the result content.
|
Result(UWSJob job,
java.lang.String name,
java.lang.String resultType,
java.lang.String resultUrl)
Builds a result with an ID/name, a result type and the URL toward the file which contains the result content.
|
Result(UWSJob job,
java.net.URL resultUrl)
Builds a result with the URL toward the file which contains the result content.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getDefaultUrl(java.lang.String id,
UWSJob job)
Gets the HREF as {jobList}/{job}/results/ID.
|
java.lang.String |
getHref()
Gets the URL of the result file.
|
java.lang.String |
getId()
Gets the id/name of this result.
|
java.lang.String |
getMimeType()
Gets the MIME type of this result.
|
long |
getSize()
Gets the size of the corresponding result file.
|
java.lang.String |
getType()
Get the type of this result.
|
boolean |
isRedirectionRequired()
Tells whether a redirection toward the URL of this result is required to get the result content.
|
static boolean |
isRedirectionUrl(java.lang.String url,
java.lang.String resultId,
UWSJob job)
Tells whether the given URL is different from the default URL of the specified result of the given job.
|
java.lang.String |
serialize(UWSSerializer serializer,
JobOwner owner)
Serializes the whole object considering the given owner (supposed to be the current user)
and thanks to the given serializer.
|
void |
setMimeType(java.lang.String mimeType)
Sets the MIME type of this result.
|
void |
setSize(long size)
Sets the size (in bytes) of the corresponding result file.
|
java.lang.String |
toString() |
serialize, serialize, serialize
public static final java.lang.String DEFAULT_RESULT_NAME
protected java.lang.String id
protected java.lang.String href
protected java.lang.String type
protected java.lang.String mimeType
protected long size
protected final boolean redirection
UWSFileManager
.public Result(UWSJob job, java.net.URL resultUrl)
job
- Job which will own this result.resultUrl
- Result file URL.public Result(UWSJob job, java.lang.String name)
job
- Job which will own this result.name
- Name of ID of the result.public Result(UWSJob job, java.lang.String name, java.lang.String resultUrl)
job
- Job which will own this result.name
- Name or ID of the result.resultUrl
- Result file URL.Result(UWSJob, String)
public Result(UWSJob job, java.lang.String name, java.lang.String resultType, java.lang.String resultUrl)
job
- Job which will own this result.name
- Name or ID or the result.resultType
- Type of result.
Note: it should be a XLINK URL type (one among simple (default), extended, locator, arc, resource, title or none ; see http://www.w3.org/TR/xlink/#linking-elements for more details).resultUrl
- Result file URL.Result(UWSJob, String, String)
public Result(java.lang.String name, java.lang.String resultType, java.lang.String resultUrl, boolean redirection)
name
- Name or ID or the result.resultType
- Type of result.
Note: it should be a XLINK URL type (one among simple (default), extended, locator, arc, resource, title or none ; see http://www.w3.org/TR/xlink/#linking-elements for more details).resultUrl
- Result file URL.redirection
- true if a redirection toward the given URL is required to get the result content, false otherwise.
note: This parameter is ignored if the given URL is NULL or empty ! In this case, redirection = FALSE.public static final java.lang.String getDefaultUrl(java.lang.String id, UWSJob job)
id
- ID of the concerned Result.job
- The job which has to contain the Result instance.public static final boolean isRedirectionUrl(java.lang.String url, java.lang.String resultId, UWSJob job)
Tells whether the given URL is different from the default URL of the specified result of the given job.
When this function returns true a redirection toward the given URL is required to get the result content.
Otherwise, the result content must be read from a file managed by the UWSFileManager
.
note: If at least one of the parameter of this function is null or an empty string, this function returns false.
url
- Result URL to test.resultId
- ID of the result.job
- Job which owns the result.getDefaultUrl(String, UWSJob)
public final java.lang.String getId()
public final java.lang.String getHref()
public final boolean isRedirectionRequired()
UWSFileManager
.public final java.lang.String getType()
Note: The returned type should be a XLINK URL type (one among simple (default), extended, locator, arc, resource, title or none ; see http://www.w3.org/TR/xlink/#linking-elements for more details).
public final java.lang.String getMimeType()
public final void setMimeType(java.lang.String mimeType)
mimeType
- The MIME type to set.public final long getSize()
public final void setSize(long size)
public java.lang.String serialize(UWSSerializer serializer, JobOwner owner) throws UWSException, java.lang.Exception
SerializableUWSObject
serialize
in class SerializableUWSObject
serializer
- The serializer to use.owner
- The current user.UWSException
- If the owner is not allowed to see the content of the serializable object.java.lang.Exception
- If there is any other error during the serialization.public java.lang.String toString()
toString
in class java.lang.Object