Commit df925687 authored by msalla's avatar msalla

User change of site_code__def to check whether user_site exists

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@207747 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3cb81207
......@@ -104,7 +104,7 @@ public class User extends ValidatorEJB implements UserLocal,UserRemote
String custCode=null;
String itemType=null,sampleDate=null,designDate=null;
String passFeqS = null,name = null;
String passFeqS = null,name = null,siteCodeDef=null;
String lsValidUpto = null, lsAccessType = null;
String code = null, entityCode = "", userType = "";
int passFeq=0,cnt = 0;
......@@ -149,7 +149,7 @@ public class User extends ValidatorEJB implements UserLocal,UserRemote
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if ("A".equalsIgnoreCase(editFlag) && childNodeName.equalsIgnoreCase("code"))
{
code = getColumnValue("code",dom);
......@@ -196,7 +196,7 @@ public class User extends ValidatorEJB implements UserLocal,UserRemote
{
passFeqS = getColumnValue("passwd_freq",dom);
passFeq = Integer.parseInt(passFeqS==null?"0":passFeqS.trim());
if(passFeq > 60 || passFeq==0)
{
errCode = "VTPASS7";
......@@ -210,7 +210,7 @@ public class User extends ValidatorEJB implements UserLocal,UserRemote
lsAccessType = getColumnValue("access_type",dom);
lsAccessType = lsAccessType==null?"":lsAccessType.trim();
lsValidUpto = lsValidUpto==null?"":lsValidUpto.trim();
if(lsAccessType.equalsIgnoreCase("T"))
{
if(lsValidUpto.length() == 0)
......@@ -224,10 +224,10 @@ public class User extends ValidatorEJB implements UserLocal,UserRemote
SimpleDateFormat sdf=new SimpleDateFormat(genericUtility.getApplDateFormat());
SimpleDateFormat sdf1=new SimpleDateFormat(genericUtility.getDBDateFormat());
Object dateFrom = sdf.parse(lsValidUpto);
Timestamp s1 = Timestamp.valueOf(sdf1.format(dateFrom)+" 00:00:00.0");
Timestamp s2 = new Timestamp(System.currentTimeMillis());
if(s1.before(s2))
{
errCode = "VVDTERR";
......@@ -244,7 +244,7 @@ public class User extends ValidatorEJB implements UserLocal,UserRemote
userType = getColumnValue("user_type",dom);
entityCode= checkNull(entityCode);
userType= checkNull(userType);
if (entityCode != null && entityCode.trim().length() > 0 )
{
if ("E".equals(userType))
......@@ -289,7 +289,39 @@ public class User extends ValidatorEJB implements UserLocal,UserRemote
errFields.add(childNodeName.toLowerCase());
}
}
//ADDED BY MONIKA FOR USER _SITE VALIDATION ON 17 SEPT 2019
else if(childNodeName.equalsIgnoreCase("site_code__def"))
{
code=genericUtility.getColumnValue("code",dom);
siteCodeDef=genericUtility.getColumnValue("site_code__def",dom);
if("E".equalsIgnoreCase(editFlag))
{
System.out.println("code in xml"+code+" life cycle"+siteCodeDef);
sql="select COUNT(1) as cnt from user_site where user_id=? and site_code=?";
//sql="select COUNT(1) as cnt from user_site where user_id='"+code+"' and site_code='"+siteCodeDef+"'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,code);
pstmt.setString(2,siteCodeDef);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
System.out.println("count xml"+cnt);
rs.close();
pstmt.close();
if(cnt==0)
{
errCode = "VINVURSITE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}//end
}
break;//END FOR
}//END SWITCH
......
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