Commit ca4be969 authored by Vijay Chaitanya's avatar Vijay Chaitanya Committed by rbonthala-nisum-com

Mt 98 domain changes (#79)

* update code changes

* changes done for saving with Id and Name

* changes done for response for UI

* MT-79 code fix

* changes for defect fixing

* duplicate check in update domain

* defect fix changes

* case senstive changes
parent e09a1938
......@@ -51,8 +51,17 @@ public class DomainServiceImpl implements DomainService {
@Override
public String addDomains(Domains d) throws MyTimeException {
String response=null;
int count=0;
List<Domains> domainList=domainRepo.findByDomainNameAndAccountId(d.getDomainName(), d.getAccountId());
if(domainList.size()>0) {
List<Domains> domainListbyAccountId=domainRepo.findByAccountId(d.getAccountId());
//Case sensitive logic
for(Domains domains:domainListbyAccountId )
{
if(domains.getDomainName().equalsIgnoreCase(d.getDomainName()))
count++;
}
if(count>0 || domainList.size()>0) {
return response="Domain already exists";
}
......@@ -200,9 +209,21 @@ public class DomainServiceImpl implements DomainService {
private boolean duplicateCheck(String domainName,String accountId,List<String> fromDB,List<String> fromUser)
{
boolean check=false;
int count=0;
List<Domains> domainListbyAccountId=domainRepo.findByAccountId(accountId);
for(Domains domains:domainListbyAccountId )
{
if(domains.getDomainName().equalsIgnoreCase(domainName))
count++;
}
boolean deleveryManagersCheck=fromDB.toString().contentEquals(fromUser.toString());
List<Domains> domainList=domainRepo.findByDomainNameAndAccountId(domainName, accountId);
if(domainList.size()>0 && deleveryManagersCheck)
for(Domains domains:domainListbyAccountId )
{
if(domains.getDomainName().equalsIgnoreCase(domainName))
count++;
}
if((domainList.size()>0 && deleveryManagersCheck) || count>1)
check= true;
return check;
}
......
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