library upgrades

This commit is contained in:
Jörg Henke
2024-06-11 21:25:48 +02:00
parent c4615765a5
commit c757bb5916
12 changed files with 53 additions and 71 deletions

View File

@ -1,5 +1,5 @@
plugins {
id 'org.springframework.boot' version '3.1.3'
id 'org.springframework.boot' version '3.3.0'
id 'java'
id 'war'
}
@ -7,7 +7,7 @@ plugins {
apply plugin: 'io.spring.dependency-management'
group = 'de.jottyfan'
version = '1.5.1'
version = '1.5.2'
description = """timetrack"""
@ -25,9 +25,9 @@ repositories {
dependencies {
implementation 'de.jottyfan:timetrackjooq:20240109'
implementation 'org.apache.logging.log4j:log4j-api:latest.release'
implementation 'org.apache.logging.log4j:log4j-core:latest.release'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:latest.release'
implementation 'org.apache.logging.log4j:log4j-api:2.23.1'
implementation 'org.apache.logging.log4j:log4j-core:2.23.1'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.23.1'
implementation 'org.webjars:bootstrap:5.3.2'
implementation 'org.webjars:font-awesome:6.4.2'
@ -67,9 +67,9 @@ war {
"Implementation-Timestamp": new Date())
}
}
baseName = project.name
version = version
archiveName = 'timetrack.war'
archiveBaseName = project.name
archiveVersion = version
archiveFileName = 'timetrack.war'
}
test {

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -39,8 +39,9 @@ public class InitialConfiguration {
}
@Bean
public void disableLogo() {
public Boolean disableLogo() {
System.setProperty("org.jooq.no-logo", "true");
return true;
}
public DefaultConfiguration configuration() {

View File

@ -45,7 +45,7 @@ public class IndexController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/")
public String getIndex(@ModelAttribute DoneModel doneModel, Model model, OAuth2AuthenticationToken token) {
public String getIndex(@ModelAttribute("doneModel") DoneModel doneModel, Model model, OAuth2AuthenticationToken token) {
String username = provider.getName();
Duration maxWorkTime = Duration.ofHours(8); // TODO: to the configuration file
LocalDate day = LocalDate.now();

View File

@ -61,14 +61,13 @@ public class CalendarDoneRepository {
String billing = r.get(T_BILLING.NAME);
LocalDateTime start = r.get(T_DONE.TIME_FROM);
LocalDateTime end = r.get(T_DONE.TIME_UNTIL);
StringBuilder buf = new StringBuilder();
buf.append(billing).append(billing == null ? "" : "; ");
buf.append(job).append(job == null ? "" : " - ");
buf.append(module).append(module == null ? "" : ": ");
buf.append(project);
String title = buf.toString();
String title = String.format("%s %s %s %s", blankIfNull(billing, "; "), blankIfNull(project, " - "), blankIfNull(module, ": "), blankIfNull(job, "")).trim();
list.add(EventBean.ofEvent(id, title, start, end));
}
return list;
}
private final String blankIfNull(String s, String appendix) {
return s == null ? "" : s.concat(appendix);
}
}

View File

@ -50,7 +50,7 @@ public class ContactController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/contact/edit/{id}")
public String toItem(@PathVariable Integer id, Model model) {
public String toItem(@PathVariable("id") Integer id, Model model) {
ContactBean bean = contactService.getBean(id);
if (bean == null) {
bean = new ContactBean(); // the add case
@ -62,14 +62,14 @@ public class ContactController extends CommonController {
@RolesAllowed("timetrack_user")
@PostMapping("/contact/upsert")
public String doUpsert(Model model, @ModelAttribute ContactBean bean) {
public String doUpsert(Model model, @ModelAttribute("bean") ContactBean bean) {
Integer amount = contactService.doUpsert(bean);
return amount.equals(1) ? getList(model) : toItem(bean.getPk(), model);
}
@RolesAllowed("timetrack_user")
@GetMapping(value = "/contact/delete/{id}")
public String doDelete(@PathVariable Integer id, Model model) {
public String doDelete(@PathVariable("id") Integer id, Model model) {
Integer amount = contactService.doDelete(id);
return amount.equals(1) ? getList(model) : toItem(id, model);
}

View File

@ -84,13 +84,13 @@ public class DoneController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/done/abort/{day}")
public String abort(@PathVariable String day, Model model) {
public String abort(@PathVariable("day") String day, Model model) {
return "redirect:/done/list";
}
@RolesAllowed("timetrack_user")
@GetMapping("/done/add/{day}")
public String toAdd(@PathVariable @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate day, Model model) {
public String toAdd(@PathVariable("day") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate day, Model model) {
DoneBean bean = new DoneBean();
bean.setLocalDate(day);
return toItem(bean, model);
@ -107,7 +107,7 @@ public class DoneController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/done/edit/{id}")
public String toItem(@PathVariable Integer id, Model model) {
public String toItem(@PathVariable("id") Integer id, Model model) {
DoneBean bean = doneService.getBean(id);
if (bean == null) {
bean = new DoneBean(); // the add case; typically, only add from today
@ -117,7 +117,7 @@ public class DoneController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/done/end/{id}")
public String end(@PathVariable Integer id, Model model) {
public String end(@PathVariable("id") Integer id, Model model) {
DoneBean bean = doneService.getBean(id);
String username = provider.getName();
doneService.endToNow(bean, username);
@ -126,7 +126,7 @@ public class DoneController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/done/copy/{id}")
public String copyFromNow(@PathVariable Integer id, Model model) {
public String copyFromNow(@PathVariable("id") Integer id, Model model) {
DoneBean bean = doneService.getBean(id);
String username = provider.getName();
doneService.copyFromNow(bean, username);
@ -135,7 +135,7 @@ public class DoneController extends CommonController {
@RolesAllowed("timetrack_user")
@PostMapping("/done/upsert")
public String doUpsert(Model model, @ModelAttribute DoneBean bean) {
public String doUpsert(Model model, @ModelAttribute("bean") DoneBean bean) {
String username = provider.getName();
Integer amount = doneService.doUpsert(bean, username);
return amount.equals(1) ? "redirect:/done/list" : "redirect:/" + toItem(bean.getPk(), model);
@ -143,7 +143,7 @@ public class DoneController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/done/addrecent/{id}")
public String addRecent(Model model, @PathVariable Integer id) {
public String addRecent(Model model, @PathVariable("id") Integer id) {
String username = provider.getName();
DoneBean bean = doneService.getBean(id);
doneService.addRecent(bean, username);
@ -168,28 +168,28 @@ public class DoneController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping(value = "/done/delete/{id}")
public String doDelete(@PathVariable Integer id, Model model) {
public String doDelete(@PathVariable("id") Integer id, Model model) {
Integer amount = doneService.doDelete(id);
return amount.equals(1) ? "redirect:/done/list" : "redirect:/" + toItem(id, model);
}
@RolesAllowed("timetrack_user")
@GetMapping(value = "/done/favorize/{id}")
public String favorize(@PathVariable Integer id) {
public String favorize(@PathVariable("id") Integer id) {
doneService.favorize(id);
return "redirect:/done/list";
}
@RolesAllowed("timetrack_user")
@GetMapping(value = "/done/unfavorize/{id}")
public String unfavorize(@PathVariable Integer id) {
public String unfavorize(@PathVariable("id") Integer id) {
doneService.unfavorize(id);
return "redirect:/done/list";
}
@RolesAllowed("timetrack_user")
@GetMapping(value = "/done/usefav/{id}")
public String usefavorite(@PathVariable Integer id) {
public String usefavorite(@PathVariable("id") Integer id) {
doneService.usefavorite(id);
return "redirect:/done/list";
}

View File

@ -6,14 +6,11 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.PostMapping;
import de.jottyfan.timetrack.component.OAuth2Provider;
import de.jottyfan.timetrack.db.done.tables.records.TJobRecord;
import de.jottyfan.timetrack.modules.CommonController;
import de.jottyfan.timetrack.modules.done.DoneController;
import de.jottyfan.timetrack.modules.done.model.DoneModel;
import de.jottyfan.timetrack.modules.profile.ProfileService;
import jakarta.annotation.security.RolesAllowed;
@ -27,9 +24,6 @@ public class JobController extends CommonController {
@Autowired
private JobService jobService;
@Autowired
private DoneController doneController;
@Autowired
private OAuth2Provider provider;
@ -38,7 +32,7 @@ public class JobController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/done/edit/job/{id}")
public String toJob(@PathVariable Integer id, Model model) {
public String toJob(@PathVariable("id") Integer id, Model model) {
String username = provider.getName();
TJobRecord job = jobService.get(id);
model.addAttribute("jobBean", job);
@ -47,21 +41,21 @@ public class JobController extends CommonController {
}
@RolesAllowed("timetrack_user")
@RequestMapping(value = "/done/upsert/job", method = RequestMethod.POST)
public String doUpsert(Model model, @ModelAttribute TJobRecord bean) {
@PostMapping("/done/upsert/job")
public String doUpsert(Model model, @ModelAttribute("bean") TJobRecord bean) {
Integer amount = jobService.doUpsert(bean);
return amount.equals(1) ? "redirect:/done/list": toJob(bean.getPk(), model);
}
@RolesAllowed("timetrack_user")
@RequestMapping(value = "/done/add/job", method = RequestMethod.GET)
@GetMapping("/done/add/job")
public String toAddJob(Model model) {
return toJob(null, model);
}
@RolesAllowed("timetrack_user")
@GetMapping(value = "/done/delete/job/{id}")
public String doDeleteJob(@PathVariable Integer id, Model model) {
public String doDeleteJob(@PathVariable("id") Integer id, Model model) {
Integer amount = jobService.doDelete(id);
return amount.equals(1) ? "redirect:/done/list" : toJob(id, model);
}

View File

@ -6,14 +6,11 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.PostMapping;
import de.jottyfan.timetrack.component.OAuth2Provider;
import de.jottyfan.timetrack.db.done.tables.records.TModuleRecord;
import de.jottyfan.timetrack.modules.CommonController;
import de.jottyfan.timetrack.modules.done.DoneController;
import de.jottyfan.timetrack.modules.done.model.DoneModel;
import de.jottyfan.timetrack.modules.profile.ProfileService;
import jakarta.annotation.security.RolesAllowed;
@ -28,9 +25,6 @@ public class ModuleController extends CommonController {
@Autowired
private ModuleService moduleService;
@Autowired
private DoneController doneController;
@Autowired
private OAuth2Provider provider;
@ -39,7 +33,7 @@ public class ModuleController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/done/edit/module/{id}")
public String toModule(@PathVariable Integer id, Model model) {
public String toModule(@PathVariable("id") Integer id, Model model) {
String username = provider.getName();
TModuleRecord module = moduleService.get(id);
model.addAttribute("moduleBean", module);
@ -48,21 +42,21 @@ public class ModuleController extends CommonController {
}
@RolesAllowed("timetrack_user")
@RequestMapping(value = "/done/upsert/module", method = RequestMethod.POST)
public String doUpsert(Model model, @ModelAttribute TModuleRecord bean) {
@PostMapping("/done/upsert/module")
public String doUpsert(Model model, @ModelAttribute("bean") TModuleRecord bean) {
Integer amount = moduleService.doUpsert(bean);
return amount.equals(1) ? "redirect:/done/list" : toModule(bean.getPk(), model);
}
@RolesAllowed("timetrack_user")
@RequestMapping(value = "/done/add/module", method = RequestMethod.GET)
@GetMapping("/done/add/module")
public String toAddModule(Model model) {
return toModule(null, model);
}
@RolesAllowed("timetrack_user")
@GetMapping(value = "/done/delete/module/{id}")
public String doDeleteModule(@PathVariable Integer id, Model model) {
public String doDeleteModule(@PathVariable("id") Integer id, Model model) {
Integer amount = moduleService.doDelete(id);
return amount.equals(1) ? "redirect:/done/list" : toModule(id, model);
}

View File

@ -6,14 +6,11 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.PostMapping;
import de.jottyfan.timetrack.component.OAuth2Provider;
import de.jottyfan.timetrack.db.done.tables.records.TProjectRecord;
import de.jottyfan.timetrack.modules.CommonController;
import de.jottyfan.timetrack.modules.done.DoneController;
import de.jottyfan.timetrack.modules.done.model.DoneModel;
import de.jottyfan.timetrack.modules.profile.ProfileService;
import jakarta.annotation.security.RolesAllowed;
@ -27,9 +24,6 @@ public class ProjectController extends CommonController {
@Autowired
private ProjectService projectService;
@Autowired
private DoneController doneController;
@Autowired
private OAuth2Provider provider;
@ -38,7 +32,7 @@ public class ProjectController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/done/edit/project/{id}")
public String toProject(@PathVariable Integer id, Model model) {
public String toProject(@PathVariable("id") Integer id, Model model) {
String username = provider.getName();
TProjectRecord project = projectService.get(id);
model.addAttribute("projectBean", project);
@ -47,21 +41,21 @@ public class ProjectController extends CommonController {
}
@RolesAllowed("timetrack_user")
@RequestMapping(value = "/done/upsert/project", method = RequestMethod.POST)
public String doUpsert(Model model, @ModelAttribute TProjectRecord bean) {
@PostMapping("/done/upsert/project")
public String doUpsert(Model model, @ModelAttribute("bean") TProjectRecord bean) {
Integer amount = projectService.doUpsert(bean);
return amount.equals(1) ? "redirect:/done/list" : toProject(bean.getPk(), model);
}
@RolesAllowed("timetrack_user")
@RequestMapping(value = "/done/add/project", method = RequestMethod.GET)
@GetMapping("/done/add/project")
public String toAddProject(Model model) {
return toProject(null, model);
}
@RolesAllowed("timetrack_user")
@GetMapping(value = "/done/delete/project/{id}")
public String doDeleteProject(@PathVariable Integer id, Model model) {
public String doDeleteProject(@PathVariable("id") Integer id, Model model) {
Integer amount = projectService.doDelete(id);
return amount.equals(1) ? "redirect:/done/list" : toProject(id, model);
}

View File

@ -44,7 +44,7 @@ public class NoteController extends CommonController {
@RolesAllowed("timetrack_user")
@GetMapping("/note/edit/{id}")
public String toItem(@PathVariable Integer id, Model model) {
public String toItem(@PathVariable("id") Integer id, Model model) {
NoteBean bean = noteService.getBean(id);
if (bean == null) {
bean = new NoteBean(); // the add case
@ -57,14 +57,14 @@ public class NoteController extends CommonController {
@RolesAllowed("timetrack_user")
@PostMapping("/note/upsert")
public String doUpsert(Model model, @ModelAttribute NoteBean bean, OAuth2AuthenticationToken token) {
public String doUpsert(Model model, @ModelAttribute("bean") NoteBean bean, OAuth2AuthenticationToken token) {
Integer amount = noteService.doUpsert(bean);
return amount.equals(1) ? getList(model) : toItem(bean.getPk(), model);
}
@RolesAllowed("timetrack_user")
@GetMapping(value = "/note/delete/{id}")
public String doDelete(@PathVariable Integer id, Model model, OAuth2AuthenticationToken token) {
public String doDelete(@PathVariable("id") Integer id, Model model, OAuth2AuthenticationToken token) {
Integer amount = noteService.doDelete(id);
return amount.equals(1) ? getList(model) : toItem(id, model);
}

View File

@ -22,7 +22,7 @@ public class ProfileController extends CommonController {
private ProfileService service;
@PostMapping("/profile/{theme}")
public String setTheme(@PathVariable String theme) {
public String setTheme(@PathVariable("theme") String theme) {
String username = provider.getName();
service.setTheme(username, theme);
return "redirect:/";