package com.ecep.contract.service; import com.ecep.contract.PageContent; import com.ecep.contract.model.Employee; import com.ecep.contract.model.EmployeeRole; import com.ecep.contract.vm.EmployeeViewModel; import com.fasterxml.jackson.databind.JsonNode; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; @Service public class EmployeeService extends QueryService { public static final int DEFAULT_SYSTEM_EMPLOYEE_ID = 26; public Employee findByName(String name) { // TODO Auto-generated method stub throw new UnsupportedOperationException("Unimplemented method 'findByName'"); } public List getRolesByEmployeeId(Integer id) { try { return async("getRolesByEmployeeId", List.of(id), List.of(Integer.class)).handle((response, ex) -> { if (response != null) { try { List content = new ArrayList<>(); for (JsonNode node : response) { EmployeeRole newEntity = new EmployeeRole(); objectMapper.updateValue(newEntity, node); content.add(newEntity); } return content; } catch (Exception e) { throw new RuntimeException(response.toString(), e); } } return null; }).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } public void updateActive(int sessionId) { // TODO Auto-generated method stub throw new UnsupportedOperationException("Unimplemented method 'updateActive'"); } public Employee findByCode(String personCode) { // TODO Auto-generated method stub throw new UnsupportedOperationException("Unimplemented method 'findByCode'"); } }