Java Code Examples for com.ims.query.builder.client.exceptions.QueryBuilderClientException

The following are top voted examples for showing how to use com.ims.query.builder.client.exceptions.QueryBuilderClientException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private byte[] prepairPrintCorrespondenceDoc()
{

	// get saved document from local context
	CorrespondenceDetailsVo voCorrespondenceDetails = form.getLocalContext().getcorrespondenceDetails();

	byte[] resultPdf;
	resultPdf = null;
	try
	{
		resultPdf = buildDocumentPDF(voCorrespondenceDetails);
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Report Generation Failed for the following reason(s): " + e.getMessage());
		return null;
	}

	return resultPdf;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void previewLetter()
{
	// get saved document from local context
	CorrespondenceDetailsVo voCorrespondenceDetails = form.getLocalContext().getcorrespondenceDetails();

	byte[] resultPdf;
	resultPdf = null;
	try
	{
		resultPdf = buildDocumentPDF(voCorrespondenceDetails);
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Report Generation Failed for the following reason(s): " + e.getMessage());
		return;
	}

	if (null != resultPdf)
		voCorrespondenceDetails.getCurrentDocument().setContent(new String(resultPdf));

	if (!saveDocumentDetails(voCorrespondenceDetails))
		return;

	engine.open(form.getForms().Correspondence.ProcessReport);
}
 
Example 3
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void previewLetter()
{
	// get saved document from local context
	CorrespondenceDetailsVo voCorrespondenceDetails = form.getLocalContext().getcorrespondenceDetails();

	byte[] resultPdf;
	resultPdf = null;
	try
	{
		resultPdf = buildDocumentPDF(voCorrespondenceDetails);
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Report Generation Failed for the following reason(s): " + e.getMessage());
		return;
	}

	if (null != resultPdf)
		voCorrespondenceDetails.getCurrentDocument().setContent(new String(resultPdf));

	if (!saveDocumentDetails(voCorrespondenceDetails))
		return;

	previewDoc();
}
 
Example 4
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private byte[] prepairPrintCorrespondenceDoc()
{

	// get saved document from local context
	CorrespondenceDetailsVo voCorrespondenceDetails = form.getLocalContext().getcorrespondenceDetails();

	byte[] resultPdf;
	resultPdf = null;
	try
	{
		resultPdf = buildDocumentPDF(voCorrespondenceDetails);
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Report Generation Failed for the following reason(s): " + e.getMessage());
		return null;
	}

	return resultPdf;
}
 
Example 5
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
/**
 * Function used to print document to printer (uses QueryBuilderClient but bypasses query server)
 * @param printerName
 */
private void printDocument(String printerName)
{
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());
	
	try
	{
		client.printReport(readFile(form.getLocalContext().getFilePath()), urlReportServer, printerName, 1);
		
		engine.showMessage("Document printed to: " + printerName); //WDEV-15422
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Could not print document.");
		e.printStackTrace();
	}
}
 
Example 6
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void loadPrinterList()
{
	form.cmbPrint().clear();		
	QueryBuilderClient qbc = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());

	try
	{
		PrinterAvailableCollection printers = qbc.listPrinters(ConfigFlag.GEN.REPORT_SERVER_URL.getValue());
		String[] printersColl = new String[printers.size()];

		for (int i = 0; i < printers.size(); i++)
		{
			form.cmbPrint().newRow(printers.get(i).getName(), printers.get(i).getName());
			printersColl[i] = printers.get(i).getName();
		}
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Error getting the printers list: " + e.toString());
		return;
	}
}
 
Example 7
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
@Override
protected void onBtnPrintClick() throws PresentationLogicException
{
	if(form.cmbPrint().getValue() == null)
	{
		engine.showMessage("Please select a printer.");
		return;
	}
	
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	QueryBuilderClient cl = new QueryBuilderClient(urlQueryServer, engine.getSessionId());
	
	try
	{
		cl.printReport(readFile(form.getLocalContext().getICPReport()), urlReportServer, form.cmbPrint().getValue(), 1);
	}
	catch (QueryBuilderClientException e)
	{
		e.printStackTrace();
	}
	
	engine.showMessage("The report has been sent to printer '" + form.cmbPrint().getValue() + "'.");
}
 
