Package com.cloudofficeprint.Resources
Class Resource
- java.lang.Object
-
- com.cloudofficeprint.Resources.Resource
-
- Direct Known Subclasses:
Base64Resource
,HTMLResource
,ServerResource
,URLResource
public abstract class Resource extends java.lang.Object
Resource is an abstract class for all the different resource types for the templates and "secondary files" : subtemplates, files to prepend, files to append and files to insert (in the template).
-
-
Constructor Summary
Constructors Constructor Description Resource()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
getExtension(java.lang.String filePath)
java.lang.String
getFiletype()
abstract 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.abstract com.google.gson.JsonObject
getJSONForTemplate()
Needs to be called to get the JSON of a resource for a template.java.lang.String
getMimeType()
void
setFiletype(java.lang.String filetype)
Sets the filetype (extension) of the resource to the given filetype.void
setMimeType(java.lang.String mimeType)
Sets the mimetype of the resource to the given mimetype.
-
-
-
Method Detail
-
getMimeType
public java.lang.String getMimeType()
- Returns:
- The mimetype of the resource.
-
getFiletype
public java.lang.String getFiletype()
- Returns:
- The resource type as extension e.g. : docx.
-
setMimeType
public void setMimeType(java.lang.String mimeType)
Sets the mimetype of the resource to the given mimetype.- Parameters:
mimeType
- The resource's mimetype.
-
setFiletype
public void setFiletype(java.lang.String filetype)
Sets the filetype (extension) of the resource to the given filetype.- Parameters:
filetype
- extension of the resource.
-
getJSONForTemplate
public abstract com.google.gson.JsonObject getJSONForTemplate()
Needs to be called to get the JSON of a resource for a template.- Returns:
- JsonObject to add in the JSON for the server.
-
getJSONForSecondaryFile
public abstract 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.- Returns:
- JsonObject to add in the JSON for the server.
-
getExtension
public java.lang.String getExtension(java.lang.String filePath) throws java.lang.Exception
- Parameters:
filePath
- path of the file- Returns:
- File extension of the file
- Throws:
java.lang.Exception
- If no extension is found.
-
-