Commit ff5986c0 authored by psawant's avatar psawant

Forecast Indicator Master EJB creation and UI related changes

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@198090 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6ab252af
package ibase.webitm.ejb.fin;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class ForecastIndicator extends ValidatorEJB implements ForecastIndicatorLocal, ForecastIndicatorRemote
{
private E12GenericUtility genericUtility = new E12GenericUtility();
public String wfValData(String xmlString, String xmlString1, String xmlString2,String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String errString = null;
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
dom2 = parseString(xmlString2);
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
System.out.println("Exception : ForecastIndicator.java : wfValData(String xmlString) : ==>\n"+e.getMessage());
throw new ITMException(e);
}
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
int ctr=0;
String childNodeName = null;
String prdCode="",siteCode="",itemCode="",userId = "",sql="",growthPerc="",reasCode="",columnValue = "";
String errCode="";
String errString="",errorType="";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs=null;
int cnt1=0,cnt=0;
int currentFormNo=0;
int childNodeListLength;
ConnDriver connDriver = new ConnDriver();
ArrayList <String> errList = new ArrayList<String>();
ArrayList <String>errFields = new ArrayList <String> ();
StringBuffer errStringXml = new StringBuffer("");
try
{
conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("user ID form XtraParam : "+userId +"Edit Flag --: "+editFlag);
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch(currentFormNo)
{
case 1 :
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("Child Node Name ----["+childNodeName+"]");
if(childNode.getFirstChild()!=null)//first child of the node !equals to null then
{
columnValue = childNode.getFirstChild().getNodeValue();
}
else
{
columnValue = "";
}
if (childNodeName.equalsIgnoreCase("site_code"))
{
System.out.println("siteCode----["+columnValue+"]");
if (columnValue.length() == 0)
{
errCode = "VTIVSC";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
else if (columnValue != null && columnValue.trim().length() > 0)
{
sql = "select count(*) as cnt from site where site_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, columnValue);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (cnt == 0)
{
errCode = "CONSSITENE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("item_code"))
{
System.out.println(" itemCode -----["+columnValue+"]");
if(columnValue == null || columnValue.length() == 0)
{
errCode = "VITMCODE";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
else if(columnValue != null && columnValue.trim().length() > 0)
{
sql= "SELECT COUNT(*) FROM ITEM WHERE ITEM_CODE = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,columnValue);
rs=pstmt.executeQuery();
if(rs.next()){
cnt1=rs.getInt(1);
}
if(rs!=null){
rs.close();
rs=null;
}
if(pstmt!=null){
pstmt.close();
pstmt=null;
}
System.out.println("Count value for itemCode--["+cnt1+"]");
if(cnt1 == 0){
errCode = "VTTASK4";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
else if (childNodeName.equalsIgnoreCase("prd_code"))
{
System.out.println(" Period -----["+columnValue+"]");
if(columnValue == null || columnValue.length()==0)
{
errCode = "VTINVPROJ0";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
else if(columnValue != null && columnValue.trim().length() > 0)
{
sql= "select count(*) from Period where CODE = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,columnValue);
rs=pstmt.executeQuery();
if(rs.next()){
cnt1=rs.getInt(1);
}
if(rs!=null){
rs.close();
rs=null;
}
if(pstmt!=null){
pstmt.close();
pstmt=null;
}
System.out.println("Count value for prd_code---["+cnt1+"]");
if(cnt1 == 0){
errCode = "VTINVPROJ1";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
else if (childNodeName.equalsIgnoreCase("growth_perc"))
{
System.out.println(" growthPerc -----["+columnValue+"]");
if(columnValue == null || columnValue.length() == 0)
{
errCode = "VGROWPERC";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
else if (childNodeName.equalsIgnoreCase("reas_code"))
{
System.out.println(" reasCode -----["+columnValue+"]");
if(columnValue == null || columnValue.length() == 0)
{
errCode = "VTREAS";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
else if(columnValue.length() > 0)
{
sql= "select count(*) from gencodes where fld_value = ? and fld_name ='REAS_CODE'";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,columnValue.trim());
rs=pstmt.executeQuery();
if(rs.next()){
cnt1=rs.getInt(1);
}
if(rs!=null){
rs.close();
rs=null;
}
if(pstmt!=null){
pstmt.close();
pstmt=null;
}
System.out.println("Count value for reasCode---["+cnt1+"]");
if(cnt1 == 0){
errCode = "VREASCODE";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
}
break;
} //end switch
int errListSize = errList.size();
cnt =0;
String errFldName = null;
if ( errList != null && errListSize > 0 )
{
for (cnt = 0; cnt < errListSize; cnt++ )
{
errCode = errList.get(cnt);
errFldName = errFields.get(cnt);
System.out.println("errCode ..........["+errCode+"]");
errString = getErrorString( errFldName, errCode, userId );
System.out.println("errString .................. ["+errString+"]");
errStringXml.append(errString);
break;
}
errList.clear();
errList = null;
errFields.clear();
errFields = null;
}
else
{
errStringXml = new StringBuffer( "" );
}
} //end try
catch (SQLException se) {
System.out.println("SQLException ::"+se);
se.printStackTrace();
throw new ITMException(se);
}
catch(Exception e)
{
System.out.println("Exception ::"+e);
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn!=null)
{
conn.close();
conn = null;
}
if(connDriver!=null){
connDriver = null;
}
if(rs !=null)
{
rs.close();
rs=null;
}
}
catch(Exception d)
{
d.printStackTrace();
}
}
System.out.println("ErrString ::[ "+errStringXml.toString()+" ]");
return errStringXml.toString();
}
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
public interface ForecastIndicatorLocal extends ValidatorLocal {
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
public interface ForecastIndicatorRemote extends ValidatorLocal {
public String wfValData(Document dom, Document dom1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
--Itm2Menu Query
Insert into ITM2MENU (APPLICATION,LEVEL_1,LEVEL_2,LEVEL_3,LEVEL_4,LEVEL_5,WIN_NAME,DESCR,COMMENTS,MENU_PATH,ICON_PATH,CLOSE_ICON,OPEN_ICON,OBJ_TYPE,CHG_DATE,CHG_TERM,CHG_USER,MOB_DEPLOY,DEFAULT_STATE,DEF_ACTION,MOB_DEPLY,ENT_TYPES)
values ('SCN',1,2,0,0,0,'w_forecast_indicator','Forecast Indicator','Forecast Indicator','SCN.1.2.0.0.0',null,null,null,'T',null,null,null,null,null,null,null,'0 ');
---- system Entry
update system_events set service_code = 'poic_default_ejb',comp_name='ibase.webitm.ejb.fin.ForecastIndicator',comp_type='JB' where obj_name = 'forecast_indicator' and event_code = 'post_item_change';
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_TYPE,COMP_NAME,COMM_FORMAT)
values ('forecast_indicator','pre_validate','1','prv_default_ejb',null,'0',sysdate,'BASE','BASE','2','JB','ibase.webitm.ejb.fin.ForecastIndicator',null);
---Pophelp Query
INSERT INTO POPHELP (FIELD_NAME,MOD_NAME,SQL_STR,DW_OBJECT,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM,DIST_OPT,FILTER_STRING,SQL_INPUT,DEFAULT_COL,POP_ALIGN,QUERY_MODE,PAGE_CONTEXT,POPHELP_COLS,POPHELP_SOURCE,MULTI_OPT,HELP_OPTION,POPUP_XSL_NAME,AUTO_FILL_LEN,THUMB_OBJ,THUMB_IMAGE_COL,THUMB_ALT_COL,AUTO_MIN_LENGTH,OBJ_NAME__DS,DATA_MODEL_NAME,VALIDATE_DATA,ITEM_CHANGE,MSG_NO,FILTER_EXPR,LAYOUT)
values ('ITEM_CODE','W_FORECAST_INDICATOR','SELECT ITEM_CODE, DESCR FROM ITEM WHERE ( UPPER(ITEM_CODE) LIKE UPPER(''%?%'') OR UPPER(DESCR) LIKE UPPER(''%?%'') ) AND ACTIVE = ''Y'' ORDER BY DESCR',null,'Item Code',0,0,sysdate,'BASE','BASE','0',null,':ITEM_CODE,:ITEM_CODE',null,null,null,null,null,null,null,'2',null,'3',null,null,null,'2',null,null,null,null,null,null,null);
---Error Messages Query
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION)
values ('VITMCODE','Item Code should not blank','Item Code should not blank. Input Item Code.','E','Y',null,null,null,sysdate,'BASE','BASE',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION)
values ('VGROWPERC','Growth Perc should not blank','Growth Percentage should not blank. Input Growth Percentage.','E','Y',null,null,null,sysdate,'BASE','BASE',null,null);
INSERT INTO MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION)
values ('VREASCODE','Invalid Reason Code','Reason Code Does Not Exist In Master. Enter Valid Reason Code.','E','Y',null,null,null,sysdate,'BASE','BASE',null,null);
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