Example 8
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void loadPrinterList()
{
	form.cmbPrintTo().clear();

	QueryBuilderClient qbc = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());

	try
	{
		PrinterAvailableCollection printers = qbc.listPrinters(ConfigFlag.GEN.REPORT_SERVER_URL.getValue());

		String[] printersColl = new String[printers.size()];

		for (int i = 0; i < printers.size(); i++)
		{
			form.cmbPrintTo().newRow(printers.get(i).getName(), printers.get(i).getName());
			printersColl[i] = printers.get(i).getName();
		}
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Error getting the printers list: " + e.toString());
	}
}
 
Example 9
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void loadPrinterList()
{
	form.cmbPrint().clear();		
	QueryBuilderClient qbc = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());

	try
	{
		PrinterAvailableCollection printers = qbc.listPrinters(ConfigFlag.GEN.REPORT_SERVER_URL.getValue());
		String[] printersColl = new String[printers.size()];

		for (int i = 0; i < printers.size(); i++)
		{
			form.cmbPrint().newRow(printers.get(i).getName(), printers.get(i).getName());
			printersColl[i] = printers.get(i).getName();
		}
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Error getting the printers list: " + e.toString());
		return;
	}
}
 
Example 10
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
protected void onBtnViewClick() throws PresentationLogicException
{
	PrintAgentDocumentsVo doc = form.grdDocuments().getValue();

	if(doc == null)
	{
		engine.showMessage("Please select a document to view !");
		return;
	}

	QueryBuilderClient qb = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());
	
	try
	{
		byte[] pdf = qb.convertReport(ConfigFlag.GEN.REPORT_SERVER_URL.getValue(), doc.getDocument().getBytes(), QueryBuilderClient.PDF, "", 1);
		String url = qb.prepareReportForViewing(pdf, "PDF"); 
		
		engine.openUrl(url);
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Error viewing document: " + e.toString());
		return;
	}
}
 
Example 11
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void processPhlebotomyReport(QueryBuilderClient client,String urlReportServer, String repXml, String templXml, PhlebotomyRoundVo round) 
{			
	client.getSeeds().clear();
	client.addSeed(new SeedValue("PhlebotomyRound_id", round.getID_PhlebotomyRound(), Integer.class));
	client.addSeed(new SeedValue("Patient_id", null, Integer.class));
	
	try
	{					
		client.printReport(repXml, templXml, urlReportServer,form.qmbPrinter().getValue(), 1);
		
	} 
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error building the report: " + e1.toString());
		return;
	}						
	
}
 
Example 12
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private void processLabelsPrintedFromOrderReport(QueryBuilderClient client,String urlReportServer, String repXml2, String templXml2,OrderSpecimenLiteVo specimen) 
{
					
	client.getSeeds().clear();
	client.addSeed(new SeedValue("OrderSpecimen_id", specimen.getID_OrderSpecimen(), Integer.class));				
	
	try
	{					
		client.printReport(repXml2, templXml2, urlReportServer, form.qmbPrinterLabels().getValue(), 1);

	} 
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error building the report: " + e1.toString());
		return;
	}						
		
}
 
Example 13
Project: AvoinApotti   File: Logic.java   View source code 6 votes vote down vote up
private byte[] processResultSummaryReport(QueryBuilderClient client, String urlReportServer, String repXml2, String templXml2,int inv_id,int page_start)
{
	byte[] doc = null;
	
	client.getSeeds().clear();
	client.addSeed(new SeedValue("OrderInvestigation_id",inv_id , java.lang.Integer.class));
	client.addSeed(new SeedValue("PAGE_START", page_start, java.lang.Integer.class));
	
	try
	{					
		doc = client.buildReport(repXml2, templXml2, urlReportServer, QueryBuilderClient.PDF, "", 1);

	} 
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error building the report: " + e1.toString());
		return null;
	}
			
	return doc;	
}
 
