Commit 9a7e8520 authored by pjain's avatar pjain

Issue tracker point no 402


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95380 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a727804f
...@@ -17,6 +17,7 @@ import javax.print.PrintService; ...@@ -17,6 +17,7 @@ import javax.print.PrintService;
import org.w3c.dom.*; import org.w3c.dom.*;
import ibase.system.config.*; import ibase.system.config.*;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
...@@ -231,27 +232,73 @@ public class CheckSheetIC extends ValidatorEJB implements CheckSheetICLocal,Chec ...@@ -231,27 +232,73 @@ public class CheckSheetIC extends ValidatorEJB implements CheckSheetICLocal,Chec
} }
} }
//Changed by sumit on 16/11/12 validating printer service name with existing printer in system start. //Changed by sumit on 16/11/12 validating printer service name with existing printer in system start.
else if ( "printer".equalsIgnoreCase( childNodeName ) ) //else if ( "printer".equalsIgnoreCase( childNodeName ) )
else if ( "printer_name".equalsIgnoreCase( childNodeName ) )
{ {
printer = checkNull(genericUtility.getColumnValue( "printer_name", currFormDataDom )); printer = checkNull(genericUtility.getColumnValue( "printer_name", currFormDataDom ));
System.out.println(" printer from input parameter ["+printer+"]"); System.out.println("CALLIN INSIDE printer from input parameter ["+printer+"]");
PrintService[] printServices = PrinterJob.lookupPrintServices();
ArrayList<String> arry = new ArrayList<String>(); if(printer != null && printer.length() > 0)
if(printer.trim().length() > 0) {
{ //Changed by Dhanraj on 27JUN14 to validate printer name from net printers table.start
for (PrintService printService : printServices) if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{ {
String name = printService.getName();
System.out.println("printer service name --> "+name); sql="select printer_name from net_printers where printer_name= ? ";
arry.add(name); pstmt = conn.prepareStatement(sql);
} pstmt.setString(1, printer.trim());
if( !arry.contains(printer.trim())) rs = pstmt.executeQuery();
{ if( rs.next())
errFields.add( childNodeName.toLowerCase() ); {
errList.add( "INVPRINTER" ); System.out.println("Printer Found in net_printers..........["+printer+"]");
} }
arry.clear(); else
{
errList.add( "INVPRINTER" );
errFields.add( childNodeName.toLowerCase() );
}
pstmt.close();pstmt = null;
rs.close(); rs = null;
}
else
{
PrintService[] printServices = PrinterJob.lookupPrintServices();
ArrayList<String> arry = new ArrayList<String>();
if(printer.trim().length() > 0)
{
for (PrintService printService : printServices)
{
String name = printService.getName();
System.out.println("printer service name --> "+name);
arry.add(name);
}
if( !arry.contains(printer.trim()))
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
arry.clear();
}
}
} }
//end Dhanraj 27Jun14
//hide by Dhanraj 27Jnn14
/*System.out.println(" in inside if");
for (PrintService printService : printServices)
{
String name = printService.getName();
System.out.println("printer service name --> "+name);
arry.add(name);
}
if( !arry.contains(printer.trim()))
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
arry.clear(); */
//Changed by Dhanraj 27JUN14 to validate printer name from net printers table.end
} }
//Changed by sumit on 16/11/12 validating printer service name with existing printer in system end. //Changed by sumit on 16/11/12 validating printer service name with existing printer in system end.
} }
...@@ -839,6 +886,44 @@ public class CheckSheetIC extends ValidatorEJB implements CheckSheetICLocal,Chec ...@@ -839,6 +886,44 @@ public class CheckSheetIC extends ValidatorEJB implements CheckSheetICLocal,Chec
* If null, the function returns blank string otherwise trim the input string and return. * If null, the function returns blank string otherwise trim the input string and return.
* @param input * @param input
*/ */
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
} }
...@@ -385,7 +385,17 @@ public class CheckSheetPos extends ValidatorEJB implements CheckSheetPosLocal, C ...@@ -385,7 +385,17 @@ public class CheckSheetPos extends ValidatorEJB implements CheckSheetPosLocal, C
"</Argument>" + "</Argument>" +
"</Arguments>"; "</Arguments>";
System.out.println(" XSD parser **->["+xsdString+"]"); System.out.println(" XSD parser **->["+xsdString+"]");
errString = jrGenerator.printReport(reportObjName, xsdString, loginCode, printer.trim(), 1, conn); //changed by sankara on 24/06/14 call report from remote
if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{
errString = jrGenerator.callRemotePrintServlet(reportObjName, xsdString, loginCode, printer.trim(), 1, conn);
}
else
{
errString = jrGenerator.printReport(reportObjName, xsdString, loginCode, printer.trim(), 1, conn);
}
//errString = jrGenerator.printReport(reportObjName, xsdString, loginCode, printer.trim(), 1, conn);
} }
catch(Exception e) catch(Exception e)
...@@ -404,5 +414,45 @@ public class CheckSheetPos extends ValidatorEJB implements CheckSheetPosLocal, C ...@@ -404,5 +414,45 @@ public class CheckSheetPos extends ValidatorEJB implements CheckSheetPosLocal, C
} }
return str; return str;
} }
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
} }
...@@ -591,6 +591,44 @@ etc ...@@ -591,6 +591,44 @@ etc
else else
{ {
System.out.println(" in inside if"); System.out.println(" in inside if");
//Changed by Dhanraj on 27JUN14 to validate printer name from net printers table.start
if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{
sql="select printer_name from net_printers where printer_name= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, printer.trim());
rs = pstmt.executeQuery();
if( rs.next())
{
System.out.println("Printer Found in net_printers..........["+printer+"]");
}
else
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
pstmt.close();pstmt = null;
rs.close(); rs = null;
}
else
{
for (PrintService printService : printServices)
{
String name = printService.getName();
System.out.println("printer service name --> "+name);
arry.add(name);
}
if( !arry.contains(printer.trim()))
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
arry.clear();
}
//end Dhanraj 27Jun14
//hide by Dhanraj 27Jnn14
/*System.out.println(" in inside if");
for (PrintService printService : printServices) for (PrintService printService : printServices)
{ {
String name = printService.getName(); String name = printService.getName();
...@@ -602,7 +640,8 @@ etc ...@@ -602,7 +640,8 @@ etc
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" ); errList.add( "INVPRINTER" );
} }
arry.clear(); arry.clear(); */
//Changed by Dhanraj 27JUN14 to validate printer name from net printers table.end
} }
} }
} }
...@@ -900,4 +939,44 @@ etc ...@@ -900,4 +939,44 @@ etc
///return cartonMasterTranCode; ///return cartonMasterTranCode;
} }
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
} }
...@@ -1729,8 +1729,18 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo ...@@ -1729,8 +1729,18 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo
"<value>NATIVE</value>" + "<value>NATIVE</value>" +
"</Argument>" + "</Argument>" +
"</Arguments>"; "</Arguments>";
System.out.println(" XSD parser **->["+xsdString+"]"); System.out.println(" XSD parser **->["+xsdString+"]");
errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn); //changed by sankara on 24/06/14 call report from remote
if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{
errString = jrGenerator.callRemotePrintServlet(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
else
{
errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
//errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
System.out.println(" PRINTING task completed--------**------->"); System.out.println(" PRINTING task completed--------**------->");
//} //}
...@@ -1743,6 +1753,46 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo ...@@ -1743,6 +1753,46 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo
return errString; return errString;
} }
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
} }
...@@ -1256,7 +1256,46 @@ etc ...@@ -1256,7 +1256,46 @@ etc
} }
else if(printer.trim().length() > 0 && "Y".equalsIgnoreCase(printLabel)) else if(printer.trim().length() > 0 && "Y".equalsIgnoreCase(printLabel))
{ {
System.out.println(" in inside if"); //Changed by Dhanraj on 27JUN14 to validate printer name from net printers table.start
if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{
sql="select printer_name from net_printers where printer_name= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, printer.trim());
rs = pstmt.executeQuery();
if( rs.next())
{
System.out.println("Printer Found in net_printers..........["+printer+"]");
}
else
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
pstmt.close();pstmt = null;
rs.close(); rs = null;
}
else
{
for (PrintService printService : printServices)
{
String name = printService.getName();
System.out.println("printer service name --> "+name);
arry.add(name);
}
if( !arry.contains(printer.trim()))
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
arry.clear();
}
//end Dhanraj 27Jun14
//hide by Dhanraj 27Jnn14
/*System.out.println(" in inside if");
for (PrintService printService : printServices) for (PrintService printService : printServices)
{ {
String name = printService.getName(); String name = printService.getName();
...@@ -1268,7 +1307,8 @@ etc ...@@ -1268,7 +1307,8 @@ etc
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" ); errList.add( "INVPRINTER" );
} }
arry.clear(); arry.clear(); */
//Changed by Dhanraj 27JUN14 to validate printer name from net printers table.end
} }
} }
//Changed by sumit on 03/10/12 validating printer service name with existing printer in system end. //Changed by sumit on 03/10/12 validating printer service name with existing printer in system end.
...@@ -1702,4 +1742,43 @@ etc ...@@ -1702,4 +1742,43 @@ etc
return dataVolumeMap; return dataVolumeMap;
} }
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
} }
...@@ -205,7 +205,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -205,7 +205,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
Shipment2 shipment2 = null; Shipment2 shipment2 = null;
//Changed By Pragyan 18-DEC-13 To check ADSI Connection is required.(KB/Ashish mail Dt.121413) //Changed By Pragyan 18-DEC-13 To check ADSI Connection is required.(KB/Ashish mail Dt.121413)
String isADSIConnReq = "N"; String isADSIConnReq = "N";
boolean isRemotePrintRptSrvCofigur = false;
public String process() throws RemoteException,ITMException public String process() throws RemoteException,ITMException
{ {
...@@ -2991,6 +2991,11 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -2991,6 +2991,11 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
//changed by sankara on 24/09/13 for update status in sorddet end. //changed by sankara on 24/09/13 for update status in sorddet end.
try try
{ {
//Changed By Pragyan 30JUN14 to take the connection above
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
//Changed sumit on 25/08/12 //Changed sumit on 25/08/12
waveId = ""; waveId = "";
//Changed by sumit on 14/12/12 getting value of printer start //Changed by sumit on 14/12/12 getting value of printer start
...@@ -3001,6 +3006,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -3001,6 +3006,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
PrintService[] printServices = PrinterJob.lookupPrintServices(); PrintService[] printServices = PrinterJob.lookupPrintServices();
ArrayList<String> arry = new ArrayList<String>(); ArrayList<String> arry = new ArrayList<String>();
//Changed by sumit on 24/11/12 adding print label condition //Changed by sumit on 24/11/12 adding print label condition
isRemotePrintRptSrvCofigur = isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn);
if(printer.trim().length() == 0 && "Y".equalsIgnoreCase(printLabel)) if(printer.trim().length() == 0 && "Y".equalsIgnoreCase(printLabel))
{ {
...@@ -3012,6 +3018,48 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -3012,6 +3018,48 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
} }
else if(printer.trim().length() > 0 && "Y".equalsIgnoreCase(printLabel)) else if(printer.trim().length() > 0 && "Y".equalsIgnoreCase(printLabel))
{ {
//Changed by Dhanraj on 27JUN14 to validate printer name from net printers table.start
if(isRemotePrintRptSrvCofigur)
{
sql="select printer_name from net_printers where printer_name= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, printer.trim());
rs = pstmt.executeQuery();
if( rs.next())
{
System.out.println("Printer Found in net_printers..........["+printer+"]");
}
else
{
errString="INVPRINTER";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
return errString;
}
pstmt.close();pstmt = null;
rs.close(); rs = null;
}
else
{
for (PrintService printService : printServices)
{
String name = printService.getName();
System.out.println("printer service name --> "+name);
arry.add(name);
}
if( !arry.contains(printer.trim()))
{
errString="INVPRINTER";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
return errString;
}
arry.clear();
}
//end Dhanraj 27Jun14
//hide by Dhanraj 27Jnn14
/*System.out.println(" in inside if");
for (PrintService printService : printServices) for (PrintService printService : printServices)
{ {
String name = printService.getName(); String name = printService.getName();
...@@ -3019,12 +3067,12 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -3019,12 +3067,12 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
arry.add(name); arry.add(name);
} }
if( !arry.contains(printer.trim())) if( !arry.contains(printer.trim()))
{ {
errString="INVPRINTER"; errFields.add( childNodeName.toLowerCase() );
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn); errList.add( "INVPRINTER" );
return errString;
} }
arry.clear(); arry.clear(); */
//Changed by Dhanraj 27JUN14 to validate printer name from net printers table.end
} }
//Changed by sumit on 14/12/12 getting value of printer end //Changed by sumit on 14/12/12 getting value of printer end
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
...@@ -3035,10 +3083,11 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -3035,10 +3083,11 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
shipType = genericUtility.getColumnValue("ship_type",headerDom); shipType = genericUtility.getColumnValue("ship_type",headerDom);
directPickLoc = genericUtility.getColumnValue("direct_pick_loc",headerDom); directPickLoc = genericUtility.getColumnValue("direct_pick_loc",headerDom);
ConnDriver connDriver = new ConnDriver(); //Changed By Pragyan 30JUN14 to take the connection above
/*ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null; connDriver = null;*/
shipment2 = null; shipment2 = null;
if(directPickLoc != null && directPickLoc.length() > 0) if(directPickLoc != null && directPickLoc.length() > 0)
...@@ -20354,7 +20403,17 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -20354,7 +20403,17 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
} }
else else
{ {
errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn); //changed by sankara on 24/06/14 for report calling from remote
if(isRemotePrintRptSrvCofigur)
{
errString = jrGenerator.callRemotePrintServlet(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
else
{
errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
//errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
} }
//Changed by sumit on 07/09/12 changed the method as per new requirement //Changed by sumit on 07/09/12 changed the method as per new requirement
...@@ -21718,7 +21777,16 @@ private String generatedLabelPrint(String waveId, String printer, Connection con ...@@ -21718,7 +21777,16 @@ private String generatedLabelPrint(String waveId, String printer, Connection con
"</Argument>" + "</Argument>" +
"</Arguments>"; "</Arguments>";
System.out.println(" XSD parser **->["+xsdString+"]"); System.out.println(" XSD parser **->["+xsdString+"]");
errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn); //errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
if(isRemotePrintRptSrvCofigur)
{
errString = jrGenerator.callRemotePrintServlet(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
else
{
errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
System.out.println(" PRINTING task completed--------**------->"); System.out.println(" PRINTING task completed--------**------->");
//} //}
...@@ -22492,4 +22560,44 @@ private String getInventoryStatus(String locCode,Connection conn) throws ITMExce ...@@ -22492,4 +22560,44 @@ private String getInventoryStatus(String locCode,Connection conn) throws ITMExce
return invStat; return invStat;
} }
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
} }
\ No newline at end of file
package ibase.webitm.wms.reports;
import ibase.system.config.ConnDriver;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.HashPrintServiceAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.PrintServiceAttributeSet;
import javax.print.attribute.standard.PrinterName;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JRPrintServiceExporter;
import net.sf.jasperreports.engine.export.JRPrintServiceExporterParameter;
/**
* Servlet implementation class TestServlet
*/
public class ReportRequesthandlerServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* Default constructor.
* @return
*/
public void RequestreportServlet()
{
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
// TODO Auto-generated method stub
res.setContentType("text/xml");
res.setHeader("Cache-Control", "no-store, no-cache");
JRPrintServiceExporter exporter = new JRPrintServiceExporter();
String printerName = "";
Connection con = null;
String printServiceName = "";
JasperPrint jasperPrint = null;
String retString ="";
try
{
printServiceName = (String)req.getParameter("PRINTER_NAME");
System.out.println("Server Side getting printer BName ::::::::::::["+printServiceName+"]:::::::::::");
DocFlavor psInFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
ObjectInputStream inputStream = null ;
Object objectS = null;
try {
System.out.println("Request URL " + req.getRequestURL());
System.out.println("Request URL " + req.getQueryString());
System.out.println("Avilable bytes " + req.getInputStream().available());
inputStream = new ObjectInputStream(req.getInputStream());
//objectS = (Object)inputStream.readObject();
System.out.println("------------------Reading Object================..");
while ((objectS = inputStream.readObject()) != null)
{
if (objectS instanceof JasperPrint) {
System.out.println("Found with Jasper Print Object");
jasperPrint = (JasperPrint)objectS;
}
}
} catch (EOFException ex) { //This exception will be caught when EOF is reached
System.out.println("End of file reached.");
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
//Close the ObjectInputStream
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
System.out.println("Total Page Size For Print["+jasperPrint.getPages().size() +"]");
PrinterName name = new PrinterName(printServiceName, null);
printServiceAttributeSet.add(name);
exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
exporter.setParameter
(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET,
printRequestAttributeSet);
exporter.setParameter
(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET,
printServiceAttributeSet);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG,
Boolean.FALSE);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG,
Boolean.FALSE);
exporter.exportReport();
}
catch (Exception E)
{
E.printStackTrace();
}
finally
{
try
{
}
catch(Exception d)
{
d.printStackTrace();
}
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException
{
doPost(request,response);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>Struts 2</display-name>
<servlet>
<servlet-name>ReportRequesthandlerServlet</servlet-name>
<servlet-class>ibase.webitm.wms.reports.ReportRequesthandlerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ReportRequesthandlerServlet</servlet-name>
<url-pattern>/ReportRequesthandlerServlet</url-pattern>
</servlet-mapping>
</web-app>
\ No newline at end of file
...@@ -45780,6 +45780,9 @@ VALUES ( ...@@ -45780,6 +45780,9 @@ VALUES (
'Base', 'Base',
NULL, NULL,
NULL); NULL);
--Changed By Pragyan for report sql
INSERT INTO DISPARM DISPARM ( prd_code , var_name, var_type, var_value, descr , var_subs, chg_date, chg_user , chg_term ) VALUES ( '999999', 'IS_REMOTE_PRNTSRV_CONFIGRD', 'S', 'Y', 'FOR WMS TOMCAT SERVER INSTALLATION', 0, TO_DATE('30-06-2014 00:00:00','DD-MM-YYYY HH24:MI:SS'), 'PP', 'P');
commit; commit;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment