Commit 49d725f8 authored by Vijay Akula's avatar Vijay Akula

Renamed the references of ResourceAlloc to resources in all other files

parent 066543e3
...@@ -4,12 +4,11 @@ import com.nisum.myteam.exception.handler.MyTeamException; ...@@ -4,12 +4,11 @@ import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.ColumnChartData; import com.nisum.myteam.model.ColumnChartData;
import com.nisum.myteam.model.GroupByCount; import com.nisum.myteam.model.GroupByCount;
import com.nisum.myteam.model.ReportSeriesRecord; import com.nisum.myteam.model.ReportSeriesRecord;
import com.nisum.myteam.model.dao.Account;
import com.nisum.myteam.model.dao.Employee; import com.nisum.myteam.model.dao.Employee;
import com.nisum.myteam.model.dao.ResourceAllocation; import com.nisum.myteam.model.dao.Resource;
import com.nisum.myteam.model.vo.ResourceVO; import com.nisum.myteam.model.vo.ResourceVO;
import com.nisum.myteam.service.IEmployeeService; import com.nisum.myteam.service.IEmployeeService;
import com.nisum.myteam.service.IResourceAllocationService; import com.nisum.myteam.service.IResourceService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
...@@ -47,7 +46,7 @@ public class ReportsController { ...@@ -47,7 +46,7 @@ public class ReportsController {
private IEmployeeService employeeService; private IEmployeeService employeeService;
@Autowired @Autowired
private IResourceAllocationService resourceService; private IResourceService resourceService;
//Ok Response //Ok Response
@RequestMapping(value = "/getEmployeesByFunctionalGroup1", @RequestMapping(value = "/getEmployeesByFunctionalGroup1",
...@@ -132,7 +131,7 @@ public class ReportsController { ...@@ -132,7 +131,7 @@ public class ReportsController {
// Convert the aggregation result into a List // Convert the aggregation result into a List
AggregationResults<ColumnChartData> groupResults = mongoTemplate.aggregate(aggregate, ResourceAllocation.class, AggregationResults<ColumnChartData> groupResults = mongoTemplate.aggregate(aggregate, Resource.class,
ColumnChartData.class); ColumnChartData.class);
List<ColumnChartData> result = groupResults.getMappedResults(); List<ColumnChartData> result = groupResults.getMappedResults();
List<String> statusList = new ArrayList(); List<String> statusList = new ArrayList();
...@@ -246,7 +245,7 @@ public class ReportsController { ...@@ -246,7 +245,7 @@ public class ReportsController {
// Convert the aggregation result into a List // Convert the aggregation result into a List
AggregationResults<ColumnChartData> groupResults1 = mongoTemplate AggregationResults<ColumnChartData> groupResults1 = mongoTemplate
.aggregate(agg1, ResourceAllocation.class, .aggregate(agg1, Resource.class,
ColumnChartData.class); ColumnChartData.class);
List<ColumnChartData> result1 = groupResults1.getMappedResults(); List<ColumnChartData> result1 = groupResults1.getMappedResults();
...@@ -341,11 +340,11 @@ public class ReportsController { ...@@ -341,11 +340,11 @@ public class ReportsController {
@RequestMapping(value = "/fetchEmployeeDetailsByDateBillability", @RequestMapping(value = "/fetchEmployeeDetailsByDateBillability",
method = RequestMethod.GET, method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<ResourceAllocation>> fetchEmployeeDetailsByDateBillability( public ResponseEntity<List<Resource>> fetchEmployeeDetailsByDateBillability(
@RequestParam("billabilityStatus") String billabilityStatus, @RequestParam("billabilityStatus") String billabilityStatus,
@RequestParam("reportDate") String reportDateString) @RequestParam("reportDate") String reportDateString)
throws MyTeamException { throws MyTeamException {
List<ResourceAllocation> empList = new ArrayList<>(); List<Resource> empList = new ArrayList<>();
if (reportDateString != null && !reportDateString.isEmpty()) { if (reportDateString != null && !reportDateString.isEmpty()) {
String pattern = "MM-dd-yyyy"; String pattern = "MM-dd-yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
...@@ -368,7 +367,7 @@ public class ReportsController { ...@@ -368,7 +367,7 @@ public class ReportsController {
criteriaV1.orOperator(criteriaV21, criteriaV22)); criteriaV1.orOperator(criteriaV21, criteriaV22));
Query query = new Query(); Query query = new Query();
query.addCriteria(criteriaV221); query.addCriteria(criteriaV221);
empList = mongoTemplate.find(query, ResourceAllocation.class); empList = mongoTemplate.find(query, Resource.class);
} }
return new ResponseEntity<>(empList, HttpStatus.OK); return new ResponseEntity<>(empList, HttpStatus.OK);
} }
......
...@@ -17,7 +17,7 @@ import java.util.Date; ...@@ -17,7 +17,7 @@ import java.util.Date;
@NoArgsConstructor @NoArgsConstructor
@ToString @ToString
@Document(collection = "resourceAllocation") @Document(collection = "resourceAllocation")
public class ResourceAllocation extends AuditFields implements Serializable { public class Resource extends AuditFields implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -2,22 +2,21 @@ package com.nisum.myteam.repository; ...@@ -2,22 +2,21 @@ package com.nisum.myteam.repository;
import com.nisum.myteam.model.dao.Resource; import com.nisum.myteam.model.dao.Resource;
import com.nisum.myteam.model.dao.ResourceAllocation;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.List; import java.util.List;
public interface ResourceAllocationRepo public interface ResourceRepo
extends MongoRepository<ResourceAllocation, String> { extends MongoRepository<Resource, String> {
List<ResourceAllocation> findByProjectId(String projectId); List<Resource> findByProjectId(String projectId);
List<ResourceAllocation> findByEmployeeId(String employeeId); List<Resource> findByEmployeeId(String employeeId);
ResourceAllocation findById(ObjectId id); Resource findById(ObjectId id);
List<ResourceAllocation> findByEmployeeIdAndProjectId(String employeeId, String projectId); List<Resource> findByEmployeeIdAndProjectId(String employeeId, String projectId);
// List<Resource> findByEmployeeIdAndActive(String employeeId, boolean status); // List<Resource> findByEmployeeIdAndActive(String employeeId, boolean status);
......
...@@ -4,7 +4,7 @@ import com.nisum.myteam.exception.handler.MyTeamException; ...@@ -4,7 +4,7 @@ import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.dao.Account; import com.nisum.myteam.model.dao.Account;
import com.nisum.myteam.model.dao.EmpLoginData; import com.nisum.myteam.model.dao.EmpLoginData;
import com.nisum.myteam.model.dao.Project; import com.nisum.myteam.model.dao.Project;
import com.nisum.myteam.model.dao.ResourceAllocation; import com.nisum.myteam.model.dao.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -58,7 +58,7 @@ public interface IProjectService { ...@@ -58,7 +58,7 @@ public interface IProjectService {
public List<Project> getProjectsForDeliveryLead(String deliveryLeadId); public List<Project> getProjectsForDeliveryLead(String deliveryLeadId);
List<ResourceAllocation> getResourcesUnderProject(String empId); List<Resource> getResourcesUnderProject(String empId);
} }
...@@ -2,40 +2,40 @@ package com.nisum.myteam.service; ...@@ -2,40 +2,40 @@ package com.nisum.myteam.service;
import com.nisum.myteam.exception.handler.MyTeamException; import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.dao.Employee; import com.nisum.myteam.model.dao.Employee;
import com.nisum.myteam.model.dao.ResourceAllocation; import com.nisum.myteam.model.dao.Resource;
import com.nisum.myteam.model.vo.EmployeeShiftsVO; import com.nisum.myteam.model.vo.EmployeeShiftsVO;
import com.nisum.myteam.model.vo.MyProjectAllocationVO; import com.nisum.myteam.model.vo.MyProjectAllocationVO;
import com.nisum.myteam.model.vo.ResourceVO; import com.nisum.myteam.model.vo.ResourceVO;
import java.util.List; import java.util.List;
public interface IResourceAllocationService { public interface IResourceService {
ResourceAllocation addResourceAllocation(ResourceAllocation resourceAllocation, String loginEmpId) throws MyTeamException; Resource addResource(Resource resourceAllocation, String loginEmpId) throws MyTeamException;
public void updateExistedResourceAlloc(ResourceAllocation resourceAlloc) throws MyTeamException; public void updateExistedResource(Resource resourceAlloc) throws MyTeamException;
public void insertNewResourceAllocWithNewStatus(ResourceAllocation resourceAllocReq, String loginEmpId) throws MyTeamException; public void insertNewResourceWithNewStatus(Resource resourceAllocReq, String loginEmpId) throws MyTeamException;
void deleteResource(ResourceAllocation resource, String loginEmpId); void deleteResource(Resource resource, String loginEmpId);
List<ResourceAllocation> getAllResourcesForAllActiveProjects(); List<Resource> getAllResourcesForAllActiveProjects();
List<ResourceAllocation> getResourcesSortByBillingStartDate(String employeeId); List<Resource> getResourcesSortByBillingStartDate(String employeeId);
List<ResourceVO> getActiveResources(String empId); List<ResourceVO> getActiveResources(String empId);
public List<ResourceVO> getResourcesForProject(String projectId, String statusFlag); public List<ResourceVO> getResourcesForProject(String projectId, String statusFlag);
public List<ResourceAllocation> getResourcesUnderDeliveryLead(String empId); public List<Resource> getResourcesUnderDeliveryLead(String empId);
public List<ResourceVO> getBillingsForEmployee(String empId); public List<ResourceVO> getBillingsForEmployee(String empId);
public List<ResourceAllocation> getBillingsForProject(String empId, String projectId); public List<Resource> getBillingsForProject(String empId, String projectId);
public List<MyProjectAllocationVO> getWorkedProjectsForResource(String empId); public List<MyProjectAllocationVO> getWorkedProjectsForResource(String empId);
...@@ -43,13 +43,13 @@ public interface IResourceAllocationService { ...@@ -43,13 +43,13 @@ public interface IResourceAllocationService {
public List<Employee> getUnAssignedEmployees(); public List<Employee> getUnAssignedEmployees();
public List<ResourceAllocation> getAllResources(); public List<Resource> getAllResources();
public List<ResourceVO> getAllResourcesVO(); public List<ResourceVO> getAllResourcesVO();
public void deleteResourcesUnderProject(String projectId); public void deleteResourcesUnderProject(String projectId);
public ResourceAllocation addResourceToBenchProject(Employee employee, String loginEmpId) throws MyTeamException; public Resource addResourceToBenchProject(Employee employee, String loginEmpId) throws MyTeamException;
public List<EmployeeShiftsVO> getResourcesForShift(String shift); public List<EmployeeShiftsVO> getResourcesForShift(String shift);
......
...@@ -2,13 +2,12 @@ package com.nisum.myteam.service.impl; ...@@ -2,13 +2,12 @@ package com.nisum.myteam.service.impl;
import com.nisum.myteam.model.dao.Employee; import com.nisum.myteam.model.dao.Employee;
import com.nisum.myteam.model.dao.Project; import com.nisum.myteam.model.dao.Project;
import com.nisum.myteam.model.dao.ResourceAllocation;
import com.nisum.myteam.model.vo.EmployeeDashboardVO; import com.nisum.myteam.model.vo.EmployeeDashboardVO;
import com.nisum.myteam.model.vo.ResourceVO; import com.nisum.myteam.model.vo.ResourceVO;
import com.nisum.myteam.service.IDashboardService; import com.nisum.myteam.service.IDashboardService;
import com.nisum.myteam.service.IEmployeeService; import com.nisum.myteam.service.IEmployeeService;
import com.nisum.myteam.service.IProjectService; import com.nisum.myteam.service.IProjectService;
import com.nisum.myteam.service.IResourceAllocationService; import com.nisum.myteam.service.IResourceService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -24,7 +23,7 @@ public class DashboardService implements IDashboardService { ...@@ -24,7 +23,7 @@ public class DashboardService implements IDashboardService {
private IEmployeeService employeeService; private IEmployeeService employeeService;
@Autowired @Autowired
private IResourceAllocationService resourceService; private IResourceService resourceService;
@Autowired @Autowired
private IProjectService projectService; private IProjectService projectService;
...@@ -39,7 +38,7 @@ public class DashboardService implements IDashboardService { ...@@ -39,7 +38,7 @@ public class DashboardService implements IDashboardService {
Map<String, Object> teamMatesStatusMap = new HashMap(); Map<String, Object> teamMatesStatusMap = new HashMap();
// Find all active employees // Find all active employees
//List<ResourceAllocation> resources = resourceService.getAllResources(); //List<Resource> resources = resourceService.getAllResources();
List<ResourceVO> resources = resourceService.getAllResourcesVO(); List<ResourceVO> resources = resourceService.getAllResourcesVO();
......
...@@ -49,7 +49,7 @@ public class EmployeeService implements IEmployeeService { ...@@ -49,7 +49,7 @@ public class EmployeeService implements IEmployeeService {
private IEmployeeLocationService empLocationService; private IEmployeeLocationService empLocationService;
@Autowired @Autowired
private IResourceAllocationService resourceService; private IResourceService resourceService;
@Override @Override
public Employee createEmployee(Employee employee, String loginEmpId) throws MyTeamException { public Employee createEmployee(Employee employee, String loginEmpId) throws MyTeamException {
......
...@@ -40,7 +40,7 @@ public class ProjectService implements IProjectService { ...@@ -40,7 +40,7 @@ public class ProjectService implements IProjectService {
private IDomainService domainService; private IDomainService domainService;
@Autowired @Autowired
private ResourceAllocationService resourceAllocService; private ResourceService resourceService;
@Autowired @Autowired
private IEmployeeService employeeService; private IEmployeeService employeeService;
...@@ -130,7 +130,7 @@ public class ProjectService implements IProjectService { ...@@ -130,7 +130,7 @@ public class ProjectService implements IProjectService {
Project project = projectRepo.findByProjectId(projectId); Project project = projectRepo.findByProjectId(projectId);
projectRepo.delete(project); projectRepo.delete(project);
resourceAllocService.deleteResourcesUnderProject(projectId); resourceService.deleteResourcesUnderProject(projectId);
} }
...@@ -198,19 +198,19 @@ public class ProjectService implements IProjectService { ...@@ -198,19 +198,19 @@ public class ProjectService implements IProjectService {
} }
@Override @Override
public List<ResourceAllocation> getResourcesUnderProject(String empId) { public List<Resource> getResourcesUnderProject(String empId) {
List<String> projectsIdsList = new ArrayList<>(); List<String> projectsIdsList = new ArrayList<>();
List<ResourceAllocation> resourcesList = new ArrayList<>(); List<Resource> resourcesList = new ArrayList<>();
List<Project> projectsList = projectRepo.findByDeliveryLeadIds(empId); List<Project> projectsList = projectRepo.findByDeliveryLeadIds(empId);
for (Project project : projectsList) for (Project project : projectsList)
projectsIdsList.add(project.getProjectId()); projectsIdsList.add(project.getProjectId());
Query query = new Query(Criteria.where("projectId").in(projectsIdsList)); Query query = new Query(Criteria.where("projectId").in(projectsIdsList));
List<ResourceAllocation> resourcesListPersisted = mongoTemplate.find(query, ResourceAllocation.class); List<Resource> resourcesListPersisted = mongoTemplate.find(query, Resource.class);
for (ResourceAllocation resource : resourcesListPersisted) { for (Resource resource : resourcesListPersisted) {
if (!resource.getEmployeeId().equals(empId)) if (!resource.getEmployeeId().equals(empId))
resourcesList.add(resource); resourcesList.add(resource);
} }
...@@ -247,7 +247,7 @@ public class ProjectService implements IProjectService { ...@@ -247,7 +247,7 @@ public class ProjectService implements IProjectService {
} }
private String validateAgainstDOJ(ResourceAllocation resource) { private String validateAgainstDOJ(Resource resource) {
String response = null; String response = null;
Date empDoj = employeeService.getEmployeeById(resource.getEmployeeId()).getDateOfJoining(); Date empDoj = employeeService.getEmployeeById(resource.getEmployeeId()).getDateOfJoining();
if (resource.getBillingStartDate().compareTo(empDoj) < 0) { if (resource.getBillingStartDate().compareTo(empDoj) < 0) {
...@@ -405,7 +405,7 @@ public class ProjectService implements IProjectService { ...@@ -405,7 +405,7 @@ public class ProjectService implements IProjectService {
// public Resource addNewBeanchAllocation(Employee employee, String loginEmpId) { // public Resource addNewBeanchAllocation(Employee employee, String loginEmpId) {
// ResourceAllocation resourcePersisted = null; // Resource resourcePersisted = null;
// Resource resourceBench = new Resource(); // Resource resourceBench = new Resource();
// resourceBench.setAccount(MyTeamUtils.BENCH_ACCOUNT); // resourceBench.setAccount(MyTeamUtils.BENCH_ACCOUNT);
// resourceBench.setBillableStatus(MyTeamUtils.BENCH_BILLABILITY_STATUS); // resourceBench.setBillableStatus(MyTeamUtils.BENCH_BILLABILITY_STATUS);
......
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