Example 14
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void previewLetter()
{
	// get saved document from local context
	CorrespondenceDetailsVo voCorrespondenceDetails = form.getLocalContext().getcorrespondenceDetails();

	byte[] resultPdf;
	resultPdf = null;
	try
	{
		resultPdf = buildDocumentPDF(voCorrespondenceDetails);
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Report Generation Failed for the following reason(s): " + e.getMessage());
		return;
	}

	if (null != resultPdf)
		voCorrespondenceDetails.getCurrentDocument().setContent(new String(resultPdf));

	if (!saveDocumentDetails(voCorrespondenceDetails))
		return;

	engine.open(form.getForms().Correspondence.ProcessReport);
}
 
Example 15
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private byte[] prepairPrintCorrespondenceDoc()
{

	// get saved document from local context
	CorrespondenceDetailsVo voCorrespondenceDetails = form.getLocalContext().getcorrespondenceDetails();

	byte[] resultPdf;
	resultPdf = null;
	try
	{
		resultPdf = buildDocumentPDF(voCorrespondenceDetails);
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Report Generation Failed for the following reason(s): " + e.getMessage());
		return null;
	}

	return resultPdf;
}
 
Example 16
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
/**
 * Function used to print document to printer (uses QueryBuilderClient but bypasses query server)
 * @param printerName
 */
private void printDocument(String printerName)
{
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());
	
	try
	{
		client.printReport(readFile(form.getLocalContext().getFilePath()), urlReportServer, printerName, 1);
		
		engine.showMessage("Document printed to: " + printerName); //WDEV-15422
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Could not print document.");
		e.printStackTrace();
	}
}
 
Example 17
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
/**
 * Function used to print document to printer (uses QueryBuilderClient but bypasses query server)
 * @param printerName
 */
private void printDocument(String printerName)
{
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());
	
	try
	{
		client.printReport(readFile(form.getLocalContext().getFilePath()), urlReportServer, printerName, 1);
		
		engine.showMessage("Document printed to: " + printerName); //WDEV-15422
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Could not print document.");
		e.printStackTrace();
	}
}
 
Example 18
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void loadPrinterList()
{
	form.cmbPrinter().clear();		
	QueryBuilderClient qbc = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());

	try
	{
		PrinterAvailableCollection printers = qbc.listPrinters(ConfigFlag.GEN.REPORT_SERVER_URL.getValue());
		String[] printersColl = new String[printers.size()];

		for (int i = 0; i < printers.size(); i++)
		{
			form.cmbPrinter().newRow(printers.get(i).getName(), printers.get(i).getName());
			printersColl[i] = printers.get(i).getName();
		}
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Error getting the printers list: " + e.toString());
		return;
	}
}
 
Example 19
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
@Override
protected void onBtnPrintClick() throws PresentationLogicException
{
	if(form.cmbPrint().getValue() == null)
	{
		engine.showMessage("Please select a printer.");
		return;
	}
	
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	QueryBuilderClient cl = new QueryBuilderClient(urlQueryServer, engine.getSessionId());
	
	try
	{
		cl.printReport(readFile(form.getLocalContext().getICPReport()), urlReportServer, form.cmbPrint().getValue(), 1);
	}
	catch (QueryBuilderClientException e)
	{
		e.printStackTrace();
	}
	
	engine.showMessage("The report has been sent to printer '" + form.cmbPrint().getValue() + "'.");
}
 
Example 20
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void loadPrinterList()
{
	form.cmbPrint().clear();		
	QueryBuilderClient qbc = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());

	try
	{
		PrinterAvailableCollection printers = qbc.listPrinters(ConfigFlag.GEN.REPORT_SERVER_URL.getValue());
		String[] printersColl = new String[printers.size()];

		for (int i = 0; i < printers.size(); i++)
		{
			form.cmbPrint().newRow(printers.get(i).getName(), printers.get(i).getName());
			printersColl[i] = printers.get(i).getName();
		}
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Error getting the printers list: " + e.toString());
		return;
	}
}
 
