public class ZebraCardTemplate extends Object implements ZebraTemplate
Constructor and Description |
---|
ZebraCardTemplate(ZebraCardPrinter genericPrinter)
Constructs a ZebraCardTemplate object.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<String,String> |
convertDataDocumentToDataMap(String dataDocument)
Converts a JSON or XML formatted template data document into a Map.
|
void |
deleteTemplate(String templateName)
Deletes the specified template.
|
void |
deleteTemplateImage(String imageName)
Deletes the specified template image.
|
TemplateJob |
generateTemplateDataJob(String templateData,
java.util.Map<String,String> fieldDataMap)
Returns an instance of TemplateJob containing the job specific data.
|
TemplateJob |
generateTemplateJob(String templateName,
java.util.Map<String,String> fieldDataMap)
Returns an instance of TemplateJob containing the job specific data.
|
java.util.List<String> |
getAllTemplateImageNames()
Gets a list of all stored template images.
|
java.util.List<String> |
getAllTemplateNames()
Returns a list containing the stored template names.
|
String |
getTemplate(String templateName)
Returns the specified template.
|
java.util.List<String> |
getTemplateFields(String templateName)
Returns the template fields from the specified XML template.
|
byte[] |
getTemplateImageData(String imageName)
Returns the raw image data from the specified image name.
|
void |
saveTemplate(String templateName,
String templateData)
Saves the specified template.
|
void |
saveTemplateImage(String imageName,
byte[] imageData)
Saves the specified template image.
|
void |
setTemplateFileDirectory(String directoryPath)
Sets the directory location for retrieving/storing template files.
|
void |
setTemplateImageFileDirectory(String directoryPath)
Sets the directory location for retrieving/storing template image files.
|
public ZebraCardTemplate(ZebraCardPrinter genericPrinter)
genericPrinter
- interface used to obtain various properties of a Zebra card printer.public void setTemplateFileDirectory(String directoryPath) throws IllegalArgumentException, java.io.IOException
ZebraTemplate
setTemplateFileDirectory
in interface ZebraTemplate
directoryPath
- directory path for template files.IllegalArgumentException
- If the directoryPath
is invalid.java.io.IOException
- If there is an error accessing or creating the template file directory.ZebraTemplate.setTemplateFileDirectory(String)
public void setTemplateImageFileDirectory(String directoryPath) throws IllegalArgumentException, java.io.IOException
ZebraTemplate
setTemplateImageFileDirectory
in interface ZebraTemplate
directoryPath
- directory path for template image files.IllegalArgumentException
- If the directoryPath
is invalid.java.io.IOException
- If there is an error accessing or creating the template image file directory.ZebraTemplate.setTemplateImageFileDirectory(String)
public void saveTemplate(String templateName, String templateData) throws IllegalArgumentException, java.io.IOException
ZebraTemplate
saveTemplate
in interface ZebraTemplate
templateName
- the name of the template.templateData
- the XML formatted template.IllegalArgumentException
- if specified template name already exists.java.io.IOException
- on failure to store the template.ZebraTemplate.saveTemplate(String, String)
public void deleteTemplate(String templateName) throws IllegalArgumentException, ZebraCardException, java.io.IOException
ZebraTemplate
deleteTemplate
in interface ZebraTemplate
templateName
- the name of the template.IllegalArgumentException
- if specified template name is invalid.ZebraCardException
- on failure to delete the template.java.io.IOException
- if specified template is not found or an error is encountered accessing the stored template file.ZebraTemplate.deleteTemplate(String)
public String getTemplate(String templateName) throws IllegalArgumentException, java.io.IOException
ZebraTemplate
getTemplate
in interface ZebraTemplate
templateName
- the name of the template.IllegalArgumentException
- if specified template name is invalid.java.io.IOException
- if specified template is not found or an I/O related error occurs.ZebraTemplate.getTemplate(String)
public java.util.List<String> getAllTemplateNames() throws java.io.IOException
ZebraTemplate
getAllTemplateNames
in interface ZebraTemplate
java.io.IOException
- if an I/O related error occurs while accessing the stored templates.ZebraTemplate.getAllTemplateNames()
public java.util.List<String> getTemplateFields(String templateName) throws IllegalArgumentException, ZebraCardException, java.io.IOException
ZebraTemplate
getTemplateFields
in interface ZebraTemplate
templateName
- the name of the template.IllegalArgumentException
- if specified template name is null or empty.ZebraCardException
- on failure to read the stored template data.java.io.IOException
- if specified template is not found or an I/O related error occurs.ZebraTemplate.getTemplateFields(String)
public void saveTemplateImage(String imageName, byte[] imageData) throws java.io.IOException, IllegalArgumentException
ZebraTemplate
saveTemplateImage
in interface ZebraTemplate
imageName
- the name of the image.imageData
- the image data.java.io.IOException
- on failure to save image data.IllegalArgumentException
- if the specified image name and/or data is empty or null.ZebraTemplate.saveTemplateImage(String, byte[])
public byte[] getTemplateImageData(String imageName) throws java.io.IOException, IllegalArgumentException
ZebraTemplate
getTemplateImageData
in interface ZebraTemplate
imageName
- the name of the image.java.io.IOException
- if specified image is not found.IllegalArgumentException
- if the specified image name is empty or null.ZebraTemplate.getTemplateImageData(String)
public java.util.List<String> getAllTemplateImageNames() throws java.io.IOException
ZebraTemplate
getAllTemplateImageNames
in interface ZebraTemplate
java.io.IOException
- if an error is encountered while accessing the stored image files.ZebraTemplate.getAllTemplateImageNames()
public void deleteTemplateImage(String imageName) throws ZebraCardException, java.io.IOException
ZebraTemplate
deleteTemplateImage
in interface ZebraTemplate
imageName
- image name.ZebraCardException
- on failure to delete the specified image.java.io.IOException
- if specified image is not found or an error is encountered accessing the stored image file.ZebraTemplate.deleteTemplateImage(String)
public TemplateJob generateTemplateJob(String templateName, java.util.Map<String,String> fieldDataMap) throws ConnectionException, SettingsException, ZebraCardException, java.io.IOException
ZebraTemplate
generateTemplateJob
in interface ZebraTemplate
templateName
- the name of the template.fieldDataMap
- a map containing the template field names as the keys and the template field values for the key values.ConnectionException
- if the device is busy or an error occurs communicating with the printer.SettingsException
- if an error occurs while generating the template job.ZebraCardException
- on template job generation error.java.io.IOException
- on failure to locate/access the referenced template or image files.ZebraTemplate.generateTemplateJob(String, Map)
public TemplateJob generateTemplateDataJob(String templateData, java.util.Map<String,String> fieldDataMap) throws ConnectionException, SettingsException, ZebraCardException, java.io.IOException
ZebraTemplate
generateTemplateDataJob
in interface ZebraTemplate
templateData
- the XML formatted template data.fieldDataMap
- a map containing the template field names as the keys and the template field values for the key values.ConnectionException
- if the device is busy or an error occurs communicating with the printer.SettingsException
- if an error occurs while generating the template job.ZebraCardException
- on template job generation error.java.io.IOException
- on failure to locate/access the referenced template or image files.ZebraTemplate.generateTemplateDataJob(String, Map)
public java.util.Map<String,String> convertDataDocumentToDataMap(String dataDocument) throws IllegalArgumentException, ZebraCardException
ZebraTemplate
convertDataDocumentToDataMap
in interface ZebraTemplate
dataDocument
- JSON or XML formatted template data document.IllegalArgumentException
- on invalid dataDocument
value or format.ZebraCardException
- on data parsing error.ZebraTemplate.convertDataDocumentToDataMap(String)
© 2016 ZIH Corp. All Rights Reserved.