diff --git a/build.gradle b/build.gradle index 70eaa991..062cee1b 100644 --- a/build.gradle +++ b/build.gradle @@ -3,24 +3,23 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.22.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.9.RELEASE") } } -plugins { - id 'java' - id 'org.springframework.boot' version '1.5.22.RELEASE' - id 'checkstyle' - id 'idea' -} +apply plugin: 'java' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' +apply plugin: 'checkstyle' +apply plugin: 'idea' checkstyle { configFile file("checkstyle.xml") } -jar { - baseName = 'ipa-api' - version = '0.1.0' +bootJar { + archiveBaseName = 'ipa-api' + archiveVersion = '0.1.0' } repositories { @@ -54,7 +53,7 @@ dependencies { compile("org.slf4j:slf4j-api:1.7.25") compile("org.apache.commons:commons-lang3:3.7") compile("javax.mail:mail:1.4.7") - compile("org.flywaydb:flyway-core:4.2.0") + compile("org.flywaydb:flyway-core:5.0.7") compile("org.apache.httpcomponents:httpclient:4.5.9") compile("org.javers:javers-core:2.4.1") compile("javax.xml.bind:jaxb-api:2.3.1") diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/BudgetRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/BudgetRepository.java index 11e755b3..0647aa20 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/BudgetRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/BudgetRepository.java @@ -4,7 +4,5 @@ import org.springframework.data.repository.CrudRepository; public interface BudgetRepository extends CrudRepository { - Budget findById(Long id); - Budget findByScheduleId(Long scheduleId); } \ No newline at end of file diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/BudgetScenarioRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/BudgetScenarioRepository.java index aae34eed..6d2c25dd 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/BudgetScenarioRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/BudgetScenarioRepository.java @@ -8,8 +8,6 @@ import java.util.List; public interface BudgetScenarioRepository extends CrudRepository { - BudgetScenario findById(Long id); - BudgetScenario findByBudgetIdAndName(long id, String budgetScenarioName); @Query( " SELECT DISTINCT bs" + diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/ExpenseItemRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/ExpenseItemRepository.java index 4bc4c1bd..7d1c0f12 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/ExpenseItemRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/ExpenseItemRepository.java @@ -22,8 +22,6 @@ public interface ExpenseItemRepository extends CrudRepository " AND bs.id = :budgetScenarioId ") List findByBudgetScenarioId(@Param("budgetScenarioId") Long budgetScenarioId); - ExpenseItem findById(Long expenseItemId); - void deleteById(long expenseItemId); @Modifying diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/ExpenseItemTypeRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/ExpenseItemTypeRepository.java index 197019ba..48fb36e7 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/ExpenseItemTypeRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/ExpenseItemTypeRepository.java @@ -4,7 +4,5 @@ import org.springframework.data.repository.CrudRepository; public interface ExpenseItemTypeRepository extends CrudRepository { - ExpenseItemType findById(long ExpenseItemTypeId); - ExpenseItemType findByDescription(String description); } \ No newline at end of file diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorCostRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorCostRepository.java index 0d780cce..285b566c 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorCostRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorCostRepository.java @@ -9,8 +9,6 @@ import java.util.List; public interface InstructorCostRepository extends CrudRepository { - InstructorCost findById(Long lineItemId); - void deleteById(long lineItemId); List findByBudgetId(Long budgetId); diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorRepository.java index 1e53cb09..3569f3dd 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorRepository.java @@ -5,9 +5,6 @@ import edu.ucdavis.dss.ipa.entities.Instructor; public interface InstructorRepository extends CrudRepository { - - Instructor findById(Long id); - Instructor findByUcdStudentSID(String ucdStudentSID); Instructor findByLoginIdIgnoreCase(String loginId); diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorSupportCallResponseRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorSupportCallResponseRepository.java index 9172674d..fa8a250c 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorSupportCallResponseRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorSupportCallResponseRepository.java @@ -6,8 +6,6 @@ import java.util.List; public interface InstructorSupportCallResponseRepository extends CrudRepository { - InstructorSupportCallResponse findById (long instructorSupportCallResponseId); - List findByScheduleId (long scheduleId); InstructorSupportCallResponse findByScheduleIdAndInstructorIdAndTermCode(long scheduleId, long instructorId, String termCode); diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorSupportPreferenceRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorSupportPreferenceRepository.java index b5b6a270..e015f226 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorSupportPreferenceRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorSupportPreferenceRepository.java @@ -18,7 +18,5 @@ public interface InstructorSupportPreferenceRepository extends CrudRepository findByInstructorId(long instructorId); - InstructorSupportPreference findById(long preferenceId); - List findByInstructorIdAndSectionGroupId(Long instructorId, Long sectionGroupId); } diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorTypeCostRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorTypeCostRepository.java index fd1652cd..43b9c1ea 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorTypeCostRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorTypeCostRepository.java @@ -9,8 +9,6 @@ import java.util.List; public interface InstructorTypeCostRepository extends CrudRepository { - InstructorTypeCost findById(Long instructorTypeId); - void deleteById(long instructorTypeCostId); InstructorTypeCost findByInstructorTypeIdAndBudgetId(long instructorTypeId, long budgetId); diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorTypeRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorTypeRepository.java index 5aeaf7ca..63b244de 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorTypeRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/InstructorTypeRepository.java @@ -4,5 +4,4 @@ import org.springframework.data.repository.CrudRepository; public interface InstructorTypeRepository extends CrudRepository { - InstructorType findById(Long instructorTypeId); } diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemCategoryRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemCategoryRepository.java index be358a7e..c16c1958 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemCategoryRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemCategoryRepository.java @@ -9,7 +9,5 @@ import java.util.List; public interface LineItemCategoryRepository extends CrudRepository { - LineItemCategory findById(long lineItemCategoryId); - LineItemCategory findByDescription(String description); } diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemRepository.java index 1cfb6e4c..d73adc29 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemRepository.java @@ -16,8 +16,6 @@ public interface LineItemRepository extends CrudRepository { " AND b.id = :budgetId ") List findByBudgetId(@Param("budgetId") Long budgetId); - LineItem findById(Long lineItemId); - void deleteById(long lineItemId); @Modifying diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemTypeRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemTypeRepository.java index dca9dfc2..df198b5a 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemTypeRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/LineItemTypeRepository.java @@ -4,5 +4,4 @@ import org.springframework.data.repository.CrudRepository; public interface LineItemTypeRepository extends CrudRepository { - LineItemType findById(long LineItemTypeId); } diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/ReasonCategoryRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/ReasonCategoryRepository.java index 8b6cd9c4..bcf93915 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/ReasonCategoryRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/ReasonCategoryRepository.java @@ -4,5 +4,4 @@ import org.springframework.data.repository.CrudRepository; public interface ReasonCategoryRepository extends CrudRepository { - ReasonCategory findById(long reasonCategoryId); } \ No newline at end of file diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupCostInstructorRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupCostInstructorRepository.java index c2033814..8ca31bbe 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupCostInstructorRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupCostInstructorRepository.java @@ -10,8 +10,6 @@ import java.util.List; public interface SectionGroupCostInstructorRepository extends CrudRepository { - SectionGroupCostInstructor findById(long sectionGroupCostInstructorId); - @Query( " SELECT DISTINCT sgci" + " FROM SectionGroupCostInstructor sgci, SectionGroupCost sgc, BudgetScenario bs, Budget b" + " WHERE b.id = :budgetId" + diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupCostRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupCostRepository.java index 1657a972..f3161a23 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupCostRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupCostRepository.java @@ -15,8 +15,6 @@ public interface SectionGroupCostRepository extends CrudRepository findByBudgetId(@Param("budgetId") Long budgetId); - SectionGroupCost findById(long sectionGroupCostId); - @Query( " SELECT DISTINCT sgc" + " FROM Schedule s, Workgroup w, Budget b, BudgetScenario bs, SectionGroupCost sgc" + " WHERE sgc.budgetScenario = bs" + diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupRepository.java index ffdc3257..f41c9c57 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionGroupRepository.java @@ -8,8 +8,6 @@ import java.util.List; public interface SectionGroupRepository extends CrudRepository { - SectionGroup findById(Long id); - List findByCourseScheduleWorkgroupIdAndCourseScheduleYear(long workgroupId, long year); @Query( " SELECT DISTINCT sg" + diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionRepository.java index 43e69f49..5d36a918 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/SectionRepository.java @@ -8,9 +8,6 @@ import java.util.List; public interface SectionRepository extends CrudRepository { - - Section findById(Long id); - /** * Finds sections that do have sections and those sections have the * visible flag set to true or Null diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/SupportAssignmentRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/SupportAssignmentRepository.java index 40b864ed..15761927 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/SupportAssignmentRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/SupportAssignmentRepository.java @@ -7,6 +7,4 @@ import org.springframework.transaction.annotation.Transactional; public interface SupportAssignmentRepository extends CrudRepository { - - SupportAssignment findById(Long id); } diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/SupportStaffRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/SupportStaffRepository.java index c57c79aa..606d1781 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/SupportStaffRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/SupportStaffRepository.java @@ -4,8 +4,5 @@ import org.springframework.data.repository.CrudRepository; public interface SupportStaffRepository extends CrudRepository { - - SupportStaff findById(Long id); - SupportStaff findByLoginIdIgnoreCase(String loginId); } \ No newline at end of file diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/TeachingAssignmentRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/TeachingAssignmentRepository.java index d566c9ea..1c9ed186 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/TeachingAssignmentRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/TeachingAssignmentRepository.java @@ -12,9 +12,6 @@ import java.util.List; public interface TeachingAssignmentRepository extends CrudRepository { - - TeachingAssignment findById(Long id); - TeachingAssignment findOneBySectionGroupAndInstructorAndTermCode(SectionGroup sectionGroup, Instructor instructor, String termCode); TeachingAssignment findOneByInstructorIdAndScheduleIdAndTermCodeAndBuyoutAndAndCourseReleaseAndSabbaticalAndInResidenceAndWorkLifeBalanceAndLeaveOfAbsenceAndSabbaticalInResidenceAndJointAppointmentAndInterdisciplinaryTeachingAndWorkLoadCredit( diff --git a/src/main/java/edu/ucdavis/dss/ipa/repositories/UserRepository.java b/src/main/java/edu/ucdavis/dss/ipa/repositories/UserRepository.java index 2f53b5af..3019819a 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/repositories/UserRepository.java +++ b/src/main/java/edu/ucdavis/dss/ipa/repositories/UserRepository.java @@ -13,8 +13,6 @@ public interface UserRepository extends CrudRepository { User findByToken(String token); - User findById(Long id); - @Query("SELECT u FROM User u WHERE u.loginId LIKE :query% OR u.firstName LIKE :query% OR u.lastName LIKE :query%") List findByFirstNameOrLastNameOrLoginId(@Param("query") String query); diff --git a/src/main/java/edu/ucdavis/dss/ipa/security/CasEntryPoint.java b/src/main/java/edu/ucdavis/dss/ipa/security/CasEntryPoint.java index 2bb5a32d..ac6051c9 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/security/CasEntryPoint.java +++ b/src/main/java/edu/ucdavis/dss/ipa/security/CasEntryPoint.java @@ -33,12 +33,8 @@ public CasEntryPoint(String preLoginPath, String casLoginUrl, String returnUrl) public String getReturnUrl() { return returnUrl; } public String getCasLoginUrl() { - try { - return casLoginUrl + (casLoginUrl.contains("?") ? "&" : "?") - + ServiceProperties.DEFAULT_CAS_SERVICE_PARAMETER + "=" + UriUtils.encode(getReturnUrl(), "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } + return casLoginUrl + (casLoginUrl.contains("?") ? "&" : "?") + + ServiceProperties.DEFAULT_CAS_SERVICE_PARAMETER + "=" + UriUtils.encode(getReturnUrl(), "UTF-8"); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaActivityService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaActivityService.java index afe10fd1..550835d6 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaActivityService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaActivityService.java @@ -60,13 +60,13 @@ public Activity saveActivity(Activity activity) { @Override public Activity findOneById(Long id) { - return this.activityRepository.findOne(id); + return this.activityRepository.findById(id).orElse(null); } @Override @Transactional public void deleteActivityById(Long id) { - activityRepository.delete(id); + activityRepository.deleteById(id); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaBudgetScenarioService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaBudgetScenarioService.java index 5ddef810..f7f4729b 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaBudgetScenarioService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaBudgetScenarioService.java @@ -124,7 +124,7 @@ public BudgetScenario findOrCreate(Budget budget, String budgetScenarioName) { @Transactional @Override public BudgetScenario createFromExisting(Long workgroupId, Long scenarioId, String name, boolean copyFunds) { - BudgetScenario originalBudgetScenario = budgetScenarioRepository.findById(scenarioId); + BudgetScenario originalBudgetScenario = budgetScenarioRepository.findById(scenarioId).orElse(null); if (originalBudgetScenario == null) { return null; @@ -165,7 +165,7 @@ public BudgetScenario createFromExisting(Long workgroupId, Long scenarioId, Stri } public BudgetScenario createBudgetRequestScenario(long workgroupId, long scenarioId) { - BudgetScenario originalScenario = budgetScenarioRepository.findById(scenarioId); + BudgetScenario originalScenario = budgetScenarioRepository.findById(scenarioId).orElse(null); if (originalScenario == null) { return null; } @@ -223,7 +223,7 @@ public BudgetScenario createBudgetRequestScenario(long workgroupId, long scenari @Override public BudgetScenario approveBudgetRequestScenario(long workgroupId, long scenarioId) { - BudgetScenario approvedScenario = budgetScenarioRepository.findById(scenarioId); + BudgetScenario approvedScenario = budgetScenarioRepository.findById(scenarioId).orElse(null); // only one budget request should be approved at a time List budgetRequestScenarios = budgetScenarioRepository.findbyWorkgroupIdAndYear(workgroupId, @@ -370,11 +370,11 @@ private BudgetScenario updateFromLiveData(BudgetScenario liveDataScenario, Boole @Override public BudgetScenario findById(long budgetScenarioId) { - return budgetScenarioRepository.findById(budgetScenarioId); + return budgetScenarioRepository.findById(budgetScenarioId).orElse(null); } @Override public void deleteById(long budgetScenarioId) { - budgetScenarioRepository.delete(budgetScenarioId); + budgetScenarioRepository.deleteById(budgetScenarioId); } } diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaBudgetService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaBudgetService.java index 74177247..3f196efa 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaBudgetService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaBudgetService.java @@ -54,7 +54,7 @@ public Budget findOrCreateByWorkgroupIdAndYear(long workgroupId, long year) { @Override public Budget findById(long budgetId) { - return budgetRepository.findById(budgetId); + return budgetRepository.findById(budgetId).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaCourseService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaCourseService.java index 6c167bca..2e82114f 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaCourseService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaCourseService.java @@ -23,7 +23,7 @@ public class JpaCourseService implements CourseService { @Override public Course getOneById(Long id) { - return this.courseRepository.findOne(id); + return this.courseRepository.findById(id).orElse(null); } private Course save(Course course) { @@ -121,7 +121,7 @@ public boolean delete(Long id) { try { course.setTags(new ArrayList()); this.save(course); - this.courseRepository.delete(id); + this.courseRepository.deleteById(id); return true; } catch (EmptyResultDataAccessException e) { diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaExpenseItemService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaExpenseItemService.java index 71f4d8f3..a80d2baf 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaExpenseItemService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaExpenseItemService.java @@ -26,7 +26,7 @@ public List findByBudgetScenarioId(Long budgetScenarioId) { @Override public ExpenseItem findById(Long expenseItemId) { - return expenseItemRepository.findById(expenseItemId); + return expenseItemRepository.findById(expenseItemId).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaExpenseItemTypeService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaExpenseItemTypeService.java index 552640b3..242c600f 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaExpenseItemTypeService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaExpenseItemTypeService.java @@ -20,7 +20,7 @@ public List findAll() { @Override public ExpenseItemType findById(long ExpenseItemTypeId) { - return ExpenseItemTypeRepository.findById(ExpenseItemTypeId); + return ExpenseItemTypeRepository.findById(ExpenseItemTypeId).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorCostService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorCostService.java index 28d4723e..e61053f3 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorCostService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorCostService.java @@ -28,7 +28,7 @@ public InstructorCost findByInstructorIdAndBudgetId(Long instructorId, Long budg @Override public InstructorCost findById(Long lineItemId) { - return instructorCostRepository.findById(lineItemId); + return instructorCostRepository.findById(lineItemId).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorService.java index b088e55f..82bc4dbb 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorService.java @@ -34,7 +34,7 @@ public Instructor save(Instructor instructor) { @Override public Instructor getOneById(Long id) { - return this.instructorRepository.findById(id); + return this.instructorRepository.findById(id).orElse(null); } @Override @@ -93,7 +93,7 @@ public void removeOrphanedByLoginId(String loginId) { if (instructor.getTeachingAssignments().size() == 0 && instructor.getTeachingCallResponses().size() == 0 && instructor.getTeachingCallReceipts().size() == 0) { - instructorRepository.delete(instructor.getId()); + instructorRepository.deleteById(instructor.getId()); } } diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorSupportCallResponseService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorSupportCallResponseService.java index 56069bea..2ab72c7b 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorSupportCallResponseService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorSupportCallResponseService.java @@ -35,7 +35,7 @@ public class JpaInstructorSupportCallResponseService implements InstructorSuppor @Override public InstructorSupportCallResponse findOneById(long instructorInstructionalSupportCallResponseId) { - return instructorSupportCallResponseRepository.findById(instructorInstructionalSupportCallResponseId); + return instructorSupportCallResponseRepository.findById(instructorInstructionalSupportCallResponseId).orElse(null); } @Override @@ -48,7 +48,7 @@ public List findByScheduleId(long scheduleId) { @Override public void delete(long instructorInstructionalSupportCallResponseId) { - instructorSupportCallResponseRepository.delete(instructorInstructionalSupportCallResponseId); + instructorSupportCallResponseRepository.deleteById(instructorInstructionalSupportCallResponseId); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorSupportPreferenceService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorSupportPreferenceService.java index ce9585ab..bae7bb7b 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorSupportPreferenceService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorSupportPreferenceService.java @@ -160,6 +160,6 @@ public List findByScheduleIdAndTermCode(long schedu } private InstructorSupportPreference findById(long preferenceId) { - return this.instructorSupportPreferenceRepository.findById(preferenceId); + return this.instructorSupportPreferenceRepository.findById(preferenceId).orElse(null); } } diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorTypeCostService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorTypeCostService.java index 3544504d..cb6faadd 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorTypeCostService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorTypeCostService.java @@ -29,7 +29,7 @@ public InstructorTypeCost findByInstructorTypeIdAndBudgetId(long instructorTypeI @Override public InstructorTypeCost findById(Long instructorTypeId) { - return instructorTypeCostRepository.findById(instructorTypeId); + return instructorTypeCostRepository.findById(instructorTypeId).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorTypeService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorTypeService.java index e85168c5..6a632f04 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorTypeService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaInstructorTypeService.java @@ -21,7 +21,7 @@ public class JpaInstructorTypeService implements InstructorTypeService { @Override public InstructorType findById(Long instructorTypeId) { - return instructorTypeRepository.findById(instructorTypeId); + return instructorTypeRepository.findById(instructorTypeId).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemCategoryService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemCategoryService.java index 7aef7eff..f95862fe 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemCategoryService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemCategoryService.java @@ -22,7 +22,7 @@ public List findAll() { @Override public LineItemCategory findById(long lineItemCategoryId) { - return lineItemCategoryRepository.findById(lineItemCategoryId); + return lineItemCategoryRepository.findById(lineItemCategoryId).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemService.java index b6c530b1..1955cfd7 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemService.java @@ -22,7 +22,7 @@ public List findByBudgetId(Long budgetId) { @Override public LineItem findById(Long lineItemId) { - return lineItemRepository.findById(lineItemId); + return lineItemRepository.findById(lineItemId).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemTypeService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemTypeService.java index 5919106d..59c1161d 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemTypeService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLineItemTypeService.java @@ -19,6 +19,6 @@ public List findAll() { @Override public LineItemType findById(long lineItemTypeId) { - return LineItemTypeRepository.findById(lineItemTypeId); + return LineItemTypeRepository.findById(lineItemTypeId).orElse(null); } } diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLocationService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLocationService.java index 745d3ed4..e22ae87e 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLocationService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaLocationService.java @@ -28,13 +28,13 @@ public Location save(Location activity) @Override public Location findOneById(Long id) { - return this.locationRepository.findOne(id); + return this.locationRepository.findById(id).orElse(null); } @Transactional @Override public Location archiveById(Long id) { - Location location = this.locationRepository.findOne(id); + Location location = this.locationRepository.findById(id).orElse(null); if(location == null) { return null; } diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaRoleService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaRoleService.java index c9171695..443b3ee6 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaRoleService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaRoleService.java @@ -29,7 +29,7 @@ public void saveRole(Role role) @Override public Role findOneById(Long id) { - return this.roleRepository.findOne(id); + return this.roleRepository.findById(id).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaScheduleInstructorNoteService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaScheduleInstructorNoteService.java index 12a0c157..03fc6ced 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaScheduleInstructorNoteService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaScheduleInstructorNoteService.java @@ -25,7 +25,7 @@ public ScheduleInstructorNote saveScheduleInstructorNote(ScheduleInstructorNote @Override public ScheduleInstructorNote findById(Long id) { - return scheduleInstructorNoteRepository.findOne(id); + return scheduleInstructorNoteRepository.findById(id).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaScheduleService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaScheduleService.java index e9bffde8..cace1e91 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaScheduleService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaScheduleService.java @@ -33,7 +33,7 @@ public Schedule saveSchedule(Schedule schedule) { @Override public Schedule findById(long id) { - return this.scheduleRepository.findOne(id); + return this.scheduleRepository.findById(id).orElse(null); } @Override @@ -58,7 +58,7 @@ public Schedule createSchedule(Long workgroupId, long year) { @Override @Transactional public Workgroup getWorkgroupByScheduleId(Long scheduleId) { - Schedule schedule = this.scheduleRepository.findOne(scheduleId); + Schedule schedule = this.scheduleRepository.findById(scheduleId).orElse(null); if (schedule != null) { Workgroup d = schedule.getWorkgroup(); Hibernate.initialize(d); diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupCostInstructorService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupCostInstructorService.java index f07df006..08bd0a52 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupCostInstructorService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupCostInstructorService.java @@ -75,7 +75,7 @@ public SectionGroupCostInstructor findOrCreate(SectionGroupCostInstructor sectio @Override public SectionGroupCostInstructor findById(long sectionGroupCostInstructorId) { - return this.sectionGroupCostInstructorRepository.findById(sectionGroupCostInstructorId); + return this.sectionGroupCostInstructorRepository.findById(sectionGroupCostInstructorId).orElse(null); } @Override @@ -101,7 +101,7 @@ private SectionGroupCostInstructor save(SectionGroupCostInstructor sectionGroupC @Override public void delete(long sectionGroupCostInstructorId){ - this.sectionGroupCostInstructorRepository.delete(sectionGroupCostInstructorId); + this.sectionGroupCostInstructorRepository.deleteById(sectionGroupCostInstructorId); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupCostService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupCostService.java index 177404c7..eca7ab99 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupCostService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupCostService.java @@ -54,17 +54,17 @@ public SectionGroupCost createOrUpdateFrom(SectionGroupCost originalSectionGroup } if (originalSectionGroupCost.getInstructorType() != null) { - InstructorType instructorType = instructorTypeRepository.findById(originalSectionGroupCost.getInstructorType().getId()); + InstructorType instructorType = instructorTypeRepository.findById(originalSectionGroupCost.getInstructorType().getId()).orElse(null); originalSectionGroupCost.setInstructorType(instructorType); } if (originalSectionGroupCost.getInstructor() != null) { - Instructor instructor = instructorRepository.findById(originalSectionGroupCost.getInstructor().getId()); + Instructor instructor = instructorRepository.findById(originalSectionGroupCost.getInstructor().getId()).orElse(null); sectionGroupCost.setInstructor(instructor); } if (originalSectionGroupCost.getReasonCategory() != null) { - ReasonCategory reasonCategory = reasonCategoryRepository.findById(originalSectionGroupCost.getReasonCategory().getId()); + ReasonCategory reasonCategory = reasonCategoryRepository.findById(originalSectionGroupCost.getReasonCategory().getId()).orElse(null); sectionGroupCost.setReasonCategory(reasonCategory); } @@ -135,7 +135,7 @@ public SectionGroupCost createFromSectionGroup(SectionGroup sectionGroup, Budget @Override public SectionGroupCost findById(long sectionGroupCostId) { - return this.sectionGroupCostRepository.findById(sectionGroupCostId); + return this.sectionGroupCostRepository.findById(sectionGroupCostId).orElse(null); } @Override @@ -158,11 +158,11 @@ public SectionGroupCost update(SectionGroupCost sectionGroupCostDTO) { originalSectionGroupCost.setReason(sectionGroupCostDTO.getReason()); originalSectionGroupCost.setDisabled(sectionGroupCostDTO.isDisabled()); - originalSectionGroupCost.setInstructor(instructorRepository.findById(sectionGroupCostDTO.getInstructorIdentification())); - originalSectionGroupCost.setOriginalInstructor(instructorRepository.findById(sectionGroupCostDTO.getOriginalInstructorIdentification())); - originalSectionGroupCost.setInstructorType(instructorTypeRepository.findById(sectionGroupCostDTO.getInstructorType().getId())); + originalSectionGroupCost.setInstructor(instructorRepository.findById(sectionGroupCostDTO.getInstructorIdentification()).orElse(null)); + originalSectionGroupCost.setOriginalInstructor(instructorRepository.findById(sectionGroupCostDTO.getOriginalInstructorIdentification()).orElse(null)); + originalSectionGroupCost.setInstructorType(instructorTypeRepository.findById(sectionGroupCostDTO.getInstructorType().getId()).orElse(null)); if(sectionGroupCostDTO.getReasonCategory() != null){ - originalSectionGroupCost.setReasonCategory(reasonCategoryRepository.findById(sectionGroupCostDTO.getReasonCategory().getId())); + originalSectionGroupCost.setReasonCategory(reasonCategoryRepository.findById(sectionGroupCostDTO.getReasonCategory().getId()).orElse(null)); } return this.save(originalSectionGroupCost); } @@ -183,7 +183,7 @@ public SectionGroupCost findBySubjectCodeAndCourseNumberAndSequencePatternAndBud @Override public void delete(Long sectionGroupCostId) { - this.sectionGroupCostRepository.delete(sectionGroupCostId); + this.sectionGroupCostRepository.deleteById(sectionGroupCostId); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupService.java index 2641455c..43c26b5b 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionGroupService.java @@ -33,7 +33,7 @@ public class JpaSectionGroupService implements SectionGroupService { @Transactional //@PreAuthorize("hasAnyRole('admin','academicCoordinator')") public SectionGroup getOneById(Long id) { - return sectionGroupRepository.findOne(id); + return sectionGroupRepository.findById(id).orElse(null); } @Override @@ -43,7 +43,7 @@ public SectionGroup save(SectionGroup sectionGroup) { @Override public void delete(Long id) { - this.sectionGroupRepository.delete(id); + this.sectionGroupRepository.deleteById(id); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionService.java index e46bb9dc..5ce60f11 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSectionService.java @@ -23,13 +23,13 @@ public Section save(@Valid Section section) { @Override @Transactional public boolean delete(Long id) { - this.sectionRepository.delete(id); + this.sectionRepository.deleteById(id); return true; } @Override public Section getOneById(Long id) { - return this.sectionRepository.findById(id); + return this.sectionRepository.findById(id).orElse(null); } /** diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaStudentSupportCallResponseService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaStudentSupportCallResponseService.java index 92614393..9115966f 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaStudentSupportCallResponseService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaStudentSupportCallResponseService.java @@ -47,7 +47,7 @@ public List findByScheduleId(long scheduleId) { @Override public void delete(long studentInstructionalSupportCallResponseId) { - studentSupportCallResponseRepository.delete(studentInstructionalSupportCallResponseId); + studentSupportCallResponseRepository.deleteById(studentInstructionalSupportCallResponseId); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportAppointmentService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportAppointmentService.java index 1343683d..112a459f 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportAppointmentService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportAppointmentService.java @@ -14,7 +14,7 @@ public class JpaSupportAppointmentService implements SupportAppointmentService { @Override public void delete(Long supportAppointmentId) { - this.supportAppointmentRepository.delete(supportAppointmentId); + this.supportAppointmentRepository.deleteById(supportAppointmentId); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportAssignmentService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportAssignmentService.java index d0ea554e..78479613 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportAssignmentService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportAssignmentService.java @@ -92,12 +92,12 @@ public List findVisibleByScheduleAndInstructorId(Schedule sch @Override public SupportAssignment findOneById(Long instructionalSupportAssignmentId) { - return this.supportAssignmentRepository.findById(instructionalSupportAssignmentId); + return this.supportAssignmentRepository.findById(instructionalSupportAssignmentId).orElse(null); } @Override public void delete(Long instructionalSupportAssignmentId) { - this.supportAssignmentRepository.delete(instructionalSupportAssignmentId); + this.supportAssignmentRepository.deleteById(instructionalSupportAssignmentId); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportStaffService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportStaffService.java index 72099402..1716b377 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportStaffService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSupportStaffService.java @@ -22,7 +22,7 @@ public SupportStaff save(SupportStaff supportStaff) { @Override public SupportStaff findOneById(long instructionalSupportStaffId) { - return this.supportStaffRepository.findById(instructionalSupportStaffId); + return this.supportStaffRepository.findById(instructionalSupportStaffId).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSyncActionService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSyncActionService.java index 2d239604..87704edc 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSyncActionService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaSyncActionService.java @@ -22,12 +22,12 @@ public SyncAction save(@NotNull @Valid SyncAction syncAction) { @Override public SyncAction getOneById(Long id) { - return syncActionRepository.findOne(id); + return syncActionRepository.findById(id).orElse(null); } @Override public void delete(Long id) { - syncActionRepository.delete(id); + syncActionRepository.deleteById(id); } } diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTagService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTagService.java index af59b546..0d3d9c8f 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTagService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTagService.java @@ -27,7 +27,7 @@ public Tag save(Tag tag) @Override public Tag getOneById(Long id) { - return this.trackRepository.findOne(id); + return this.trackRepository.findById(id).orElse(null); } @Override @@ -50,7 +50,7 @@ public List searchTags(String query, Workgroup workgroup) { @Override public Tag archiveById(Long id) { - Tag tag = this.trackRepository.findOne(id); + Tag tag = this.trackRepository.findById(id).orElse(null); // Remove this tag from COGs only in active schedules for (Course cog : tag.getCourses()){ diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingAssignmentService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingAssignmentService.java index 82ea83df..936e76ed 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingAssignmentService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingAssignmentService.java @@ -50,7 +50,7 @@ public TeachingAssignment save(TeachingAssignment teachingAssignment) { @Override @Transactional public void delete(Long id) { - teachingAssignmentRepository.delete(id); + teachingAssignmentRepository.deleteById(id); } @Override @@ -60,7 +60,7 @@ public TeachingAssignment findOneBySectionGroupAndInstructorAndTermCode(SectionG @Override public TeachingAssignment findOneById(Long id) { - return teachingAssignmentRepository.findById(id); + return teachingAssignmentRepository.findById(id).orElse(null); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingCallReceiptService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingCallReceiptService.java index b4bfffea..747f884e 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingCallReceiptService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingCallReceiptService.java @@ -48,7 +48,7 @@ public TeachingCallReceipt save(TeachingCallReceipt teachingCallReceipt) @Override public TeachingCallReceipt findOneById(Long id) { - return this.teachingCallReceiptRepository.findOne(id); + return this.teachingCallReceiptRepository.findById(id).orElse(null); } @Override @@ -279,7 +279,7 @@ public List createOrUpdateMany(List instructorIds, Te @Transactional @Override public List saveAll(List teachingCallReceipts) { - return (List) teachingCallReceiptRepository.save(teachingCallReceipts); + return (List) teachingCallReceiptRepository.saveAll(teachingCallReceipts); } private TeachingCallReceipt findByInstructorIdAndScheduleId(Long instructorId, long scheduleId) { @@ -289,7 +289,7 @@ private TeachingCallReceipt findByInstructorIdAndScheduleId(Long instructorId, l @Override @Transactional public boolean delete(Long id) { - this.teachingCallReceiptRepository.delete(id); + this.teachingCallReceiptRepository.deleteById(id); return true; } diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingCallResponseService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingCallResponseService.java index 24b41f74..ac946cbb 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingCallResponseService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaTeachingCallResponseService.java @@ -34,12 +34,12 @@ public TeachingCallResponse save(TeachingCallResponse teachingCallResponse) @Override public TeachingCallResponse getOneById(Long id) { - return this.teachingCallResponseRepository.findOne(id); + return this.teachingCallResponseRepository.findById(id).orElse(null); } @Override public void delete(Long id) { - this.teachingCallResponseRepository.delete(id); + this.teachingCallResponseRepository.deleteById(id); } @Override diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaUserRoleService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaUserRoleService.java index 8706bc49..432c6571 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaUserRoleService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaUserRoleService.java @@ -61,7 +61,7 @@ public UserRole save(UserRole userRole) { @Override public UserRole getOneById(Long id) { - return this.userRoleRepository.findOne(id); + return this.userRoleRepository.findById(id).orElse(null); } @Override @@ -99,7 +99,7 @@ public UserRole findOrCreateByLoginIdAndWorkgroupIdAndRoleToken(String loginId, userRole.setRole(role); if (roleName.equals("instructor")) { - InstructorType instructorType = instructorTypeRepository.findById(7L); + InstructorType instructorType = instructorTypeRepository.findById(7L).orElse(null); userRole.setInstructorType(instructorType); } diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaUserService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaUserService.java index 17ddf239..2d824a20 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaUserService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaUserService.java @@ -42,7 +42,7 @@ public User getOneByLoginId(String loginId) @Override public User getOneById(Long id) { - return this.userRepository.findById(id); + return this.userRepository.findById(id).orElse(null); } private List toList(Iterable i) diff --git a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaWorkgroupService.java b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaWorkgroupService.java index f785b0a4..7bdfe725 100644 --- a/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaWorkgroupService.java +++ b/src/main/java/edu/ucdavis/dss/ipa/services/jpa/JpaWorkgroupService.java @@ -158,6 +158,6 @@ public List findAllIds() { @Override public void delete(Long workgroupId) { - workgroupRepository.delete(workgroupId); + workgroupRepository.deleteById(workgroupId); } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8c562227..2214aa2a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,19 +1,18 @@ # e.g. "jdbc:mysql://localhost:3306/IPA" spring.datasource.url=${IPA_DATASOURCE_URL} -spring.datasource.tomcat.username=${IPA_DATASOURCE_USERNAME} -spring.datasource.tomcat.password=${IPA_DATASOURCE_PASSWORD} -spring.datasource.tomcat.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.tomcat.max-active=100 -spring.datasource.tomcat.min-idle=${IPA_DATASOURCE_POOL_MIN} -spring.datasource.tomcat.validation-query=SELECT 1 -spring.datasource.tomcat.initial-size=${IPA_DATASOURCE_POOL_MIN} -spring.datasource.tomcat.suspect-timeout=60 -spring.datasource.tomcat.test-while-idle=true -spring.datasource.tomcat.test-on-borrow=true -spring.datasource.tomcat.time-between-eviction-runs-millis=30000 -spring.datasource.tomcat.min-evictable-idle-time-millis=60000 +spring.datasource.username=${IPA_DATASOURCE_USERNAME} +spring.datasource.password=${IPA_DATASOURCE_PASSWORD} +spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.hikari.maximum-pool-size=20 +spring.datasource.hikari.minimum-idle=${IPA_DATASOURCE_POOL_MIN} +spring.datasource.hikari.connection-test-query=SELECT 1 +spring.datasource.hikari.connection-timeout=30000 +spring.datasource.hikari.idle-timeout=600000 +spring.datasource.hikari.max-lifetime=1800000 spring.datasource.jmx-enabled=false +spring.flyway.table=schema_version + # e.g. "development" spring.profiles.active=${IPA_SPRING_PROFILE}