Example 21
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void loadPrinterList()
{
	form.cmbPrint().clear();		
	QueryBuilderClient qbc = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());

	try
	{
		PrinterAvailableCollection printers = qbc.listPrinters(ConfigFlag.GEN.REPORT_SERVER_URL.getValue());
		String[] printersColl = new String[printers.size()];

		for (int i = 0; i < printers.size(); i++)
		{
			form.cmbPrint().newRow(printers.get(i).getName(), printers.get(i).getName());
			printersColl[i] = printers.get(i).getName();
		}
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Error getting the printers list: " + e.toString());
		return;
	}
}
 
Example 22
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
protected void onBtnViewClick() throws PresentationLogicException
{
	PrintAgentDocumentsVo doc = form.grdDocuments().getValue();

	if(doc == null)
	{
		engine.showMessage("Please select a document to view !");
		return;
	}

	QueryBuilderClient qb = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());
	
	try
	{
		byte[] pdf = qb.convertReport(ConfigFlag.GEN.REPORT_SERVER_URL.getValue(), doc.getDocument().getBytes(), QueryBuilderClient.PDF, "", 1);
		String url = qb.prepareReportForViewing(pdf, "PDF"); 
		
		engine.openUrl(url);
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Error viewing document: " + e.toString());
		return;
	}
}
 
Example 23
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void processLabelsPrintedFromOrderReport(QueryBuilderClient client,String urlReportServer, String repXml2, String templXml2,OrderSpecimenLiteVo specimen) 
{
					
	client.getSeeds().clear();
	client.addSeed(new SeedValue("OrderSpecimen_id", specimen.getID_OrderSpecimen(), Integer.class));				
	
	try
	{					
		client.printReport(repXml2, templXml2, urlReportServer, form.qmbPrinterLabels().getValue(), 1);

	} 
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error building the report: " + e1.toString());
		return;
	}						
		
}
 
Example 24
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private byte[] processResultSummaryReport(QueryBuilderClient client, String urlReportServer, String repXml2, String templXml2,int inv_id,int page_start)
{
	byte[] doc = null;
	
	client.getSeeds().clear();
	client.addSeed(new SeedValue("OrderInvestigation_id",inv_id , java.lang.Integer.class));
	client.addSeed(new SeedValue("PAGE_START", page_start, java.lang.Integer.class));
	
	try
	{					
		doc = client.buildReport(repXml2, templXml2, urlReportServer, QueryBuilderClient.PDF, "", 1);

	} 
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error building the report: " + e1.toString());
		return null;
	}
			
	return doc;	
}
 
Example 25
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void previewLetter()
{
	// get saved document from local context
	CorrespondenceDetailsVo voCorrespondenceDetails = form.getLocalContext().getcorrespondenceDetails();

	byte[] resultPdf;
	resultPdf = null;
	try
	{
		resultPdf = buildDocumentPDF(voCorrespondenceDetails);
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Report Generation Failed for the following reason(s): " + e.getMessage());
		return;
	}

	if (null != resultPdf)
		voCorrespondenceDetails.getCurrentDocument().setContent(new String(resultPdf));

	if (!saveDocumentDetails(voCorrespondenceDetails))
		return;

	previewDoc();
}
 
Example 26
Project: openMAXIMS   File: Logic.java   View source code 6 votes vote down vote up
private void processPhlebotomyReport(QueryBuilderClient client,String urlReportServer, String repXml, String templXml, PhlebotomyRoundVo round) 
{			
	client.getSeeds().clear();
	client.addSeed(new SeedValue("PhlebotomyRound_id", round.getID_PhlebotomyRound(), Integer.class));
	client.addSeed(new SeedValue("Patient_id", null, Integer.class));
	
	try
	{					
		client.printReport(repXml, templXml, urlReportServer,form.qmbPrinter().getValue(), 1);
		
	} 
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error building the report: " + e1.toString());
		return;
	}						
	
}
 
