Commit 740156f3 authored by Vijay Akula's avatar Vijay Akula

Added service method for updating project sequence

parent e6d466f2
...@@ -53,7 +53,7 @@ public class AccountController { ...@@ -53,7 +53,7 @@ public class AccountController {
log.info("Updating the account with details::"+account); log.info("Updating the account with details::"+account);
boolean isAccountExists = accountService.isAccountExists(account); boolean isAccountExists = accountService.isAccountExists(account);
if (isAccountExists == true) { if (isAccountExists == true) {
Account accountPersisted = accountService.updateAccount(account); Account accountPersisted = accountService.updateAccountAndRolesForDMS(account);
ResponseDetails updateRespDetails = new ResponseDetails(new Date(), 604, "Account has been updated", ResponseDetails updateRespDetails = new ResponseDetails(new Date(), 604, "Account has been updated",
"status description",null, request.getContextPath(), "details", accountPersisted); "status description",null, request.getContextPath(), "details", accountPersisted);
......
...@@ -43,7 +43,6 @@ public class ProjectController { ...@@ -43,7 +43,6 @@ public class ProjectController {
if (account != null) { if (account != null) {
accountName = account.getAccountName(); accountName = account.getAccountName();
int sequenceNumber = account.getAccountProjectSequence(); int sequenceNumber = account.getAccountProjectSequence();
account.setAccountProjectSequence(sequenceNumber + 1); account.setAccountProjectSequence(sequenceNumber + 1);
projectService.updateProjSeqinAccount(account); projectService.updateProjSeqinAccount(account);
......
...@@ -13,7 +13,9 @@ public interface IAccountService { ...@@ -13,7 +13,9 @@ public interface IAccountService {
Account createAccount(Account account) throws MyTeamException; Account createAccount(Account account) throws MyTeamException;
Account updateAccount(Account account) throws MyTeamException; Account updateAccountAndRolesForDMS(Account account) throws MyTeamException;
public Account updateAccountSequence(Account account);
boolean isAccountExists(Account account); boolean isAccountExists(Account account);
...@@ -31,5 +33,4 @@ public interface IAccountService { ...@@ -31,5 +33,4 @@ public interface IAccountService {
public List<Account> getAccountsAll() throws MyTeamException; public List<Account> getAccountsAll() throws MyTeamException;
} }
...@@ -62,7 +62,7 @@ public class AccountService implements IAccountService { ...@@ -62,7 +62,7 @@ public class AccountService implements IAccountService {
} }
@Override @Override
public Account updateAccount(Account accountUpdating) throws MyTeamException { public Account updateAccountAndRolesForDMS(Account accountUpdating) throws MyTeamException {
Account accountBeforeUpdate = accountRepo.findByAccountId(accountUpdating.getAccountId()); Account accountBeforeUpdate = accountRepo.findByAccountId(accountUpdating.getAccountId());
accountUpdating.setId(accountBeforeUpdate.getId()); accountUpdating.setId(accountBeforeUpdate.getId());
...@@ -84,6 +84,12 @@ public class AccountService implements IAccountService { ...@@ -84,6 +84,12 @@ public class AccountService implements IAccountService {
return accountUpdated; return accountUpdated;
} }
@Override
public Account updateAccountSequence(Account account) {
return accountRepo.save(account);
}
@Override @Override
public boolean isAccountExists(Account account) { public boolean isAccountExists(Account account) {
......
...@@ -117,7 +117,7 @@ public class ProjectService implements IProjectService { ...@@ -117,7 +117,7 @@ public class ProjectService implements IProjectService {
} }
public Account updateProjSeqinAccount(Account account) throws MyTeamException { public Account updateProjSeqinAccount(Account account) throws MyTeamException {
return accountService.updateAccount(account); return accountService.updateAccountSequence(account);
} }
@Override @Override
...@@ -259,6 +259,7 @@ public class ProjectService implements IProjectService { ...@@ -259,6 +259,7 @@ public class ProjectService implements IProjectService {
projectRepo.delete(project); projectRepo.delete(project);
Query query = new Query(Criteria.where("projectId").is(projectId)); Query query = new Query(Criteria.where("projectId").is(projectId));
List<Resource> list = mongoTemplate.find(query, Resource.class); List<Resource> list = mongoTemplate.find(query, Resource.class);
resourceRepo.delete(list); resourceRepo.delete(list);
} }
......
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