First Commit

parents
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>shrseclms</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="11"/>
</faceted-project>
package ibase.webitm.ejb.shrseclms;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import ibase.scheduler.utility.interfaces.Schedule;
import ibase.system.config.ConnDriver;
import ibase.utility.BaseLogger;
import ibase.utility.E12GenericUtility;
import ibase.utility.EMail;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.fin.GenerateReceiptPrc;
import ibase.webitm.utility.ITMException;
public class LicenceRenewNotification implements Schedule {
ibase.utility.UserInfoBean userInfo = null;
@Override
public String schedule(HashMap arg0) throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public String schedule(String scheduleParamXML) throws Exception
{
BaseLogger.log("3", userInfo, null, "LicenceRenewNotification.schedule() method called...... ");
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn = null;
String LicenceNum = "", Title = "", Place = "", sql = "", transDB = "", loginCode = "";
String PerformerId="" , Email="",EmpName="", Status="" , IsWorking="";
String TranId="", TranDate="", Reviewer="";
Timestamp NewStartDate=null , NewEndDate=null , EndDate=null ;
StringBuffer valueXmlString = null;
SimpleDateFormat simpleDateFormat = null;
try
{
sql="SELECT lms_license.license_num AS license_num, lms_license.title AS title, lms_license.place AS place, lms_license.performer_id AS performer_id, TRIM(employee.emp_fname) || ' ' || TRIM(employee.emp_lname) AS emp_name, employee.email_id_off AS email, lms_license.new_start_date AS new_start_date, lms_license.new_end_date AS new_end_date, lms_license.end_date AS end_date, lms_license.status AS status, lms_license.is_working AS is_working, lms_license.tran_id AS tran_id, lms_license.tran_date AS tran_date, lms_license.reviewer AS reviewer, lms_license.add_user AS add_user, lms_license.add_date AS add_date, lms_license.add_term AS add_term, lms_license.chg_user AS chg_user, lms_license.chg_date AS chg_date, lms_license.comments AS comments FROM lms_license LEFT JOIN employee ON lms_license.performer_id = employee.emp_code WHERE ((coalesce(lms_license.new_end_date, lms_license.end_date) = current_date + 30) OR (coalesce(lms_license.new_end_date, lms_license.end_date) BETWEEN current_date AND current_date + 5)) AND (lms_license.status = 'A' OR lms_license.status = 'Active') ORDER BY nvl(lms_license.new_end_date, lms_license.end_date)";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next())
{
LicenceNum = rs.getString("license_num");
Title=rs.getString("title");
Place=rs.getString("place");
PerformerId=rs.getString("performer_id");
EmpName=rs.getString("emp_name");
Email=rs.getString("email");
NewStartDate=rs.getTimestamp("new_start_date");
NewEndDate=rs.getTimestamp("new_end_date");
EndDate=rs.getTimestamp("end_date");
Status=rs.getString("status");
IsWorking=rs.getString("is_working");
Reviewer=rs.getString("reviewer");
valueXmlString = new StringBuffer("<?xml version='1.0' encoding='UTF-8'?><ROOT>");
valueXmlString = new StringBuffer("<TRANS_INFO>");
valueXmlString.append("<OBJ_NAME>").append("<![CDATA[lms_licenseedit]]>").append("</OBJ_NAME>");
valueXmlString.append("<REF_SER>").append("<![CDATA[LICENS]]>").append("</REF_SER>");
valueXmlString.append("<REF_ID>").append("<![CDATA[" + LicenceNum + "]]>").append("</REF_ID>");
valueXmlString.append("<LINE_NO>").append("<![CDATA[]]>").append("</LINE_NO>");
valueXmlString.append("</TRANS_INFO>");
valueXmlString.append("<MAIL>");
valueXmlString.append("<EMAIL_TYPE>").append("<![CDATA[]]>").append("</EMAIL_TYPE>");
valueXmlString.append("<ENTITY_CODE>").append("<![CDATA[" + PerformerId + "]]>").append("</ENTITY_CODE>");
valueXmlString.append("<ENTITY_TYPE>").append("<![CDATA[" + "E" + "]]>").append("</ENTITY_TYPE>");
valueXmlString.append("<FORMAT_CODE>").append("<![CDATA[" + "LICENSE_EXPIER" +"]]>").append("</FORMAT_CODE>");
valueXmlString.append("<TO_ADD>").append("<![CDATA[]]>").append("</TO_ADD>");
valueXmlString.append("<CC_ADD>").append("<![CDATA[]]>").append("</CC_ADD>");
valueXmlString.append("<ATTACHMENT><BODY></BODY><LOCATION></LOCATION></ATTACHMENT>");
valueXmlString.append("</MAIL>");
valueXmlString.append("<XML_DATA>");
valueXmlString.append("<Detail1>");
valueXmlString.append("<license_num>").append("<![CDATA[" + LicenceNum + "]]>").append("</license_num>");
valueXmlString.append("<title>").append("<![CDATA[" + Title + "]]>").append("</title>");
valueXmlString.append("<place>").append("<![CDATA[" + Place + "]]>").append("</place>");
valueXmlString.append("<performer_id>").append("<![CDATA[" + PerformerId + "]]>").append("</performer_id>");
valueXmlString.append("<status>").append("<![CDATA[" + Status + "]]>").append("</status>");
valueXmlString.append("<is_working>").append("<![CDATA[" + IsWorking + "]]>").append("</is_working>");
valueXmlString.append("<reviewer>").append("<![CDATA[" + Reviewer + "]]>").append("</reviewer>");
valueXmlString.append("</Detail1>");
valueXmlString.append("</XML_DATA>");
// valueXmlString.append("<XML_DATA>").append(PerformerId).append("</XML_DATA>");
valueXmlString.append("</ROOT>");
String mailDomStr = valueXmlString.toString();
System.out.println("@@## [EmpITProof] :sendMail mailDomStr :-->" + mailDomStr);
EMail email = new EMail();
email.sendMail(mailDomStr, "ITM", conn);
System.out.println("Email delivered successfully" );
valueXmlString.setLength(0);
//valueXmlString.clear();//Clear Method Not defined in valueXmlString
valueXmlString = null;
}
}
catch(Exception ex)
{
BaseLogger.log("3", userInfo, null, "inside scheduler exception:::"+ex.getMessage());
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch ( Exception e )
{
e.printStackTrace();
}
}
return "";
}
@Override
public String schedulePriority(String arg0) throws Exception {
// TODO Auto-generated method stub
return null;
}
private String checkNull(String input)
{
if (input == null || "null".equals(input))
{
input = " ";
}
return input;
}
}
\ No newline at end of file
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