Example 27
Project: openmaxims-linux   File: Logic.java   View source code 6 votes vote down vote up
private void loadPrinterList()
{
	form.cmbPrint().clear();		
	QueryBuilderClient qbc = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());

	try
	{
		PrinterAvailableCollection printers = qbc.listPrinters(ConfigFlag.GEN.REPORT_SERVER_URL.getValue());
		String[] printersColl = new String[printers.size()];

		for (int i = 0; i < printers.size(); i++)
		{
			form.cmbPrint().newRow(printers.get(i).getName(), printers.get(i).getName());
			printersColl[i] = printers.get(i).getName();
		}
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage("Error getting the printers list: " + e.toString());
		return;
	}
}
 
Example 28
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
/**
 * 
 */
private byte[] buildDocumentPDF(CorrespondenceDetailsVo voCorrespondenceDetails) throws QueryBuilderClientException
{
	Integer iDocId;
	iDocId = voCorrespondenceDetails.getID_CorrespondenceDetails();

	form.getGlobalContext().Correspondence.setDocDetailIdReportSeed(iDocId);
	// generate the document for viewing
	form.getGlobalContext().Core.setReportID(form.getGlobalContext().Correspondence.getReportTemplate().getReport().getID_ReportBo());
	form.getGlobalContext().Core.setTemplateID(form.getGlobalContext().Correspondence.getReportTemplate().getID_TemplateBo());

	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	String[] obj = null;
	try
	{
		obj = domain.getReportAndTemplate(form.getGlobalContext().Core.getReportID(), form.getGlobalContext().Core.getTemplateID());
	}
	catch (DomainInterfaceException e)
	{
		engine.showMessage("I could not get the report and template !");
		return null;
	}

	if (obj == null || obj.length == 0)
	{
		engine.showMessage("I could not get the report and template !");
		return null;
	}

	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());

	if (form.getGlobalContext().Correspondence.getDocDetailIdReportSeedIsNotNull())
		client.addSeed(new SeedValue("CorrespondenceDetails_id", form.getGlobalContext().Correspondence.getDocDetailIdReportSeed(), Integer.class));

	return client.buildReport(obj[0], obj[1], urlReportServer, QueryBuilderClient.FP3, "", 1);

}
 
Example 29
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
protected void onFormOpen(Object[] args) throws ims.framework.exceptions.FormOpenException
{ 
	//list available printers
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();		
	QueryBuilderClient client = new QueryBuilderClient(urlReportServer,engine.getSessionId());
	
	if(args.length >0)
	{
	Integer numberOfPrints = (Integer) args[0];
	// sets Number of prints to the number of addressees
	form.intHeaded().setValue(numberOfPrints);
	form.intStandard().setValue(numberOfPrints);
	}
	else
	{
		form.intHeaded().setValue(new Integer(1));
		form.intStandard().setValue(new Integer(1));
	}
	
	
	try
	{
		PrinterAvailableCollection printersColl = client.listPrinters(urlReportServer);
		if (printersColl != null)
		{
			for(int i=0;i<printersColl.size();i++)
			{
				form.cmbHeadedPaper().newRow(printersColl.get(i).getName(),printersColl.get(i).getName());
				form.cmbStandard().newRow(printersColl.get(i).getName(),printersColl.get(i).getName());
			}				
		}			
	}
	catch (QueryBuilderClientException e)
	{
		engine.showMessage(e.getMessage());
		form.setMode(FormMode.VIEW);
	}

}
 
Example 30
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
/**
 * 
 */
private byte[] buildDocumentPDF(CorrespondenceDetailsVo voCorrespondenceDetails) throws QueryBuilderClientException
{
	Integer iDocId;
	iDocId = voCorrespondenceDetails.getID_CorrespondenceDetails();

	form.getGlobalContext().Correspondence.setDocDetailIdReportSeed(iDocId);
	// generate the document for viewing
	form.getGlobalContext().Core.setReportID(form.getGlobalContext().Correspondence.getReportTemplate().getReport().getID_ReportBo());
	form.getGlobalContext().Core.setTemplateID(form.getGlobalContext().Correspondence.getReportTemplate().getID_TemplateBo());

	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	String[] obj = null;
	try
	{
		obj = domain.getReportAndTemplate(form.getGlobalContext().Core.getReportID(), form.getGlobalContext().Core.getTemplateID());
	}
	catch (DomainInterfaceException e)
	{
		engine.showMessage("I could not get the report and template !");
		return null;
	}

	if (obj == null || obj.length == 0)
	{
		engine.showMessage("I could not get the report and template !");
		return null;
	}

	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());

	if (form.getGlobalContext().Correspondence.getDocDetailIdReportSeedIsNotNull())
		client.addSeed(new SeedValue("CorrespondenceDetails_id", form.getGlobalContext().Correspondence.getDocDetailIdReportSeed(), Integer.class));

	return client.buildReport(obj[0], obj[1], urlReportServer, QueryBuilderClient.FP3, "", 1);

}
 
