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