@ThingworxBaseTemplateDefinition(name = "GenericThing")
public class CreatePDFTemplate extends Thing {
private static Logger _logger = LogUtilities.getInstance().getApplicationLogger(CreatePDFTemplate.class);
public CreatePDFTemplate() {
// TODO Auto-generated constructor stub
}
// Process Report PDF (using pdfbox)
@ThingworxServiceDefinition(name = "CreatePDFProcessReport", description =
"Service to generate PDF report for Temperer", category ="", isAllowOverride = false, aspects = { "isAsync:false" })
@ThingworxServiceResult(name = "Result", description = "", baseType ="STRING", aspects = {})
public String CreatePDFProcessReport(
@ThingworxServiceParameter(name = "temperer16K", description = "",baseType = "STRING", aspects = { "isRequired:true" }) String temperer16K,
@ThingworxServiceParameter(name = "tempererLOF", description = "",baseType = "STRING", aspects = { "isRequired:true" }) String tempererLOF,
@ThingworxServiceParameter(name = "tunnelTemp16K", description = "",baseType = "STRING", aspects = { "isRequired:true" }) String tunnelTemp16K,
@ThingworxServiceParameter(name = "tunnelTempLOF", description = "",baseType = "STRING", aspects = { "isRequired:true" }) String tunnelTempLOF,
@ThingworxServiceParameter(name = "LoggedUser", description = "", baseType ="USERNAME", aspects = { "isRequired:true" }) String LoggedUser) throws
IOException, DocumentException, JSONException
{
_logger.trace("Entering Service: CreatePDFReportAtom");
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); String
date = dateFormat.format(new Date());
String DEST =
"C:\\ThingworxStorage\\repository\\TestProcessPDF\\ProcessReport_"+
LoggedUser +"_"+ date + ".pdf";
new ProcessReportPDFBox().createPdfProcessReport(DEST,
temperer16K,tempererLOF,tunnelTemp16K,tunnelTempLOF);
_logger.trace("Exiting Service: CreatePDFReportAtom");
return "/Thingworx/FileRepositories/TestProcessPDF/ProcessReport_"+
LoggedUser +"_"+ date + ".pdf";
}
) throws IOException, JSONException
{