Example 31
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private String getIFrameCode() throws DomainInterfaceException
{
	StringBuffer sb = new StringBuffer(1000);
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();

	String[] obj = null;

	obj = domain.getReportAndTemplate(form.getGlobalContext().Core.getReportID(), form.getGlobalContext().Core.getTemplateID());

	if (obj == null || obj.length == 0)
	{
		engine.showMessage("I could not get the report and template !");
		return sb.toString();
	}

	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());

	// get report seed name
	if (form.getGlobalContext().Correspondence.getDocDetailIdReportSeedIsNotNull())
		client.addSeed(new SeedValue("DocumentDetails_id", form.getGlobalContext().Correspondence.getDocDetailIdReportSeed(), Integer.class));

	String result = "";

	try
	{
		result = client.buildReportAsUrlInlineFrame(obj[0], obj[1], urlReportServer, "PDF", "", 1);
		sb.append(result);

	}
	catch (QueryBuilderClientException e1)
	{
		return e1.toString();
	}

	return sb.toString();
}
 
Example 32
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private String getIFrameCode() throws DomainInterfaceException
{
	StringBuffer sb = new StringBuffer(1000);
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	
	String[] obj = null;
	
	obj = domain.getReportAndTemplate(form.getGlobalContext().Core.getReportID(), form.getGlobalContext().Core.getTemplateID());

	if(obj == null || obj.length == 0)
	{
		engine.showMessage("I could not get the report and template !");
		return sb.toString();
	}
	
	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer,engine.getSessionId());
			
	//get report seed name
	if (form.getGlobalContext().Correspondence.getDocDetailIdReportSeedIsNotNull())
		client.addSeed(new SeedValue("DocumentDetails_id",form.getGlobalContext().Correspondence.getDocDetailIdReportSeed(),Integer.class));
	
	String result = "";
	
	try
	{
		result = client.buildReportAsUrlInlineFrame(obj[0], obj[1], urlReportServer, "PDF", "",1);
		sb.append(result);
		
	} catch (QueryBuilderClientException e1)
	{
		return e1.toString();
	} 
	
	return sb.toString();
}
 
Example 33
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void printReport()
{
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer =ConfigFlag.GEN.REPORT_SERVER_URL.getValue();

	String[] obj = null;
	try
	{
		obj = domain.getReportAndTemplate(form.getGlobalContext().Core.getReportID(), form.getGlobalContext().Core.getTemplateID());
	}
	catch (DomainInterfaceException e)
	{
		engine.showMessage("Error retrieving report template !\r\n" + e.getMessage());
		return;
	}

	if (obj == null || obj.length == 0)
	{
		engine.showMessage("I could not get the report and template !");
		return;
	}

	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());

	client.addSeed(new SeedValue("CarePlan_id", form.getLocalContext().getCarePlan().getID_CarePlan(), Integer.class));

	String resultUrl = "";

	try
	{
		resultUrl = client.buildReportAsUrl(obj[0], obj[1], urlReportServer, QueryBuilderClient.PDF, "", 1);
	}
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error creating report: " + e1.getMessage());
		return;
	}

	engine.openUrl(resultUrl);
}
 
