Commit 35f43687 authored by Vijay Akula's avatar Vijay Akula

Renamed the packages from mytime to myTeam. Modified the property names

of mytime to myTeam.
parent c63bc59d
package com.nisum.mytime;
package com.nisum.myteam;
import org.springframework.boot.SpringApplication;
......@@ -15,7 +15,7 @@ import org.springframework.web.filter.CorsFilter;
@SpringBootApplication
@EnableAutoConfiguration
@EnableMongoRepositories(basePackages = { "com.nisum.mytime.repository" })
@EnableMongoRepositories(basePackages = { "com.nisum.myteam.repository" })
public class MyTimeApplication extends SpringBootServletInitializer {
@Override
......
package com.nisum.mytime;
package com.nisum.myteam;
import org.springframework.context.annotation.Bean;
......
package com.nisum.mytime.configuration;
package com.nisum.myteam.configuration;
import java.sql.Connection;
import java.sql.DriverManager;
......@@ -13,7 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.nisum.mytime.utils.MyTimeLogger;
import com.nisum.myteam.utils.MyTeamLogger;
@Component
@Transactional
......@@ -23,16 +23,16 @@ public class DbConnection {
private Connection connection = null;
@Value("${myTime.data.mssqldb.url}")
@Value("${myTeam.data.mssqldb.url}")
private String url;
@Value("${myTime.data.mssqldb.username}")
@Value("${myTeam.data.mssqldb.username}")
private String username;
@Value("${myTime.data.mssqldb.password}")
@Value("${myTeam.data.mssqldb.password}")
private String password;
@Value("${myTime.data.mssqldb.driver}")
@Value("${myTeam.data.mssqldb.driver}")
private String driver;
public Connection getDBConnection() throws SQLException {
......
package com.nisum.mytime.configuration;
package com.nisum.myteam.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......
package com.nisum.mytime.configuration;
package com.nisum.myteam.configuration;
import java.io.File;
import java.io.IOException;
......@@ -25,7 +25,7 @@ public class ReportsCleanUpScheduler {
File dir = resourceLoader.getResource("/WEB-INF/reports/").getFile();
for(File file : dir.listFiles()){
String fileName = file.getName();
if(file.exists() && !"MyTime.pdf".equals(fileName)){
if(file.exists() && !"MyTeam.pdf".equals(fileName)){
flag = file.delete();
}
}
......
package com.nisum.mytime.configuration;
package com.nisum.myteam.configuration;
import java.io.IOException;
import java.util.Properties;
......@@ -20,8 +20,8 @@ import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import com.nisum.mytime.schedular.AutowiringSpringBeanJobFactory;
import com.nisum.mytime.schedular.MyTimeCronSchedularJob;
import com.nisum.myteam.schedular.AutowiringSpringBeanJobFactory;
import com.nisum.myteam.schedular.MyTeamCronSchedularJob;
@Configuration
@ConditionalOnProperty(name = "quartz.enabled")
......@@ -39,7 +39,7 @@ public class SchedulerConfig {
@Bean
public Scheduler schedulerFactoryBean(JobFactory jobFactory,
@Qualifier("myTimeJobTrigger") Trigger myTimeJobTrigger) throws Exception {
@Qualifier("myTimeJobTrigger") Trigger myTeamJobTrigger) throws Exception {
SchedulerFactoryBean factory = new SchedulerFactoryBean();
factory.setOverwriteExistingJobs(true);
factory.setJobFactory(jobFactory);
......@@ -49,7 +49,7 @@ public class SchedulerConfig {
Scheduler scheduler = factory.getScheduler();
scheduler.setJobFactory(jobFactory);
scheduler.scheduleJob((JobDetail) myTimeJobTrigger.getJobDataMap().get("jobDetail"), myTimeJobTrigger);
scheduler.scheduleJob((JobDetail) myTeamJobTrigger.getJobDataMap().get("jobDetail"), myTeamJobTrigger);
scheduler.start();
return scheduler;
......@@ -64,17 +64,17 @@ public class SchedulerConfig {
}
@Bean
public JobDetailFactoryBean myTimeJobDetail() {
return createJobDetail(MyTimeCronSchedularJob.class);
public JobDetailFactoryBean myTeamJobDetail() {
return createJobDetail(MyTeamCronSchedularJob.class);
}
@Bean(name = "myTimeJobTrigger")
public CronTriggerFactoryBean myTimeJobTrigger(@Qualifier("myTimeJobDetail") JobDetail jobDetail,
@Value("${myTimejob.frequency}") long frequency) {
public CronTriggerFactoryBean myTimeJobTrigger(@Qualifier("myTeamJobDetail") JobDetail jobDetail,
@Value("${myTeamjob.frequency}") long frequency) {
return createCronTrigger(jobDetail, frequency);
}
private JobDetailFactoryBean createJobDetail(Class<MyTimeCronSchedularJob> jobClass) {
private JobDetailFactoryBean createJobDetail(Class<MyTeamCronSchedularJob> jobClass) {
JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
factoryBean.setJobClass(jobClass);
factoryBean.setDurability(true);
......
package com.nisum.mytime.configuration;
package com.nisum.myteam.configuration;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
......@@ -12,7 +12,7 @@ import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper;
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import com.nisum.mytime.utils.MyTimeLogger;
import com.nisum.myteam.utils.MyTeamLogger;
@Configuration
public class SpringMongoConfig {
......@@ -25,7 +25,7 @@ public class SpringMongoConfig {
try {
mappingConverter.setCustomConversions(beanFactory.getBean(CustomConversions.class));
} catch (NoSuchBeanDefinitionException ignore) {
MyTimeLogger.getInstance().error("Exception occured due to: ", ignore);
MyTeamLogger.getInstance().error("Exception occured due to: ", ignore);
}
mappingConverter.setTypeMapper(new DefaultMongoTypeMapper(null));
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.ArrayList;
import java.util.Date;
......@@ -22,10 +22,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.exception.handler.ResponseDetails;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.service.IAccountService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.Account;
import com.nisum.myteam.service.IAccountService;
import lombok.extern.slf4j.Slf4j;
......@@ -38,7 +38,7 @@ public class AccountController {
@RequestMapping(value = "/accounts", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> createAccount(@Valid @RequestBody Account account, HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
log.info("Serving the Account Creation action");
boolean isAccountExists = accountService.isAccountExists(account);
......@@ -59,7 +59,7 @@ public class AccountController {
@RequestMapping(value = "/accounts/{accountId}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> updateAccount(@RequestBody Account account, @PathVariable String accountId,
HttpServletRequest request) throws MyTimeException {
HttpServletRequest request) throws MyTeamException {
log.info("Updating the account with details::"+account);
boolean isAccountExists = accountService.isAccountExists(account);
if (isAccountExists == true) {
......@@ -81,7 +81,7 @@ public class AccountController {
@RequestMapping(value = "/accounts/{accountId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> deleteAccount(@PathVariable String accountId, HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
log.info("Deleting account with accountId:" + accountId);
Account accountDeleted = accountService.deleteAccount(accountId);
ResponseDetails deleteRespDetails = new ResponseDetails(new Date(), 604,
......@@ -95,7 +95,7 @@ public class AccountController {
@RequestMapping(value = "/accounts", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAccounts(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getAccounts(HttpServletRequest request) throws MyTeamException {
List<Map<Object, Object>> accountsList = accountService.getAccountsList();
log.info("The accounts list::" + accountsList);
......@@ -108,7 +108,7 @@ public class AccountController {
@RequestMapping(value = "/accounts/names", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAccountNames(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getAccountNames(HttpServletRequest request) throws MyTeamException {
List<Account> acountsList = accountService.getAccounts();
List<String> accountNamesList = new ArrayList<>();
......@@ -128,7 +128,7 @@ public class AccountController {
//get the accounts based on status(Active or inactive)
@RequestMapping(value = "/accounts/status", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Account>> getAccounts(@RequestParam("status")String status) throws MyTimeException {
public ResponseEntity<List<Account>> getAccounts(@RequestParam("status")String status) throws MyTeamException {
List<Account> accountsList = accountService.getAccountsAll().stream()
.filter(e -> "Active".equalsIgnoreCase(e.getStatus())).collect(Collectors.toList());
return new ResponseEntity<>(accountsList, HttpStatus.OK);
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.sql.SQLException;
import java.text.ParseException;
......@@ -15,11 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.service.IAttendanceService;
import com.nisum.mytime.service.IEmployeeService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.AttendenceData;
import com.nisum.myteam.model.EmpLoginData;
import com.nisum.myteam.service.IAttendanceService;
import com.nisum.myteam.service.IEmployeeService;
@RestController
@RequestMapping("/attendance")
......@@ -30,7 +30,7 @@ public class AttendanceController {
@RequestMapping(value = "employeeLoginsBasedOnDate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmpLoginData>> employeeLoginsBasedOnDate(@RequestParam("empId") long id,
@RequestParam("fromDate") String fromDate, @RequestParam("toDate") String toDate) throws MyTimeException {
@RequestParam("fromDate") String fromDate, @RequestParam("toDate") String toDate) throws MyTeamException {
List<EmpLoginData> message = new ArrayList<>();
try {
message = attendanceService.employeeLoginsBasedOnDate(id, fromDate, toDate);
......@@ -42,7 +42,7 @@ public class AttendanceController {
@RequestMapping(value = "generatePdfReport/{id}/{fromDate}/{toDate}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List> generatePdfReport(@PathVariable("id") long id,
@PathVariable("fromDate") String fromDate, @PathVariable("toDate") String toDate) throws MyTimeException {
@PathVariable("fromDate") String fromDate, @PathVariable("toDate") String toDate) throws MyTeamException {
List result = attendanceService.generatePdfReport(id, fromDate, toDate);
return new ResponseEntity<>(result, HttpStatus.OK);
}
......@@ -51,7 +51,7 @@ public class AttendanceController {
public ResponseEntity<List> generatePdfReport(@PathVariable("id") long id,
@PathVariable("fromDate") String fromDate, @PathVariable("toDate") String toDate,
@PathVariable("fromTime") String fromTime, @PathVariable("toTime") String toTime)
throws MyTimeException, ParseException {
throws MyTeamException, ParseException {
List result = attendanceService.generatePdfReport(id, fromDate, toDate, fromTime, toTime);
return new ResponseEntity<>(result, HttpStatus.OK);
}
......@@ -59,20 +59,20 @@ public class AttendanceController {
@RequestMapping(value = "attendanciesReport/{reportDate}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<AttendenceData>> attendanciesReport(@PathVariable("reportDate") String reportDate,
@RequestParam(value = "shift", required = false, defaultValue = "All") String shift)
throws MyTimeException, SQLException {
throws MyTeamException, SQLException {
List<AttendenceData> lisOfAttendenceData = attendanceService.getAttendanciesReport(reportDate, shift);
return new ResponseEntity<>(lisOfAttendenceData, HttpStatus.OK);
}
@RequestMapping(value = "employeesDataSave/{searchDate}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> employeesDataSave(@PathVariable("searchDate") String searchDate)
throws MyTimeException {
throws MyTeamException {
Boolean result = attendanceService.fetchEmployeesData(searchDate, false);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@RequestMapping(value = "resyncMonthData/{fromDate}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> resyncMonthData(@PathVariable("fromDate") String fromDate) throws MyTimeException {
public ResponseEntity<Boolean> resyncMonthData(@PathVariable("fromDate") String fromDate) throws MyTeamException {
Boolean result = attendanceService.fetchEmployeesData(fromDate, true);
return new ResponseEntity<>(result, HttpStatus.OK);
}
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.List;
......@@ -12,9 +12,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Billing;
import com.nisum.mytime.service.IBillingService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Billing;
import com.nisum.myteam.service.IBillingService;
import lombok.extern.slf4j.Slf4j;
@RestController
......@@ -27,7 +29,7 @@ public class BillingController {
// @RequestMapping(value = "/addEmployeeBilling"
@RequestMapping(value = "/billing", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Billing> addEmployeeBilling(@RequestBody Billing billing,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
Billing billingList = billingService.addBilling(billing, loginEmpId);
return new ResponseEntity<>(billingList, HttpStatus.OK);
......@@ -36,14 +38,14 @@ public class BillingController {
// @RequestMapping(value = "/updateEmployeeBilling",
@RequestMapping(value = "/billing", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Billing> updateEmployeeBilling(@RequestBody Billing billing,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
Billing billingList = billingService.updateBilling(billing, loginEmpId);
return new ResponseEntity<>(billingList, HttpStatus.OK);
}
// @RequestMapping(value = "/deleteEmployeeBilling"
@RequestMapping(value = "/billing", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Billing> deleteEmployeeBilling(@RequestBody Billing billing) throws MyTimeException {
public ResponseEntity<Billing> deleteEmployeeBilling(@RequestBody Billing billing) throws MyTeamException {
billingService.deleteBilling(billing);
return new ResponseEntity<>(null, HttpStatus.OK);
}
......@@ -51,7 +53,7 @@ public class BillingController {
// @RequestMapping(value = "/getEmployeeBillingDetailsAll"
@RequestMapping(value = "/billing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Billing>> getAllBillingsForEmployee(@RequestParam("employeeId") String employeeId)
throws MyTimeException {
throws MyTeamException {
List<Billing> billingList = billingService.getBillingsForEmployee(employeeId);
return new ResponseEntity<>(billingList, HttpStatus.OK);
}
......@@ -59,7 +61,7 @@ public class BillingController {
// @RequestMapping(value = "/getEmployeeBillingDetails"
@RequestMapping(value = "/billing/project/{projectId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Billing>> getBillingsForProject(@PathVariable("projectId") String projectId,
@RequestParam("employeeId") String employeeId) throws MyTimeException {
@RequestParam("employeeId") String employeeId) throws MyTeamException {
List<Billing> billingList = billingService.getBillingsForProject(employeeId, projectId);
return new ResponseEntity<>(billingList, HttpStatus.OK);
}
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.Date;
import java.util.List;
......@@ -14,11 +14,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.exception.handler.ResponseDetails;
import com.nisum.mytime.model.Designation;
import com.nisum.mytime.service.IDesignationService;
import com.nisum.mytime.service.impl.DesignationService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.Designation;
import com.nisum.myteam.service.IDesignationService;
import com.nisum.myteam.service.impl.DesignationService;
@RestController
public class DesignationController {
......@@ -28,7 +28,7 @@ public class DesignationController {
// @RequestMapping(value = "/getAllDesignations"
@RequestMapping(value = "/employees/designations/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAllDesignations(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getAllDesignations(HttpServletRequest request) throws MyTeamException {
List<String> designations = designationService.getAllDesignations().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getActiveStatus())).map(Designation::getDesignationName).sorted()
.collect(Collectors.toList());
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.Date;
import java.util.HashMap;
......@@ -23,12 +23,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.exception.handler.ResponseDetails;
import com.nisum.mytime.model.Domain;
import com.nisum.mytime.service.IDomainService;
import com.nisum.mytime.utils.MyTimeUtils;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.Domain;
import com.nisum.myteam.service.IDomainService;
import com.nisum.myteam.utils.MyTeamUtils;
import lombok.extern.slf4j.Slf4j;
......@@ -45,7 +44,7 @@ public class DomainController {
@RequestMapping(value = "/domains", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> createDomain(@RequestBody Domain domain, HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
log.info("Domain Creation");
......@@ -66,7 +65,7 @@ public class DomainController {
}
@RequestMapping(value = "/domains", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getDomains(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getDomains(HttpServletRequest request) throws MyTeamException {
ResponseDetails getRespDetails = new ResponseDetails(new Date(), 804, "Retrieved the domains successfully",
"Domains list", domainService.getDomainsList(), request.getRequestURI(), "details", null);
......@@ -76,7 +75,7 @@ public class DomainController {
@RequestMapping(value = "/domains", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> updateDomain(@RequestBody Domain domain, HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
boolean isDomainExists = domainService.isDomainExists(domain);
if (isDomainExists == true) {
......@@ -94,7 +93,7 @@ public class DomainController {
@RequestMapping(value = "/domains/{domainId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> deleteDomain(@PathVariable String domainId, HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
domainService.delete(domainId);
ResponseDetails deleteRespDetails = new ResponseDetails(new Date(), 804, "Domain has been deleted",
......@@ -107,7 +106,7 @@ public class DomainController {
//getting domains list under accountId which is an active.
@RequestMapping(value = "/domains/{accountId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Domain>> getDomains(@PathVariable("accountId") String accountId) throws MyTimeException {
public ResponseEntity<List<Domain>> getDomains(@PathVariable("accountId") String accountId) throws MyTeamException {
List<Domain> domains = domainService.getDomainsUnderAccount(accountId).stream()
.filter(e -> "Active".equalsIgnoreCase(e.getStatus())).collect(Collectors.toList());
return new ResponseEntity<>(domains, HttpStatus.OK);
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
......@@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.model.EmailDomain;
import com.nisum.mytime.service.IMailService;
import com.nisum.myteam.model.EmailDomain;
import com.nisum.myteam.service.IMailService;
@RestController
public class EmailController {
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.ArrayList;
import java.util.Date;
......@@ -19,12 +19,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.exception.handler.ResponseDetails;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Employee;
import com.nisum.mytime.service.IEmployeeRoleService;
import com.nisum.mytime.service.IEmployeeService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.Account;
import com.nisum.myteam.model.Employee;
import com.nisum.myteam.service.IEmployeeRoleService;
import com.nisum.myteam.service.IEmployeeService;
import lombok.extern.slf4j.Slf4j;
......@@ -40,7 +41,7 @@ public class EmployeeController {
@RequestMapping(value = "/employees/{empId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> createEmployee(@Valid @RequestBody Employee employeeReq,
@PathVariable(value = "empId") String loginEmpId, HttpServletRequest request) throws MyTimeException {
@PathVariable(value = "empId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
if (!empService.isEmployeeExistsById(loginEmpId)) {
Employee employeePersisted = empService.createEmployee(employeeReq, loginEmpId);
......@@ -60,7 +61,7 @@ public class EmployeeController {
@RequestMapping(value = "/employees/{empId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> updateEmployee(@RequestBody Employee employeeReq,
@PathVariable(value = "empId") String loginEmpId, HttpServletRequest request) throws MyTimeException {
@PathVariable(value = "empId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
if (empService.isEmployeeExistsById(loginEmpId)) {
Employee employeeUpdated = empService.updateEmployee(employeeReq, loginEmpId);
......@@ -79,7 +80,7 @@ public class EmployeeController {
@RequestMapping(value = "/employees/{empId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> deleteEmployee(@PathVariable("empId") String empId, HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
if (empService.isEmployeeExistsById(empId)) {
......@@ -95,7 +96,7 @@ public class EmployeeController {
}
@RequestMapping(value = "/employees/updateProfile", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Employee> updateProfile(@RequestBody Employee employee) throws MyTimeException {
public ResponseEntity<Employee> updateProfile(@RequestBody Employee employee) throws MyTeamException {
Employee employeeUpdated = empService.updateProfile(employee);
return new ResponseEntity<>(employeeUpdated, HttpStatus.OK);
}
......@@ -104,7 +105,7 @@ public class EmployeeController {
// @RequestMapping(value = "/getEmployeeRoleData"
@RequestMapping(value = "/employees/employeeId/{empId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getEmployeeById(@PathVariable("empId") String empId, HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
Employee employee = empService.getEmployeeById(empId);
ResponseDetails getRespDetails = new ResponseDetails(new Date(), 904, "Retrieved Employee successfully",
"Employee", employee, request.getRequestURI(), "Employee Details", null);
......@@ -114,7 +115,7 @@ public class EmployeeController {
@RequestMapping(value = "/employees/emailId/{emailId:.+}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getEmployee(@PathVariable("emailId") String emailId, HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
Employee employee = empService.getEmployeeByEmaillId(emailId);
if (employee == null) {
ResponseDetails errorDetails = new ResponseDetails(new Date(), 902,
......@@ -143,7 +144,7 @@ public class EmployeeController {
// @RequestMapping(value = "/getManagers"
@RequestMapping(value = "/employees/managers/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getManagers(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getManagers(HttpServletRequest request) throws MyTeamException {
ResponseDetails getRespDetails = new ResponseDetails(new Date(), 905, "Retrieved Managers successfully",
"Managers list", empService.getManagers(), request.getRequestURI(), "Managers Details", null);
return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
......@@ -152,7 +153,7 @@ public class EmployeeController {
// @RequestMapping(value = "/getUserRoles"
@RequestMapping(value = "/employees/active", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getActiveEmployees(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getActiveEmployees(HttpServletRequest request) throws MyTeamException {
ResponseDetails getRespDetails = new ResponseDetails(new Date(), 905, "Retrieved Active Employees successfully",
"Active Employees list", empService.getActiveEmployees(), request.getRequestURI(),
......@@ -163,7 +164,7 @@ public class EmployeeController {
// @RequestMapping(value = "/getAccounts"
@RequestMapping(value = "/employees/accounts/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAccounts(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getAccounts(HttpServletRequest request) throws MyTeamException {
List<Account> activeAccountList = empService.getAccounts().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getStatus()))
// .filter(a -> !("Nisum
......@@ -192,13 +193,13 @@ public class EmployeeController {
@RequestMapping(value = "/getEmployeeRoleDataForSearchCriteria", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Employee> getEmployeeRoleDataForSearchCriteria(@RequestParam("searchId") String searchId,
@RequestParam("searchAttribute") String searchAttribute) throws MyTimeException {
@RequestParam("searchAttribute") String searchAttribute) throws MyTeamException {
Employee employeesRole = empService.getEmployeeRoleDataForSearchCriteria(searchId, searchAttribute);
return new ResponseEntity<>(employeesRole, HttpStatus.OK);
}
@RequestMapping(value = "/getEmployeeDetailsForAutocomplete", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getEmployeeDetailsForAutocomplete() throws MyTimeException {
public ResponseEntity<List<String>> getEmployeeDetailsForAutocomplete() throws MyTeamException {
List<String> details = empService.getEmployeeDetailsForAutocomplete();
return new ResponseEntity<>(details, HttpStatus.OK);
}
......@@ -206,7 +207,7 @@ public class EmployeeController {
// @RequestMapping(value = "/getDeliveryLeads",
@RequestMapping(value = "/employees/deliveryLeads/{domainId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getDeliveryLeads(@PathVariable("domainId") String domainId, HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
List<HashMap<String, String>> managersList = empService.getDeliveryLeads(domainId);
ResponseDetails getRespDetails = new ResponseDetails(new Date(), 905, "Retrieved Delivery Leads successfully",
......@@ -217,7 +218,7 @@ public class EmployeeController {
@RequestMapping(value = "/employees/active/sortByName", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Employee>> getActiveEmployeesSortByName() throws MyTimeException {
public ResponseEntity<List<Employee>> getActiveEmployeesSortByName() throws MyTeamException {
List<Employee> employeesList = new ArrayList<>();
if (empService.getActiveEmployees() != null) {
employeesList = empService.getActiveEmployees().stream()
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.Date;
import java.util.List;
......@@ -15,11 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.exception.handler.ResponseDetails;
import com.nisum.mytime.model.EmployeeLocation;
import com.nisum.mytime.service.IEmployeeLocationService;
import com.nisum.mytime.service.impl.EmployeeLocationService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.EmployeeLocation;
import com.nisum.myteam.service.IEmployeeLocationService;
import com.nisum.myteam.service.impl.EmployeeLocationService;
@RestController
public class EmployeeLocationController {
......@@ -29,7 +29,7 @@ public class EmployeeLocationController {
@RequestMapping(value = "/employees/locations/{employeeId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getEmployeeLocations(@PathVariable("employeeId") String empId,HttpServletRequest request)
throws MyTimeException {
throws MyTeamException {
List<EmployeeLocation> employeeLocationDetails = empLocationService.getEmployeeLocations(empId);
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.HashMap;
import java.util.List;
......@@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.MasterData;
import com.nisum.mytime.service.IMasterDataService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.MasterData;
import com.nisum.myteam.service.IMasterDataService;
import lombok.extern.slf4j.Slf4j;
......@@ -27,7 +27,7 @@ public class MasterDataController {
IMasterDataService masterDataService;
@RequestMapping(value = "/getMasterData", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, List<String>>> getMasterData() throws MyTimeException {
public ResponseEntity<Map<String, List<String>>> getMasterData() throws MyTeamException {
Map<String, List<String>> masterDataMap = new HashMap<>();
Map<String, List<MasterData>> result = masterDataService.getMasterData().stream()
.filter(e -> (e.isActiveStatus() == true))
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.Date;
import java.util.List;
......@@ -16,11 +16,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.exception.handler.ResponseDetails;
import com.nisum.mytime.model.OrgLocation;
import com.nisum.mytime.service.IOrgLocationService;
import com.nisum.mytime.service.impl.OrgLocationService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.OrgLocation;
import com.nisum.myteam.service.IOrgLocationService;
import com.nisum.myteam.service.impl.OrgLocationService;
import lombok.extern.slf4j.Slf4j;
......@@ -33,7 +33,7 @@ public class OrgLocationController {
// @RequestMapping(value = "/getLocations"
@RequestMapping(value = "/organization/locations/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getLocations(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getLocations(HttpServletRequest request) throws MyTeamException {
List<String> locationsList = orgLocationService.getLocations().stream()
.filter(e -> (e.isActiveStatus() == true)).map(OrgLocation::getLocation).sorted()
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.HashMap;
import java.util.List;
......@@ -12,14 +12,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Project;
import com.nisum.mytime.repository.AccountRepo;
import com.nisum.mytime.repository.ProjectRepo;
import com.nisum.mytime.service.IEmployeeService;
import com.nisum.mytime.service.IProjectService;
import com.nisum.mytime.utils.MyTimeUtils;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Account;
import com.nisum.myteam.model.Project;
import com.nisum.myteam.repository.AccountRepo;
import com.nisum.myteam.repository.ProjectRepo;
import com.nisum.myteam.service.IEmployeeService;
import com.nisum.myteam.service.IProjectService;
import com.nisum.myteam.utils.MyTeamUtils;
import lombok.extern.slf4j.Slf4j;
......@@ -41,7 +42,7 @@ public class ProjectController {
@RequestMapping(value = "/projects", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> createProject(@RequestBody Project projectReq,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
// checking project duplicateName
int projectNameCount = 0;
......@@ -54,8 +55,8 @@ public class ProjectController {
projectNameCount++;
}
}
if (projectNameCount > MyTimeUtils.INT_ZERO) {
MyTimeException myTimeException = new MyTimeException("Project name already exist !!! try with new");
if (projectNameCount > MyTeamUtils.INT_ZERO) {
MyTeamException myTimeException = new MyTeamException("Project name already exist !!! try with new");
return new ResponseEntity<>(myTimeException, HttpStatus.OK);
} else {
String accountName = "";
......@@ -78,7 +79,7 @@ public class ProjectController {
// @RequestMapping(value = "/updateProject"
@RequestMapping(value = "/projects", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> updateProject(@RequestBody Project project,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
// checking project duplicateName
int projectNameCount = 0;
if (project.getAccountId() != null) {
......@@ -91,7 +92,7 @@ public class ProjectController {
}
}
if (projectNameCount > 0) {
MyTimeException myTimeException = new MyTimeException("Project name already exist !!! try with new");
MyTeamException myTimeException = new MyTeamException("Project name already exist !!! try with new");
return new ResponseEntity<>(myTimeException, HttpStatus.OK);
}
Project updatedProject = projectService.updateProject(project, loginEmpId);
......@@ -100,7 +101,7 @@ public class ProjectController {
// @RequestMapping(value = "/deleteProject"
@RequestMapping(value = "/deleteProject", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteProject(@RequestParam("projectId") String projectId) throws MyTimeException {
public ResponseEntity<String> deleteProject(@RequestParam("projectId") String projectId) throws MyTeamException {
projectService.deleteProject(projectId);
return new ResponseEntity<>("Success", HttpStatus.OK);
}
......@@ -108,12 +109,12 @@ public class ProjectController {
// @RequestMapping(value = "/getProjects"
@RequestMapping(value = "/projects", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<HashMap<Object, Object>>> getProjects(
@RequestParam(value = "empId", required = false, defaultValue = MyTimeUtils.ZERO) String empId)
throws MyTimeException {
@RequestParam(value = "empId", required = false, defaultValue = MyTeamUtils.ZERO) String empId)
throws MyTeamException {
List<HashMap<Object, Object>> projects = null;
if (!"undefined".equalsIgnoreCase(empId)) {
boolean isDl = employeeService.verifyEmployeeRole(empId, MyTimeUtils.DL);
boolean isDl = employeeService.verifyEmployeeRole(empId, MyTeamUtils.DL);
if (isDl) {
projects = projectService.deliveryLeadProjects(empId);
}
......@@ -128,7 +129,7 @@ public class ProjectController {
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Project>> getProjectsUnderDeliveryLead(
@RequestParam("deliveryLeadId") String deliveryLeadId)
throws MyTimeException {
throws MyTeamException {
List<Project> projects = projectService.getProjectsUnderDeliveryLead(deliveryLeadId);
return new ResponseEntity<>(projects, HttpStatus.OK);
}
......@@ -136,7 +137,7 @@ public class ProjectController {
@RequestMapping(value = "/getMyProjectAllocations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<HashMap<Object, Object>>> getMyProjectAllocations(
@RequestParam("employeeId") String employeeId) throws MyTimeException {
@RequestParam("employeeId") String employeeId) throws MyTeamException {
List<HashMap<Object, Object>> empPrjtsInfo = projectService.getProjectsForEmployee(employeeId);
return new ResponseEntity<>(empPrjtsInfo, HttpStatus.OK);
}
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import static org.springframework.data.mongodb.core.aggregation.Aggregation.group;
import static org.springframework.data.mongodb.core.aggregation.Aggregation.newAggregation;
......@@ -31,19 +31,19 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Billing;
import com.nisum.mytime.model.ColumnChartData;
import com.nisum.mytime.model.Employee;
import com.nisum.mytime.model.GroupByCount;
import com.nisum.mytime.model.Resource;
import com.nisum.mytime.model.ReportSeriesRecord;
import com.nisum.mytime.repository.EmployeeVisaRepo;
import com.nisum.mytime.repository.BillingRepo;
import com.nisum.mytime.service.IProjectService;
import com.nisum.mytime.service.IResourceService;
import com.nisum.mytime.service.IEmployeeService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Account;
import com.nisum.myteam.model.Billing;
import com.nisum.myteam.model.ColumnChartData;
import com.nisum.myteam.model.Employee;
import com.nisum.myteam.model.GroupByCount;
import com.nisum.myteam.model.ReportSeriesRecord;
import com.nisum.myteam.model.Resource;
import com.nisum.myteam.repository.BillingRepo;
import com.nisum.myteam.repository.EmployeeVisaRepo;
import com.nisum.myteam.service.IEmployeeService;
import com.nisum.myteam.service.IProjectService;
import com.nisum.myteam.service.IResourceService;
@RestController
@RequestMapping("/reports")
......@@ -65,7 +65,7 @@ public class ReportsController {
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<GroupByCount>> getEmployeesByFunctionalGroup()
throws MyTimeException {
throws MyTeamException {
ProjectionOperation projectToMatchModel = project()
.andExpression("functionalGroup").as("name").andExpression("y")
.as("y");
......@@ -92,7 +92,7 @@ public class ReportsController {
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ColumnChartData> getEmployeesByFunctionalGroupForReport()
throws MyTimeException {
throws MyTeamException {
ProjectionOperation projectToMatchModel = project()
.andExpression("functionalGroup").as("name").andExpression("y")
.as("y");
......@@ -122,7 +122,7 @@ public class ReportsController {
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ColumnChartData> getBillabilityDetailsByAccount()
throws MyTimeException {
throws MyTeamException {
ProjectionOperation projectToMatchModel = project()
.andExpression("account").as("categories")
.andExpression("billableStatus").as("seriesName")
......@@ -188,7 +188,7 @@ public class ReportsController {
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ColumnChartData> getBillabilityDetailsByMonth()
throws MyTimeException {
throws MyTeamException {
Date reportDate = new Date();
Map m = new HashMap();
......@@ -283,7 +283,7 @@ public class ReportsController {
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, List<GroupByCount>>>> getEmployeesByFunctionalGroup1()
throws MyTimeException {
throws MyTeamException {
ProjectionOperation projectToMatchModel = project()
.andExpression("functionalGroup").as("name").andExpression("y")
.as("y");
......@@ -315,7 +315,7 @@ public class ReportsController {
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Employee>> getEmployeesByFG(
@RequestParam("fGroup") String fGroup) throws MyTimeException {
@RequestParam("fGroup") String fGroup) throws MyTeamException {
List<Employee> empList = new ArrayList<>();
empList = employeeService.getEmployeesByFunctionalGrp(fGroup);
......@@ -328,7 +328,7 @@ public class ReportsController {
public ResponseEntity<List<Resource>> fetchEmployeeDetailsByAccountBillability(
@RequestParam("account") String account,
@RequestParam("billabilityStatus") String billabilityStatus)
throws MyTimeException {
throws MyTeamException {
List<Resource> empList = new ArrayList<>();
if (account != null && !account.isEmpty()) {
empList = resourceService.findByAccountAndActiveAndBillableStatus(
......@@ -343,7 +343,7 @@ public class ReportsController {
public ResponseEntity<List<Billing>> fetchEmployeeDetailsByDateBillability(
@RequestParam("billabilityStatus") String billabilityStatus,
@RequestParam("reportDate") String reportDateString)
throws MyTimeException {
throws MyTeamException {
List<Billing> empList = new ArrayList<>();
if (reportDateString != null && !reportDateString.isEmpty()) {
String pattern = "MM-dd-yyyy";
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -14,16 +14,17 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Employee;
import com.nisum.mytime.model.EmployeeDashboardVO;
import com.nisum.mytime.model.EmployeeVisa;
import com.nisum.mytime.model.Resource;
import com.nisum.mytime.repository.EmployeeVisaRepo;
import com.nisum.mytime.service.IEmployeeService;
import com.nisum.mytime.service.IProjectService;
import com.nisum.mytime.service.IResourceService;
import com.nisum.mytime.utils.MyTimeUtils;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Employee;
import com.nisum.myteam.model.EmployeeDashboardVO;
import com.nisum.myteam.model.EmployeeVisa;
import com.nisum.myteam.model.Resource;
import com.nisum.myteam.repository.EmployeeVisaRepo;
import com.nisum.myteam.service.IEmployeeService;
import com.nisum.myteam.service.IProjectService;
import com.nisum.myteam.service.IResourceService;
import com.nisum.myteam.utils.MyTeamUtils;
@RestController
@RequestMapping("/projectTeam")
......@@ -46,9 +47,9 @@ public class ResourceController {
// @RequestMapping(value = "/addEmployeeToTeam"
@RequestMapping(value = "/resources", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Resource> addResourceToTeam(@RequestBody Resource resource,
@RequestParam(value = "loginEmpId", required = false) String loginEmpId) throws MyTimeException {
@RequestParam(value = "loginEmpId", required = false) String loginEmpId) throws MyTeamException {
resource.setActive(true);
resource.setAuditFields(loginEmpId, MyTimeUtils.CREATE);
resource.setAuditFields(loginEmpId, MyTeamUtils.CREATE);
Resource resourcePersisted = resourceService.addResource(resource, loginEmpId);
return new ResponseEntity<>(resourcePersisted, HttpStatus.OK);
}
......@@ -56,8 +57,8 @@ public class ResourceController {
// @RequestMapping(value = "/updateTeammate"
@RequestMapping(value = "/resources", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> updateResource(@RequestBody Resource resource,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
resource.setAuditFields(loginEmpId, MyTimeUtils.UPDATE);
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
resource.setAuditFields(loginEmpId, MyTeamUtils.UPDATE);
String response = resourceService.updateResource(resource, loginEmpId);
return new ResponseEntity<>(response, HttpStatus.OK);
}
......@@ -65,7 +66,7 @@ public class ResourceController {
// @RequestMapping(value = "/deleteTeammate"
@RequestMapping(value = "/resources", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteResource(@RequestBody Resource resource,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
resourceService.deleteResource(resource.getEmployeeId(), resource.getProjectId(), resource.getId(), loginEmpId);
return new ResponseEntity<>("Success", HttpStatus.OK);
}
......@@ -76,7 +77,7 @@ public class ResourceController {
// @RequestMapping(value = "/getEmployeeProjectInfo"
@RequestMapping(value = "/resources", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Resource>> getResourcesSortByStartDate(@RequestParam("empId") String empId)
throws MyTimeException {
throws MyTeamException {
List<Resource> projectInfo = resourceService.getResourcesSortByStartDate(empId);
return new ResponseEntity<>(projectInfo, HttpStatus.OK);
}
......@@ -84,7 +85,7 @@ public class ResourceController {
//@RequestMapping(value = "/getMyTeamDetails"
@RequestMapping(value = "/resources/active", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Resource>> getActiveResources(@RequestParam("employeeId") String employeeId)
throws MyTimeException {
throws MyTeamException {
List<Resource> employeesRoles = resourceService.getActiveResources(employeeId);
return new ResponseEntity<>(employeesRoles, HttpStatus.OK);
}
......@@ -94,14 +95,14 @@ public class ResourceController {
// @RequestMapping(value = "/getShiftDetails"
@RequestMapping(value = "/resources/{shift}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Resource>> getResourcesForShift(@PathVariable("shift") String shift)
throws MyTimeException {
throws MyTeamException {
List<Resource> resourcesList = resourceService.getResourcesForShift(shift);
return new ResponseEntity<>(resourcesList, HttpStatus.OK);
}
// @RequestMapping(value = "/getProjectAllocations"
@RequestMapping(value = "/resources/projects/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Resource>> getResourcesAllocatedForAllProjects() throws MyTimeException {
public ResponseEntity<List<Resource>> getResourcesAllocatedForAllProjects() throws MyTeamException {
List<Resource> resourcesList = resourceService.getResourcesForActiveProjects();
return new ResponseEntity<>(resourcesList, HttpStatus.OK);
}
......@@ -109,8 +110,8 @@ public class ResourceController {
// @RequestMapping(value = "/getProjectDetails"
@RequestMapping(value = "/resources/project/{projectId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Resource>> getResourcesForProject(@PathVariable("projectId") String projectId,
@RequestParam(value = "status", required = false, defaultValue = MyTimeUtils.ACTIVE) String status)
throws MyTimeException {
@RequestParam(value = "status", required = false, defaultValue = MyTeamUtils.ACTIVE) String status)
throws MyTeamException {
List<Resource> resourcesList = resourceService.getResourcesForProject(projectId, status);
return new ResponseEntity<>(resourcesList, HttpStatus.OK);
}
......@@ -119,7 +120,7 @@ public class ResourceController {
//@RequestMapping(value = "/getTeamDetails"
@RequestMapping(value = "/resources/deliverylead/{deliveryLeadId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Resource>> getTeamDetails(@PathVariable("deliveryLeadId") String deliveryLeadId)
throws MyTimeException {
throws MyTeamException {
List<Resource> resourcesList = resourceService.getResourcesUnderDeliveryLead(deliveryLeadId);
return new ResponseEntity<>(resourcesList, HttpStatus.OK);
}
......@@ -127,7 +128,7 @@ public class ResourceController {
@RequestMapping(value = "/getUnAssignedEmployees", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Employee>> getUnAssignedEmployees() throws MyTimeException {
public ResponseEntity<List<Employee>> getUnAssignedEmployees() throws MyTeamException {
List<Employee> employeesList = projectService.getUnAssignedEmployees();
return new ResponseEntity<>(employeesList, HttpStatus.OK);
}
......@@ -138,14 +139,14 @@ public class ResourceController {
@RequestMapping(value = "/getEmployeesDashBoard", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeDashboardVO>> getEmployeesDashBoard() throws MyTimeException {
public ResponseEntity<List<EmployeeDashboardVO>> getEmployeesDashBoard() throws MyTeamException {
List<EmployeeDashboardVO> employeeDashBoardList = projectService.getEmployeesDashBoard();
return new ResponseEntity<>(employeeDashBoardList, HttpStatus.OK);
}
@RequestMapping(value = "/getEmployeesHavingVisa", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Employee>> getEmployeesHavingVisa(@RequestParam("visa") String passport)
throws MyTimeException {
throws MyTeamException {
List<Employee> employees = new ArrayList<>();
if (passport != null && !"passport".equalsIgnoreCase(passport)) {
List<EmployeeVisa> employeeVisas = employeeVisaRepo.findByVisaName(passport);
......@@ -179,7 +180,7 @@ public class ResourceController {
@RequestMapping(value = "/addEmployeeToTeamWithCheck", method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> addEmployeeToTeamWithCheck(@RequestBody Resource resource,
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTimeException {
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
String response = projectService.addProjectTeamMateWithCheck(resource, loginEmpId);
return new ResponseEntity<>(response, HttpStatus.OK);
}
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.Date;
import java.util.List;
......@@ -14,11 +14,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.exception.handler.ResponseDetails;
import com.nisum.mytime.model.Shift;
import com.nisum.mytime.service.IShiftService;
import com.nisum.mytime.service.impl.ShiftService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.Shift;
import com.nisum.myteam.service.IShiftService;
import com.nisum.myteam.service.impl.ShiftService;
import lombok.extern.slf4j.Slf4j;
......@@ -31,7 +31,7 @@ public class ShiftController {
// @RequestMapping(value = "/getAllShifts"
@RequestMapping(value = "/employees/shifts/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAllShifts(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getAllShifts(HttpServletRequest request) throws MyTeamException {
List<String> shiftsList = shiftService.getAllShifts().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getActiveStatus())).map(Shift::getShiftName).sorted()
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.Date;
import java.util.List;
......@@ -14,11 +14,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.exception.handler.ResponseDetails;
import com.nisum.mytime.model.Skill;
import com.nisum.mytime.service.ISkillService;
import com.nisum.mytime.service.impl.SkillService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.exception.handler.ResponseDetails;
import com.nisum.myteam.model.Skill;
import com.nisum.myteam.service.ISkillService;
import com.nisum.myteam.service.impl.SkillService;
import lombok.extern.slf4j.Slf4j;
......@@ -31,7 +31,7 @@ public class SkillController {
// @RequestMapping(value = "/getSkills"
@RequestMapping(value = "/employees/skills/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getTechnologies(HttpServletRequest request) throws MyTimeException {
public ResponseEntity<?> getTechnologies(HttpServletRequest request) throws MyTeamException {
List<String> skillsList = skillService.getTechnologies().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getActiveStatus())).map(Skill::getSkillName).sorted()
.collect(Collectors.toList());
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
......@@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.service.IUploadXLService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.service.IUploadXLService;
import lombok.extern.slf4j.Slf4j;
......@@ -24,7 +24,7 @@ public class UploadXLController {
@RequestMapping(value = "/employee/fileUpload", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<String> exportDataFromFile(@RequestParam(value = "file") MultipartFile file,
@RequestParam(value = "empId") String loginEmpId) throws MyTimeException {
@RequestParam(value = "empId") String loginEmpId) throws MyTeamException {
log.info("Uploaded file: {} with size: {}", file.getOriginalFilename(), file.getSize());
String result = uploadService.importDataFromExcelFile(file, loginEmpId);
return new ResponseEntity<>(result, HttpStatus.OK);
......
package com.nisum.mytime.controller;
package com.nisum.myteam.controller;
import java.util.List;
......@@ -11,11 +11,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.EmployeeVisa;
import com.nisum.mytime.model.TravelRequest;
import com.nisum.mytime.model.Visa;
import com.nisum.mytime.service.IVisaService;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.EmployeeVisa;
import com.nisum.myteam.model.TravelRequest;
import com.nisum.myteam.model.Visa;
import com.nisum.myteam.service.IVisaService;
@RestController
@RequestMapping("/visa")
......@@ -25,57 +25,57 @@ public class VisaController {
private IVisaService visaService;
@RequestMapping(value = "/getAllVisas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Visa>> getAllVisas() throws MyTimeException {
public ResponseEntity<List<Visa>> getAllVisas() throws MyTeamException {
List<Visa> visas = visaService.getAllVisas();
return new ResponseEntity<>(visas, HttpStatus.OK);
}
@RequestMapping(value = "/getAllEmployeeVisas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeVisa>> getAllEmployeeVisas() throws MyTimeException {
public ResponseEntity<List<EmployeeVisa>> getAllEmployeeVisas() throws MyTeamException {
List<EmployeeVisa> employeeVisas = visaService.getAllEmployeeVisas();
return new ResponseEntity<>(employeeVisas, HttpStatus.OK);
}
@RequestMapping(value = "/addEemployeeVisa", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EmployeeVisa> addEemployeeVisa(@RequestBody EmployeeVisa employeeVisa)
throws MyTimeException {
throws MyTeamException {
EmployeeVisa visa = visaService.addEmployeeVisas(employeeVisa);
return new ResponseEntity<>(visa, HttpStatus.OK);
}
@RequestMapping(value = "/updateEemployeeVisa", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EmployeeVisa> updateEemployeeVisa(@RequestBody EmployeeVisa eVisa) throws MyTimeException {
public ResponseEntity<EmployeeVisa> updateEemployeeVisa(@RequestBody EmployeeVisa eVisa) throws MyTeamException {
EmployeeVisa visa = visaService.updateEmployeeVisas(eVisa);
return new ResponseEntity<>(visa, HttpStatus.OK);
}
@RequestMapping(value = "/deleteEemployeeVisa", method = RequestMethod.DELETE, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> deleteEemployeeVisa(@RequestBody EmployeeVisa eVisa) throws MyTimeException {
public ResponseEntity<String> deleteEemployeeVisa(@RequestBody EmployeeVisa eVisa) throws MyTeamException {
visaService.deleteEmployeeVisas(eVisa);
return new ResponseEntity<>("Success", HttpStatus.OK);
}
@RequestMapping(value = "/getAllTravelRequests", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<TravelRequest>> getAllTravelRequests() throws MyTimeException {
public ResponseEntity<List<TravelRequest>> getAllTravelRequests() throws MyTeamException {
List<TravelRequest> employeeVisas = visaService.getAllTravels();
return new ResponseEntity<>(employeeVisas, HttpStatus.OK);
}
@RequestMapping(value = "/addTravelRequest", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TravelRequest> addTravelRequest(@RequestBody TravelRequest employeeVisa)
throws MyTimeException {
throws MyTeamException {
TravelRequest visa = visaService.addTravelRequest(employeeVisa);
return new ResponseEntity<>(visa, HttpStatus.OK);
}
@RequestMapping(value = "/updateTravelRequest", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TravelRequest> updateTravelRequest(@RequestBody TravelRequest eVisa) throws MyTimeException {
public ResponseEntity<TravelRequest> updateTravelRequest(@RequestBody TravelRequest eVisa) throws MyTeamException {
TravelRequest visa = visaService.updateTravelRequest(eVisa);
return new ResponseEntity<>(visa, HttpStatus.OK);
}
@RequestMapping(value = "/deleteTravelRequest", method = RequestMethod.DELETE, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> deleteTravelRequest(@RequestBody TravelRequest eVisa) throws MyTimeException {
public ResponseEntity<String> deleteTravelRequest(@RequestBody TravelRequest eVisa) throws MyTeamException {
visaService.deleteEmployeeVisas(eVisa);
return new ResponseEntity<>("Success", HttpStatus.OK);
}
......
package com.nisum.mytime.exception.handler;
package com.nisum.myteam.exception.handler;
public class AccountNotFoundException extends RuntimeException {
......
package com.nisum.mytime.exception.handler;
package com.nisum.myteam.exception.handler;
public class EmployeeNotFoundException extends RuntimeException {
......
package com.nisum.mytime.exception.handler;
package com.nisum.myteam.exception.handler;
public class MyTimeException extends Exception {
public class MyTeamException extends Exception {
/**
*
*/
private static final long serialVersionUID = 3489301441198508177L;
public MyTimeException() {
public MyTeamException() {
}
public MyTimeException(String arg0) {
public MyTeamException(String arg0) {
super(arg0);
}
public MyTimeException(Throwable arg0) {
public MyTeamException(Throwable arg0) {
super(arg0);
}
public MyTimeException(String arg0, Throwable arg1) {
public MyTeamException(String arg0, Throwable arg1) {
super(arg0, arg1);
}
public MyTimeException(String arg0, Throwable arg1, boolean arg2, boolean arg3) {
public MyTeamException(String arg0, Throwable arg1, boolean arg2, boolean arg3) {
super(arg0, arg1, arg2, arg3);
}
......
package com.nisum.mytime.exception.handler;
package com.nisum.myteam.exception.handler;
import java.util.Date;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
import java.util.List;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.util.Date;
import com.nisum.mytime.utils.MyTimeUtils;
import com.nisum.myteam.utils.MyTeamUtils;
import lombok.Getter;
import lombok.Setter;
......@@ -17,7 +17,7 @@ public class AuditFields {
public void setAuditFields(String loginEmpId, String action) {
Date currentDate = new Date();
if (MyTimeUtils.CREATE.equals(action)) {
if (MyTeamUtils.CREATE.equals(action)) {
this.createdBy = loginEmpId;
this.createdOn = currentDate;
}
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
import java.util.Date;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
import java.util.List;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.text.ParseException;
import java.util.Comparator;
import java.util.Date;
import com.nisum.mytime.utils.MyTimeLogger;
import com.nisum.mytime.utils.MyTimeUtils;
import com.nisum.myteam.utils.MyTeamLogger;
import com.nisum.myteam.utils.MyTeamUtils;
public class DateCompare implements Comparator<EmpLoginData> {
......@@ -14,12 +14,12 @@ public class DateCompare implements Comparator<EmpLoginData> {
Date first = null;
Date second = null;
try {
first = MyTimeUtils.df.parse(o1.getFirstLogin());
second = MyTimeUtils.df.parse(o2.getFirstLogin());
first = MyTeamUtils.df.parse(o1.getFirstLogin());
second = MyTeamUtils.df.parse(o2.getFirstLogin());
int result = (first.after(second) ? 1 : 0);
return (first.before(second) ? -1 : result);
} catch (ParseException e) {
MyTimeLogger.getInstance().info(e.getMessage());
MyTeamLogger.getInstance().info(e.getMessage());
}
return -1;
}
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
import java.util.List;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
import java.util.Date;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
import java.util.Date;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
import org.bson.types.ObjectId;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.util.Date;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
import java.util.Date;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
import java.util.Date;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.io.Serializable;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import java.util.Date;
......
package com.nisum.mytime.model;
package com.nisum.myteam.model;
import org.springframework.data.mongodb.core.mapping.Document;
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Account;
import com.nisum.myteam.model.Account;
public interface AccountRepo extends MongoRepository<Account, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Billing;
import com.nisum.myteam.model.Billing;
public interface BillingRepo extends MongoRepository<Billing, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Designation;
import com.nisum.myteam.model.Designation;
public interface DesignationRepo extends MongoRepository<Designation, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Domain;
import com.nisum.myteam.model.Domain;
public interface DomainRepo extends MongoRepository<Domain, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.myteam.model.EmpLoginData;
public interface EmployeeAttendanceRepo extends MongoRepository<EmpLoginData, Long> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.EmployeeLocation;
import com.nisum.myteam.model.EmployeeLocation;
public interface EmployeeLocationRepo extends MongoRepository<EmployeeLocation, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import java.util.Optional;
......@@ -10,7 +10,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Employee;
import com.nisum.myteam.model.Employee;
public interface EmployeeRepo
extends MongoRepository<Employee, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.EmployeeRole;
import com.nisum.myteam.model.EmployeeRole;
public interface EmployeeRoleRepo extends MongoRepository<EmployeeRole, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.EmployeeShift;
import com.nisum.myteam.model.EmployeeShift;
public interface EmployeeShiftRepo extends MongoRepository<EmployeeShift, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.EmployeeVisa;
import com.nisum.myteam.model.EmployeeVisa;
public interface EmployeeVisaRepo extends MongoRepository<EmployeeVisa, String> {
List<EmployeeVisa> findByVisaName(String visaName);
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.MasterData;
import com.nisum.myteam.model.MasterData;
public interface MasterDataRepo extends MongoRepository<MasterData, String> {
List<MasterData> findByMasterDataTypeAndMasterDataNameAndActiveStatus(String masterDataType, String masterDataName, boolean activeStatus);
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.OrgLocation;
import com.nisum.myteam.model.OrgLocation;
public interface OrgLocationRepo extends MongoRepository<OrgLocation, String> {
List<OrgLocation> findByLocationAndActiveStatus(String location, boolean activeStatus);
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import java.util.Set;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Project;
import com.nisum.myteam.model.Project;
public interface ProjectRepo extends MongoRepository<Project, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import java.util.List;
import java.util.Optional;
......@@ -6,7 +6,7 @@ import java.util.Optional;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Resource;
import com.nisum.myteam.model.Resource;
public interface ResourceRepo
extends MongoRepository<Resource, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Role;
import com.nisum.myteam.model.Role;
public interface RoleRepo extends MongoRepository<Role, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Shift;
import com.nisum.myteam.model.Shift;
public interface ShiftRepo extends MongoRepository<Shift, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Skill;
import com.nisum.myteam.model.Skill;
public interface SkillRepo extends MongoRepository<Skill, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.TravelRequest;
import com.nisum.myteam.model.TravelRequest;
public interface TravelRepo extends MongoRepository<TravelRequest, String> {
......
package com.nisum.mytime.repository;
package com.nisum.myteam.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Visa;
import com.nisum.myteam.model.Visa;
public interface VisaRepo extends MongoRepository<Visa, String> {
......
package com.nisum.mytime.schedular;
package com.nisum.myteam.schedular;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
......
package com.nisum.mytime.schedular;
package com.nisum.myteam.schedular;
import java.sql.SQLException;
......@@ -7,12 +7,12 @@ import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.service.impl.EmployeeDataService;
import com.nisum.mytime.utils.MyTimeLogger;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.service.impl.EmployeeDataService;
import com.nisum.myteam.utils.MyTeamLogger;
@DisallowConcurrentExecution
public class MyTimeCronSchedularJob implements Job {
public class MyTeamCronSchedularJob implements Job {
@Autowired
private EmployeeDataService employeeDataService;
......
package com.nisum.myteam.service;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Account;
@Service
public interface IAccountService {
Account createAccount(Account account) throws MyTeamException;
Account updateAccount(Account account) throws MyTeamException;
boolean isAccountExists(Account account);
List<Account> getAccounts() throws MyTeamException;
List<Map<Object, Object>> getAccountsList() throws MyTeamException;
Account deleteAccount(String accountId) throws MyTeamException;
public List<Account> getAccountsAll() throws MyTeamException;
}
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.List;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.AttendenceData;
import com.nisum.myteam.model.EmpLoginData;
public interface IAttendanceService {
List<AttendenceData> getAttendanciesReport(String reportDate, String shift) throws MyTimeException, SQLException;
List<AttendenceData> getAttendanciesReport(String reportDate, String shift) throws MyTeamException, SQLException;
List generatePdfReport(long id, String fromDate, String toDate, String fromTime, String toTime)
throws MyTimeException;
throws MyTeamException;
List<EmpLoginData> employeeLoginReportBasedOnDateTime(long id, String fromDate, String toDate, String fromTime,
String toTime) throws MyTimeException, ParseException;
String toTime) throws MyTeamException, ParseException;
Boolean fetchEmployeesData(String perticularDate, boolean resynchFlag) throws MyTimeException;
Boolean fetchEmployeesData(String perticularDate, boolean resynchFlag) throws MyTeamException;
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTimeException;
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTeamException;
List generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException;
List generatePdfReport(long id, String fromDate, String toDate) throws MyTeamException;
}
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import org.springframework.stereotype.Service;
import com.nisum.mytime.model.Billing;
import com.nisum.mytime.model.Employee;
import com.nisum.myteam.model.Billing;
import com.nisum.myteam.model.Employee;
@Service
public interface IBillingService {
......
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Designation;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Designation;
@Service
public interface IDesignationService {
List<Designation> getAllDesignations() throws MyTimeException;
List<Designation> getAllDesignations() throws MyTeamException;
}
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.HashMap;
import java.util.List;
......@@ -7,8 +7,8 @@ import java.util.Set;
import org.springframework.stereotype.Service;
import com.mongodb.WriteResult;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Domain;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Domain;
/**
* @author Vijay
......@@ -19,19 +19,19 @@ public interface IDomainService {
boolean isDomainExists(Domain domainReq);
Domain create(Domain domain) throws MyTimeException;
Domain create(Domain domain) throws MyTeamException;
// List<HashMap<Object,Object>> getAllDomains() throws MyTimeException;
Domain update(Domain domain) throws MyTimeException;
Domain update(Domain domain) throws MyTeamException;
WriteResult delete(String id) throws MyTimeException;
WriteResult delete(String id) throws MyTeamException;
List<Domain> getDomainsList() throws MyTimeException;
List<Domain> getDomainsList() throws MyTeamException;
Set<String> accountsAssignedToDeliveryLead(String empId) throws MyTimeException;
Set<String> accountsAssignedToDeliveryLead(String empId) throws MyTeamException;
List<Domain> getDomainsUnderAccount(String accountId)throws MyTimeException;
List<Domain> getDomainsUnderAccount(String accountId)throws MyTeamException;
Domain getDomainById(String domainId);
......
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.EmpLoginData;
public interface IEmployeeDataService {
List<EmpLoginData> fetchEmployeeLoginsBasedOnDates(long employeeId, String fromDate, String toDate) throws MyTimeException;
List<EmpLoginData> fetchEmployeeLoginsBasedOnDatesTime(long employeeId, String fromDate, String nextDate,String toDate,String fromTime,String toTime) throws MyTimeException;
List<EmpLoginData> fetchEmployeeLoginsBasedOnDates(long employeeId, String fromDate, String toDate) throws MyTeamException;
List<EmpLoginData> fetchEmployeeLoginsBasedOnDatesTime(long employeeId, String fromDate, String nextDate,String toDate,String fromTime,String toTime) throws MyTeamException;
}
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import org.springframework.stereotype.Service;
import com.nisum.mytime.model.Employee;
import com.nisum.mytime.model.EmployeeLocation;
import com.nisum.myteam.model.Employee;
import com.nisum.myteam.model.EmployeeLocation;
@Service
public interface IEmployeeLocationService {
......
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import java.util.Set;
......@@ -6,19 +6,19 @@ import java.util.Set;
import org.springframework.stereotype.Service;
import com.mongodb.WriteResult;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.EmployeeRole;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.EmployeeRole;
@Service
public interface IEmployeeRoleService {
List<EmployeeRole> findByEmployeeId(String employeeId);
void addEmployeeRole(String employeeId, String roleId) throws MyTimeException;
void addEmployeeRole(String employeeId, String roleId) throws MyTeamException;
void saveUniqueEmployeeAndRole(List<String> employeeIds, String roleId) throws MyTimeException;
void saveUniqueEmployeeAndRole(List<String> employeeIds, String roleId) throws MyTeamException;
WriteResult deleteRole(String employeeId, String roleId) throws MyTimeException;
WriteResult deleteRole(String employeeId, String roleId) throws MyTeamException;
String getEmployeeRole(String employeeId);
......
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Employee;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Account;
import com.nisum.myteam.model.Employee;
@Service
public interface IEmployeeService {
boolean isEmployeeExistsById(String employeeId);
Employee createEmployee(Employee employeeRoles, String empId) throws MyTimeException;
Employee createEmployee(Employee employeeRoles, String empId) throws MyTeamException;
Employee updateEmployee(Employee employeeRoles, String empId);
Employee deleteEmployee(String empId);
Employee updateProfile(Employee employeeRoles) throws MyTimeException;
Employee updateProfile(Employee employeeRoles) throws MyTeamException;
Employee getEmployeeById(String empId);
Employee getEmployeeByEmaillId(String emailId);
List<Employee> getManagers() throws MyTimeException;
List<Employee> getManagers() throws MyTeamException;
List<Employee> getActiveEmployees() throws MyTimeException;
List<Employee> getActiveEmployees() throws MyTeamException;
List<Employee> getEmployeesByStatus(String status);
List<Account> getAccounts() throws MyTimeException;
List<Account> getAccounts() throws MyTeamException;
Employee getEmployeeRoleDataForSearchCriteria(String searchId, String searchAttribute);
......
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import org.springframework.stereotype.Service;
import com.nisum.mytime.model.Resource;
import com.nisum.myteam.model.Resource;
@Service
public interface IEmployeeShiftService {
......
/**
*
*/
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import com.nisum.mytime.model.EmailDomain;
import com.nisum.myteam.model.EmailDomain;
/**
* @author nisum
......
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.MasterData;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.MasterData;
@Service
public interface IMasterDataService {
List<MasterData> getMasterData() throws MyTimeException;
List<MasterData> getMasterData() throws MyTeamException;
List<MasterData> findByMasterDataTypeAndMasterDataNameAndActiveStatus(String masterDataType, String masterDataName,
boolean activeStatus);
......
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.OrgLocation;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.OrgLocation;
@Service
public interface IOrgLocationService {
List<OrgLocation> getLocations() throws MyTimeException;
List<OrgLocation> getLocations() throws MyTeamException;
List<OrgLocation> findByLocationAndActiveStatus(String location, boolean activeStatus);
}
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.Employee;
import com.nisum.mytime.model.EmployeeDashboardVO;
import com.nisum.mytime.model.Project;
import com.nisum.mytime.model.Resource;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.EmpLoginData;
import com.nisum.myteam.model.Employee;
import com.nisum.myteam.model.EmployeeDashboardVO;
import com.nisum.myteam.model.Project;
import com.nisum.myteam.model.Resource;
public interface IProjectService {
Project createProject(Project project, String loginEmpId) throws MyTimeException;
Project createProject(Project project, String loginEmpId) throws MyTeamException;
Project updateProject(Project project, String loginEmpId) throws MyTimeException;
Project updateProject(Project project, String loginEmpId) throws MyTeamException;
void deleteProject(String projectId);
List<Project> getProjectsUnderDomain(String domainId);
List<HashMap<Object, Object>> getProjects() throws MyTimeException;
List<HashMap<Object, Object>> getProjects() throws MyTeamException;
List<Project> getProjectsUnderDeliveryLead(String managerId) throws MyTimeException;
List<Project> getProjectsUnderDeliveryLead(String managerId) throws MyTeamException;
public Resource addNewBeanchAllocation(Employee employee, String loginEmpId);
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTimeException;
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTeamException;
String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException;
String generatePdfReport(long id, String fromDate, String toDate) throws MyTeamException;
List<Resource> getResourcesUnderProject(String empId);
......@@ -37,13 +37,13 @@ public interface IProjectService {
public List<EmployeeDashboardVO> getEmployeesDashBoard();
public String addProjectTeamMateWithCheck(Resource projectTeamMate, String loginEmpId) throws MyTimeException;
public String addProjectTeamMateWithCheck(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
public List<HashMap<Object, Object>> getProjectsForEmployee(String empId);
public Set<String> accountsAssignedToDl(String empId);
public List<HashMap<Object, Object>> deliveryLeadProjects(String empId) throws MyTimeException;
public List<HashMap<Object, Object>> deliveryLeadProjects(String empId) throws MyTeamException;
public List<Project> getAllProjects();
}
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import org.bson.types.ObjectId;
import org.springframework.stereotype.Service;
import com.nisum.mytime.model.Billing;
import com.nisum.mytime.model.Employee;
import com.nisum.mytime.model.Resource;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Billing;
import com.nisum.myteam.model.Employee;
import com.nisum.myteam.model.Resource;
@Service
public interface IResourceService {
Resource addResource(Resource projectTeamMate, String loginEmpId) throws MyTimeException;
Resource addResource(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
String updateResource(Resource projectTeamMate, String loginEmpId) throws MyTimeException;
String updateResource(Resource projectTeamMate, String loginEmpId) throws MyTeamException;
void deleteResource(String empId, String projectId, ObjectId id, String loginEmpId);
......
package com.nisum.myteam.service;
import org.springframework.stereotype.Service;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Role;
@Service
public interface IRoleService {
public Role addRole(Role roleInfo) throws MyTeamException;
public String getRole(String roleName) throws MyTeamException;
}
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Shift;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Shift;
@Service
public interface IShiftService {
List<Shift> getAllShifts() throws MyTimeException;
List<Shift> getAllShifts() throws MyTeamException;
}
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Skill;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Skill;
@Service
public interface ISkillService {
List<Skill> getTechnologies() throws MyTimeException;
List<Skill> getTechnologies() throws MyTeamException;
}
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.myteam.exception.handler.MyTeamException;
@Service
public interface IUploadXLService {
String importDataFromExcelFile(MultipartFile file, String empId) throws MyTimeException;
String importDataFromExcelFile(MultipartFile file, String empId) throws MyTeamException;
}
/**
*
*/
package com.nisum.mytime.service;
package com.nisum.myteam.service;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.EmployeeVisa;
import com.nisum.mytime.model.TravelRequest;
import com.nisum.mytime.model.Visa;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.EmployeeVisa;
import com.nisum.myteam.model.TravelRequest;
import com.nisum.myteam.model.Visa;
/**
* @author nisum
......
package com.nisum.mytime.service.impl;
package com.nisum.myteam.service.impl;
import java.util.ArrayList;
import java.util.Collections;
......@@ -16,16 +16,16 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import com.nisum.mytime.controller.AccountController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Employee;
import com.nisum.mytime.repository.AccountRepo;
import com.nisum.mytime.service.IAccountService;
import com.nisum.mytime.service.IRoleService;
import com.nisum.mytime.service.IEmployeeRoleService;
import com.nisum.mytime.utils.CommomUtil;
import com.nisum.mytime.utils.MyTimeUtils;
import com.nisum.myteam.controller.AccountController;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.Account;
import com.nisum.myteam.model.Employee;
import com.nisum.myteam.repository.AccountRepo;
import com.nisum.myteam.service.IAccountService;
import com.nisum.myteam.service.IEmployeeRoleService;
import com.nisum.myteam.service.IRoleService;
import com.nisum.myteam.utils.CommomUtil;
import com.nisum.myteam.utils.MyTeamUtils;
import lombok.extern.slf4j.Slf4j;
......@@ -47,10 +47,10 @@ public class AccountService implements IAccountService {
@Override
public Account createAccount(Account accountReq) throws MyTimeException {
public Account createAccount(Account accountReq) throws MyTeamException {
accountReq.setAccountId(generateAccountId());
accountReq.setStatus(MyTimeUtils.STRING_Y);
accountReq.setStatus(MyTeamUtils.STRING_Y);
Account accountPersisted = accountRepo.save(accountReq);
if (log.isInfoEnabled()) {
log.info("Account has been persisted in database with account details::" + accountPersisted);
......@@ -58,7 +58,7 @@ public class AccountService implements IAccountService {
if (accountPersisted != null) {
List<String> accountDmsList = accountReq.getDeliveryManagers();
if (accountDmsList != null && !accountDmsList.isEmpty() && accountDmsList.size() > 0) {
String roleId = roleInfoService.getRole(MyTimeUtils.ACCOUNT);
String roleId = roleInfoService.getRole(MyTeamUtils.ACCOUNT);
log.info("Going to add DM role id for account delivery managers::::" + accountDmsList);
roleMappingService.saveUniqueEmployeeAndRole(accountDmsList, roleId);
log.info("Added roleids for delivery managers in rolemapping collection");
......@@ -69,14 +69,14 @@ public class AccountService implements IAccountService {
}
@Override
public Account updateAccount(Account accountUpdating) throws MyTimeException {
public Account updateAccount(Account accountUpdating) throws MyTeamException {
Account accountBeforeUpdate = accountRepo.findByAccountId(accountUpdating.getAccountId());
accountUpdating.setStatus(accountBeforeUpdate.getStatus());
accountUpdating.setAccountName(accountUpdating.getAccountName().trim());
log.info("Updating the roleids of DeliveryManagers in RoleMapping Collection");
final String roleId = roleInfoService.getRole(MyTimeUtils.ACCOUNT);
final String roleId = roleInfoService.getRole(MyTeamUtils.ACCOUNT);
updateRoleIdsForDeliveryManager(accountUpdating, roleId);
log.info("Deleting the roleids of DeliveryManagers in RoleMapping Collection");
......@@ -97,12 +97,12 @@ public class AccountService implements IAccountService {
}
@Override
public List<Account> getAccounts() throws MyTimeException {
public List<Account> getAccounts() throws MyTeamException {
return accountRepo.findAll();
}
@Override
public List<Map<Object, Object>> getAccountsList() throws MyTimeException {
public List<Map<Object, Object>> getAccountsList() throws MyTeamException {
List<Map<Object, Object>> updatedAccountList = new ArrayList<>();
List<Map<String, String>> updatedEmployeeList = null;
for (Account account : accountRepo.findAll()) {
......@@ -116,16 +116,16 @@ public class AccountService implements IAccountService {
}
@Override
public Account deleteAccount(String accountId) throws MyTimeException {
public Account deleteAccount(String accountId) throws MyTeamException {
// delete the documents for deliveryManagers in rolemapping collection.
log.info("After updation:: Deleting the Roleids for DeliveryManagers in RoleMapping collection");
deleteRoleidsForDeliveryManagers(accountId);
// updating the status to "InActive".
Query query = new Query(Criteria.where(MyTimeUtils.ACCOUNT_ID).is(accountId));
Query query = new Query(Criteria.where(MyTeamUtils.ACCOUNT_ID).is(accountId));
Update update = new Update();
update.set(MyTimeUtils.STATUS, MyTimeUtils.STRING_N);
update.set(MyTeamUtils.STATUS, MyTeamUtils.STRING_N);
FindAndModifyOptions options = new FindAndModifyOptions();
options.upsert(true);
......@@ -137,11 +137,11 @@ public class AccountService implements IAccountService {
// generating the account id.
// accountId format is "Acc001"
private String generateAccountId() throws MyTimeException {
return (MyTimeUtils.ACC + MyTimeUtils.ZERO_) + (getAccounts().size() + MyTimeUtils.ONE);
private String generateAccountId() throws MyTeamException {
return (MyTeamUtils.ACC + MyTeamUtils.ZERO_) + (getAccounts().size() + MyTeamUtils.ONE);
}
private void updateRoleIdsForDeliveryManager(Account accountReq, String roleId) throws MyTimeException {
private void updateRoleIdsForDeliveryManager(Account accountReq, String roleId) throws MyTeamException {
List<String> updatingDmsList = accountReq.getDeliveryManagers();
List<String> persistedDmsList = accountRepo.findByAccountId(accountReq.getAccountId()).getDeliveryManagers();
......@@ -150,7 +150,7 @@ public class AccountService implements IAccountService {
roleMappingService.saveUniqueEmployeeAndRole(dmsAddedByUser, roleId);
}
private void deleteRoleIdsForDeliveryManager(Account accountUpdating, String roleId) throws MyTimeException {
private void deleteRoleIdsForDeliveryManager(Account accountUpdating, String roleId) throws MyTeamException {
List<String> dmIdList = null;
Map<String, Integer> dmsCountMap = new HashMap<String, Integer>();
......@@ -186,37 +186,37 @@ public class AccountService implements IAccountService {
// fetching the employee details using employeeId.
private List<Employee> getEmployeeDetails(Account account) {
List<Employee> employeeRoles = mongoTemplate.find(
new Query(Criteria.where(MyTimeUtils.EMPLOYEE_ID).in(account.getDeliveryManagers())),
new Query(Criteria.where(MyTeamUtils.EMPLOYEE_ID).in(account.getDeliveryManagers())),
Employee.class);
return employeeRoles;
}
private HashMap<String, String> getEmployeeDetails(Employee employeesRole) {
HashMap<String, String> employeeDetails = new HashMap<>();
employeeDetails.put(MyTimeUtils.EMPLOYEE_ID, employeesRole.getEmployeeId());
employeeDetails.put(MyTimeUtils.EMPLOYEE_NAME, employeesRole.getEmployeeName());
employeeDetails.put(MyTeamUtils.EMPLOYEE_ID, employeesRole.getEmployeeId());
employeeDetails.put(MyTeamUtils.EMPLOYEE_NAME, employeesRole.getEmployeeName());
return employeeDetails;
}
private Map<Object, Object> getAccuntDetails(Account account, List<Map<String, String>> updatedEmployeeList) {
Map<Object, Object> accountDetails = new HashMap<>();
//accountDetails.put(MyTimeUtils.ID_, account.getId());
accountDetails.put(MyTimeUtils.ACCOUNT_ID, account.getAccountId());
accountDetails.put(MyTimeUtils.ACCOUNT_NAME, account.getAccountName());
accountDetails.put(MyTimeUtils.STATUS, account.getStatus());
accountDetails.put(MyTimeUtils.CLIENT_ADDRESS, account.getClientAddress());
accountDetails.put(MyTimeUtils.INDUSTRY_TYPE, account.getIndustryType());
accountDetails.put(MyTimeUtils.DELIVERY_MANAGERS, updatedEmployeeList);
accountDetails.put(MyTeamUtils.ACCOUNT_ID, account.getAccountId());
accountDetails.put(MyTeamUtils.ACCOUNT_NAME, account.getAccountName());
accountDetails.put(MyTeamUtils.STATUS, account.getStatus());
accountDetails.put(MyTeamUtils.CLIENT_ADDRESS, account.getClientAddress());
accountDetails.put(MyTeamUtils.INDUSTRY_TYPE, account.getIndustryType());
accountDetails.put(MyTeamUtils.DELIVERY_MANAGERS, updatedEmployeeList);
return accountDetails;
}
private void deleteRoleidsForDeliveryManagers(String accountId) throws MyTimeException {
private void deleteRoleidsForDeliveryManagers(String accountId) throws MyTeamException {
int occurrences = 0;
List<Account> allAccountsList = null;
List<String> accountDms = null;
List<String> tempDmsList = new ArrayList<String>();
String roleId = roleInfoService.getRole(MyTimeUtils.ACCOUNT);
String roleId = roleInfoService.getRole(MyTeamUtils.ACCOUNT);
allAccountsList = accountRepo.findAll();
List<String> accountDmsList = accountRepo.findByAccountId(accountId).getDeliveryManagers();
......@@ -241,7 +241,7 @@ public class AccountService implements IAccountService {
@Override
public List<Account> getAccountsAll() throws MyTimeException {
public List<Account> getAccountsAll() throws MyTeamException {
return accountRepo.findAll();
}
......
package com.nisum.mytime.service.impl;
package com.nisum.myteam.service.impl;
import java.sql.Connection;
import java.sql.ResultSet;
......@@ -17,17 +17,17 @@ import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nisum.mytime.configuration.DbConnection;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.AttendenceData;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.Resource;
import com.nisum.mytime.repository.ResourceRepo;
import com.nisum.mytime.service.IAttendanceService;
import com.nisum.mytime.utils.CommomUtil;
import com.nisum.mytime.utils.MyTimeLogger;
import com.nisum.mytime.utils.MyTimeUtils;
import com.nisum.mytime.utils.PdfReportGenerator;
import com.nisum.myteam.configuration.DbConnection;
import com.nisum.myteam.exception.handler.MyTeamException;
import com.nisum.myteam.model.AttendenceData;
import com.nisum.myteam.model.EmpLoginData;
import com.nisum.myteam.model.Resource;
import com.nisum.myteam.repository.ResourceRepo;
import com.nisum.myteam.service.IAttendanceService;
import com.nisum.myteam.utils.CommomUtil;
import com.nisum.myteam.utils.MyTeamLogger;
import com.nisum.myteam.utils.MyTeamUtils;
import com.nisum.myteam.utils.PdfReportGenerator;
@Service
public class AttendanceService implements IAttendanceService {
......@@ -45,16 +45,16 @@ public class AttendanceService implements IAttendanceService {
private PdfReportGenerator pdfReportGenerator;
@Override
public List<AttendenceData> getAttendanciesReport(String reportDate, String shift) throws MyTimeException {
public List<AttendenceData> getAttendanciesReport(String reportDate, String shift) throws MyTeamException {
long start_ms = System.currentTimeMillis();
String reportDateInReqDateFormat = reportDate.replace("-", "/");
List<AttendenceData> listOfEmployees = getEmpsAttendenceByShiftWise(reportDateInReqDateFormat, shift);
MyTimeLogger.getInstance().info("Time Taken for " + (System.currentTimeMillis() - start_ms));
MyTeamLogger.getInstance().info("Time Taken for " + (System.currentTimeMillis() - start_ms));
return listOfEmployees;
}
@Override
public List<EmpLoginData> employeeLoginReportBasedOnDateTime(long id, String fromDate, String toDate,String fromTime,String toTime) throws MyTimeException, ParseException {
public List<EmpLoginData> employeeLoginReportBasedOnDateTime(long id, String fromDate, String toDate,String fromTime,String toTime) throws MyTeamException, ParseException {
String timeFrom= CommomUtil.convertTimeFormat(fromTime);
String timeTo= CommomUtil.convertTimeFormat(toTime);
String nextDayDate = CommomUtil.getNextDay(fromDate,fromTime,toTime);
......@@ -63,27 +63,27 @@ public class AttendanceService implements IAttendanceService {
@Override
public List generatePdfReport(long id, String fromDate, String toDate, String fromTime, String toTime)
throws MyTimeException {
throws MyTeamException {
return pdfReportGenerator.generateEmployeeReport(id, fromDate, toDate);
}
private List<AttendenceData> getEmpsAttendenceByShiftWise(String reportDate, String shift) throws MyTimeException {
private List<AttendenceData> getEmpsAttendenceByShiftWise(String reportDate, String shift) throws MyTeamException {
List<AttendenceData> listOfEmployees = new ArrayList<AttendenceData>();
Optional<List<Resource>> list = findEmpIdsByShiftWise(shift);
if(list.isPresent()) {
List<String> empIdList = list.get().stream().map(Resource::getEmployeeId).collect(Collectors.toList());
if(null != empIdList && empIdList.size() > MyTimeUtils.INT_ZERO) {
String query = buildSqlQuery(reportDate,empIdList.toString().substring(1, empIdList.toString().length()-1), MyTimeUtils.PRESENT);
listOfEmployees.addAll(getAttendenceData(query, MyTimeUtils.PRESENT));
if(null != empIdList && empIdList.size() > MyTeamUtils.INT_ZERO) {
String query = buildSqlQuery(reportDate,empIdList.toString().substring(1, empIdList.toString().length()-1), MyTeamUtils.PRESENT);
listOfEmployees.addAll(getAttendenceData(query, MyTeamUtils.PRESENT));
List<String> presentList = listOfEmployees.stream().map(AttendenceData :: getEmployeeId).collect(Collectors.toList());
empIdList.removeAll(presentList);
if(empIdList.size() > MyTimeUtils.INT_ZERO) {
query = buildSqlQuery(reportDate, empIdList.toString().substring(1, empIdList.toString().length()-1), MyTimeUtils.ABSENT);
listOfEmployees .addAll(getAttendenceData(query, MyTimeUtils.ABSENT));
if(empIdList.size() > MyTeamUtils.INT_ZERO) {
query = buildSqlQuery(reportDate, empIdList.toString().substring(1, empIdList.toString().length()-1), MyTeamUtils.ABSENT);
listOfEmployees .addAll(getAttendenceData(query, MyTeamUtils.ABSENT));
}
}
}
......@@ -92,8 +92,8 @@ public class AttendanceService implements IAttendanceService {
private Optional<List<Resource>> findEmpIdsByShiftWise(String shift) {
Optional<List<Resource>> list = null;
if(MyTimeUtils.ALL.equalsIgnoreCase(shift)) {
list = projectTeamMatesRepo.findByActiveAndShiftLikeOrderByEmployeeIdDesc( true, MyTimeUtils.SHIFT);
if(MyTeamUtils.ALL.equalsIgnoreCase(shift)) {
list = projectTeamMatesRepo.findByActiveAndShiftLikeOrderByEmployeeIdDesc( true, MyTeamUtils.SHIFT);
}else {
list = projectTeamMatesRepo.findByActiveAndShiftLikeOrderByEmployeeIdDesc( true,shift);
}
......@@ -102,16 +102,16 @@ public class AttendanceService implements IAttendanceService {
private String buildSqlQuery(String reportDate, String empIdsStr, String type) {
String query = null;
if(MyTimeUtils.PRESENT.equals(type)) {
query = MyTimeUtils.PRESENT_QUERY.replace("<REPORTDATE>", reportDate)
if(MyTeamUtils.PRESENT.equals(type)) {
query = MyTeamUtils.PRESENT_QUERY.replace("<REPORTDATE>", reportDate)
.replace("<EMPIDS>",empIdsStr);
}else {
query = MyTimeUtils.ABSENT_QUERY.replace("<ABSENTLIST>", empIdsStr);
query = MyTeamUtils.ABSENT_QUERY.replace("<ABSENTLIST>", empIdsStr);
}
return query;
}
private List<AttendenceData> getAttendenceData(String query, String type) throws MyTimeException {
private List<AttendenceData> getAttendenceData(String query, String type) throws MyTeamException {
List<AttendenceData> listOfEmployees = null;
try(Connection connection = dbConnection.getDBConnection();
Statement statement = connection.createStatement();
......@@ -127,8 +127,8 @@ public class AttendanceService implements IAttendanceService {
attendData = null;
}
} catch (Exception e) {
MyTimeLogger.getInstance().error("Exception occured due to : ", e);
throw new MyTimeException(e.getMessage());
MyTeamLogger.getInstance().error("Exception occured due to : ", e);
throw new MyTeamException(e.getMessage());
}
return listOfEmployees;
}
......@@ -136,18 +136,18 @@ public class AttendanceService implements IAttendanceService {
// @Override
public Boolean fetchEmployeesData(String perticularDate, boolean resynchFlag) throws MyTimeException {
public Boolean fetchEmployeesData(String perticularDate, boolean resynchFlag) throws MyTeamException {
return true;
}
// @Override
public List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate)
throws MyTimeException {
throws MyTeamException {
return employeeDataBaseService.fetchEmployeeLoginsBasedOnDates(id, fromDate, toDate);
}
@Override
public List generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException {
public List generatePdfReport(long id, String fromDate, String toDate) throws MyTeamException {
return pdfReportGenerator.generateEmployeeReport(id, fromDate, toDate);
}
......
This diff is collapsed.
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