Package com.cloudofficeprint.Resources
Class ServerResource
- java.lang.Object
-
- com.cloudofficeprint.Resources.Resource
-
- com.cloudofficeprint.Resources.ServerResource
-
public class ServerResource extends Resource
Child class of Resource. A class representing a resource (file) on the Cloud Office Print server.
-
-
Constructor Summary
Constructors Constructor Description ServerResource(java.lang.String path, java.lang.String mimeType)
Creates a resource with given path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gson.JsonObject
getJSONForSecondaryFile()
Needs to be used to get the JSON of a resource for a secondary file (file to prepend, to append, to insert or subtemplate), because their JSON has a different format then for a template.com.google.gson.JsonObject
getJSONForTemplate()
Needs to be called to get the JSON of a resource for a template.java.lang.String
getPath()
void
setPath(java.lang.String path)
Sets the path of the resource.-
Methods inherited from class com.cloudofficeprint.Resources.Resource
getExtension, getFiletype, getMimeType, setFiletype, setMimeType
-
-
-
-
Constructor Detail
-
ServerResource
public ServerResource(java.lang.String path, java.lang.String mimeType) throws java.lang.Exception
Creates a resource with given path. Mimetype and filetype (extension) are deduced from the path.- Parameters:
path
- Path of the file on the Cloud Office Print server.mimeType
- Mimetype of the file on the Cloud Office Print server.- Throws:
java.io.IOException
- if mimetype can't be deduced.java.lang.Exception
- if extension can't be deduced.
-
-
Method Detail
-
getPath
public java.lang.String getPath()
- Returns:
- Path of the resource on the Cloud Office Print server.
-
setPath
public void setPath(java.lang.String path)
Sets the path of the resource.- Parameters:
path
- path of the resource on the Cloud Office Print server.
-
getJSONForTemplate
public com.google.gson.JsonObject getJSONForTemplate()
Description copied from class:Resource
Needs to be called to get the JSON of a resource for a template.- Specified by:
getJSONForTemplate
in classResource
- Returns:
- JSONObject with the tags for a resource on server as template for the Cloud Office Print server ("template_type","filename").
-
getJSONForSecondaryFile
public com.google.gson.JsonObject getJSONForSecondaryFile()
Description copied from class:Resource
Needs to be used to get the JSON of a resource for a secondary file (file to prepend, to append, to insert or subtemplate), because their JSON has a different format then for a template.- Specified by:
getJSONForSecondaryFile
in classResource
- Returns:
- JSONObject with the tags ("mime_type","file","file_source") for a server resource as a secondary file (subtemplates, files to prepend, files to append and files to insert) for the Cloud Office Print server.
-
-