Example 34
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void printReport()
{
	if(form.layerControl1().movement().comboAllMovements().getValue() == null)
	{
		engine.showMessage("No Movement Record Selected");
		return;
	}
	
	
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();

	String[] obj = null;
	obj = domain.getReportAndTemplate(form.getGlobalContext().Core.getReportID(), form.getGlobalContext().Core.getTemplateID());
	
	if(obj == null || obj.length == 0)
	{
		engine.showMessage("Failed to retrieve the report and template !");
		return;
	}
	
	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());
	
	client.addSeed(new SeedValue("PatientMovementHandling_id", form.layerControl1().movement().comboAllMovements().getValue().getID_Assessment(), Integer.class));
	client.addSeed(new SeedValue("PATIDTYPE", new Integer(PatIdType.CHARTNUM.getID()), Integer.class));
	
	String resultUrl = "";
	try
	{
		resultUrl = client.buildReportAsUrl(obj[0], obj[1], urlReportServer, QueryBuilderClient.PDF, "", 1);		
	} 
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error creating report: " + e1.getMessage());
		return;
	}
	
	engine.openUrl(resultUrl);
}
 
Example 35
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private String createReport(TemplateForPatientDocumentVo repTemplate, PatientDocumentVo doc) 
{
	if(repTemplate == null)
		return null;
	
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();

	ReportTemplateVo template = domain.getTemplate(repTemplate);

	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());
	ReportSeedParsedVoCollection seeds = getSeedsFromReport(template.getReport().getReportXml());

	addSeedsForTemplate(client, seeds, doc);
	
	if(!addValueForNonMandatorySeeds(client, seeds))//	WDEV-14299
		return null;
	
	String [] errors = checkForSeeds(seeds, client);
	
	if(errors != null && errors.length > 0)
	{
		engine.showErrors(errors);
		return null;
	}
	
	String fileName;
	try
	{
		fileName = client.buildReportAndUpload(getWorkAreaPath(), template.getReport().getReportXml(), template.getTemplateXml(), urlReportServer, QueryBuilderClient.RTF, "", 1, false); //WDEV-13366
	}
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error creating report: " + e1.getMessage());
		return null;
	}

	return fileName;
}
 
Example 36
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
/**
* builds and Assessment report
*/
@Deprecated
public void buildAssessmentReport(ims.vo.ValueObjectRef refVo)
{
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	
	String obj[] = domain.getReportAndTemplate(refVo);
	
	if(obj == null)
	{
		engine.showMessage("I could not get the report and template linked to this assessment !");
		return;
	}
	
	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());

	client.addSeed(new SeedValue("CareContext_id", form.getGlobalContext().Core.getCurrentCareContextIsNotNull() ? form.getGlobalContext().Core.getCurrentCareContext().getID_CareContext() : null, Integer.class));
	client.addSeed(new SeedValue("ClinicalContact_id", form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() ? form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact() : null, Integer.class));
	
	String resultUrl = "";
	try
	{
		resultUrl = client.buildReportAsUrlInlineFrame(obj[0], obj[1], urlReportServer, QueryBuilderClient.HTML, "", 1);
	} 
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error creating report: " + e1.getMessage());
		return;
	}
	
	form.htmView().setHTML(resultUrl);
}
 
Example 37
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
public void buildAssessmentReport(PatientAssessmentRefVo patientAssessmentRef)
{
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();
	
	String obj[] = domain.getReportAndTemplate(patientAssessmentRef);
	
	if (obj == null || obj.length < 2 || obj[0] == null || obj[1] == null)
	{
		engine.showMessage("I could not get the report and template linked to this assessment !");
		return;
	}
	
	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());

	// WDEV-13300
	// PatientAssessment reports in new version use PatientAssessment_ID, but some old versions use a combination of
	// CareContext_id and ClinicalContact_id - so we need to set all tree as seeds. Reports are ignoring the extra & unused seeds
	client.addSeed(new SeedValue("PatientAssessment_id", patientAssessmentRef.getID_PatientAssessment(), Integer.class));
	client.addSeed(new SeedValue("CareContext_id", form.getGlobalContext().Core.getCurrentCareContextIsNotNull() ? form.getGlobalContext().Core.getCurrentCareContext().getID_CareContext() : null, Integer.class));
	client.addSeed(new SeedValue("ClinicalContact_id", form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() ? form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact() : null, Integer.class));
	
	String resultUrl = "";
	try
	{
		resultUrl = client.buildReportAsUrlInlineFrame(obj[0], obj[1], urlReportServer, QueryBuilderClient.HTML, "", 1);
	} 
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error creating report: " + e1.getMessage());
		return;
	}
	
	form.htmView().setHTML(resultUrl);
}
 
Example 38
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private String createReport(PatientShort patient, CareContextMinVo carecontext,PatientDocumentVo doc, PatientDocumentErrorVoCollection errors)
{
	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();

	ReportTemplateVo template = domain.getTemplate((TemplateForPatientDocumentVo) form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue());

	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());
	ReportSeedParsedVoCollection seeds = getSeedsFromReport(template.getReport().getReportXml());

	addSeedsForTemplate(client, seeds, patient, carecontext,doc);
	
	if(!addValueForNonMandatorySeeds(client, seeds))//	WDEV-14299
	{
		errors.add(createError(patient, carecontext, "Could not be created"));
		return null;
	}
	
	String [] errorsSeed = checkForSeeds(seeds, client);
	
	if(errorsSeed != null && errorsSeed.length > 0)
	{
		errors.add(createError(patient, carecontext, "Could not be created"));
		return null;
	}
	
	String fileName;
	try
	{
		fileName = client.buildReportAndUpload(getWorkAreaPath(), template.getReport().getReportXml(), template.getTemplateXml(), urlReportServer, QueryBuilderClient.RTF, "", 1, false);//WDEV-13366
	}
	catch (QueryBuilderClientException e1)
	{
		errors.add(createError(patient, carecontext, "Could not be created"));
		e1.printStackTrace();
		return null;
	}

	return fileName;
}
 
Example 39
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void open()
{

	String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue();
	String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue();

	Object[] obj = domain.getSystemReportAndTemplate(new Integer(325));

	if (obj == null || obj.length < 2)
	{
		engine.showMessage("I could not get the report and template !");
		return;
	}

	if (obj[0] == null || obj[1] == null)
	{
		engine.showMessage("The report has not been deployed !");
		return;
	}

	QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId());

	client.addSeed(new SeedValue("NeedsAssessment_id", form.getGlobalContext().Core.getNeedsAssessmentId(), Integer.class));

	String resultUrl = "";
	try
	{
		resultUrl = client.buildReportAsUrlInlineFrame((String) obj[0], (String) obj[1], urlReportServer, "PDF", "", 1);
	}
	catch (QueryBuilderClientException e1)
	{
		engine.showMessage("Error creating report: " + e1.getMessage());
		return;
	}

	form.htmViewer().setHTML(resultUrl);
}
 
Example 40
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void printSelectedAdviceLeaflets()
{
	try
	{
		// Get selected advice leaflets
		AdviceLeafletConfigDisplayVoCollection selectedAdviceLeaflets = new AdviceLeafletConfigDisplayVoCollection();

		for (int i = 0; i < form.grdAdviceLeflet().getRows().size(); i++)
		{
			grdAdviceLefletRow adviceRow = form.grdAdviceLeflet().getRows().get(i);

			if (adviceRow.getColSelect())	selectedAdviceLeaflets.add(adviceRow.getValue());
		}

		// For each selected advice leaflet
		for (AdviceLeafletConfigDisplayVo adviceLeaflet : selectedAdviceLeaflets)
		{
			// Get Report and Template from database
			String report[] = domain.getReportAndTemplate(adviceLeaflet.getTemplate());

			// Check for valid report and template
			if (report == null)
			{
				engine.showMessage("No report found for selected advice leaflet");
				return;
			}

			// Create a query builder client instance
			QueryBuilderClient client = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId());

			// Attempt to build report and print it to printer
			String printerName = form.getGlobalContext().Admin.getSelectedPrinter() != null ? form.getGlobalContext().Admin.getSelectedPrinter().getIPrinterName() : null;
			client.buildReport(report[0], report[1], ConfigFlag.GEN.REPORT_SERVER_URL.getValue(), "PDF", printerName, 1);
		}
	}
	catch (QueryBuilderClientException exception)
	{
		exception.printStackTrace();
	}
}