├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── src ├── main │ ├── resources │ │ ├── static │ │ │ ├── assets │ │ │ │ └── favicon.ico │ │ │ └── js │ │ │ │ └── scripts.js │ │ ├── application.properties │ │ └── templates │ │ │ ├── events-list.html │ │ │ ├── clubs-list.html │ │ │ ├── clubs-create.html │ │ │ ├── login.html │ │ │ ├── clubs-edit.html │ │ │ ├── events-detail.html │ │ │ ├── events-create.html │ │ │ ├── register.html │ │ │ ├── layout.html │ │ │ ├── events-edit.html │ │ │ └── clubs-detail.html │ └── java │ │ └── com │ │ └── rungroop │ │ └── web │ │ ├── repository │ │ ├── EventRepository.java │ │ ├── RoleRepository.java │ │ ├── UserRepository.java │ │ └── ClubRepository.java │ │ ├── service │ │ ├── UserService.java │ │ ├── EventService.java │ │ ├── ClubService.java │ │ └── impl │ │ │ ├── UserServiceImpl.java │ │ │ ├── EventServiceImpl.java │ │ │ └── ClubServiceImpl.java │ │ ├── WebApplication.java │ │ ├── dto │ │ ├── RegistrationDto.java │ │ ├── EventDto.java │ │ └── ClubDto.java │ │ ├── models │ │ ├── Role.java │ │ ├── Event.java │ │ ├── UserEntity.java │ │ └── Club.java │ │ ├── security │ │ ├── SecurityUtil.java │ │ ├── CustomUserDetailsService.java │ │ └── SecurityConfig.java │ │ ├── mapper │ │ ├── EventMapper.java │ │ └── ClubMapper.java │ │ └── controller │ │ ├── AuthController.java │ │ ├── ClubController.java │ │ └── EventController.java └── test │ └── java │ └── com │ └── rungroop │ └── web │ └── WebApplicationTests.java ├── .gitignore ├── pom.xml ├── mvnw.cmd └── mvnw /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddysmithdev/RunGroop-Java/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/static/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teddysmithdev/RunGroop-Java/HEAD/src/main/resources/static/assets/favicon.ico -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/repository/EventRepository.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.repository; 2 | 3 | import com.rungroop.web.models.Event; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface EventRepository extends JpaRepository { 7 | } 8 | -------------------------------------------------------------------------------- /src/test/java/com/rungroop/web/WebApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class WebApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/repository/RoleRepository.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.repository; 2 | 3 | import com.rungroop.web.models.Role; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface RoleRepository extends JpaRepository { 7 | Role findByName(String name); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:postgresql://localhost:5432/rungroopcourse 2 | spring.datasource.username=postgres 3 | spring.datasource.password=test 4 | spring.datasource.driver-class-name=org.postgresql.Driver 5 | spring.jpa.hibernate.ddl-auto=update 6 | spring.security.user.name=test 7 | spring.security.user.password=test 8 | spring.jpa.show-sql=true 9 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.service; 2 | 3 | import com.rungroop.web.dto.RegistrationDto; 4 | import com.rungroop.web.models.UserEntity; 5 | 6 | public interface UserService { 7 | void saveUser(RegistrationDto registrationDto); 8 | UserEntity findByEmail(String email); 9 | UserEntity findByUsername(String username); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/static/js/scripts.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - Modern Business v5.0.6 (https://startbootstrap.com/template-overviews/modern-business) 3 | * Copyright 2013-2022 Start Bootstrap 4 | * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-modern-business/blob/master/LICENSE) 5 | */ 6 | // This file is intentionally blank 7 | // Use this file to add JavaScript to your project -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/WebApplication.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class WebApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(WebApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/dto/RegistrationDto.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.dto; 2 | 3 | import lombok.Data; 4 | 5 | import javax.validation.constraints.NotEmpty; 6 | 7 | @Data 8 | public class RegistrationDto { 9 | private Long id; 10 | @NotEmpty 11 | private String username; 12 | @NotEmpty 13 | private String email; 14 | @NotEmpty 15 | private String password; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/service/EventService.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.service; 2 | 3 | import com.rungroop.web.dto.EventDto; 4 | 5 | import java.util.List; 6 | 7 | public interface EventService { 8 | void createEvent(Long clubId, EventDto eventDto); 9 | List findAllEvents(); 10 | EventDto findByEventId(Long eventId); 11 | void updateEvent(EventDto eventDto); 12 | void deleteEvent(long eventId); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.repository; 2 | 3 | import com.rungroop.web.models.UserEntity; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface UserRepository extends JpaRepository { 7 | UserEntity findByEmail(String email); 8 | UserEntity findByUsername(String userName); 9 | UserEntity findFirstByUsername(String username); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/service/ClubService.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.service; 2 | 3 | import com.rungroop.web.dto.ClubDto; 4 | import com.rungroop.web.models.Club; 5 | 6 | import java.util.List; 7 | 8 | public interface ClubService { 9 | List findAllClubs(); 10 | Club saveClub(ClubDto clubDto); 11 | ClubDto findClubById(Long clubId); 12 | void updateClub(ClubDto club); 13 | void delete(Long clubId); 14 | List searchClubs(String query); 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/repository/ClubRepository.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.repository; 2 | 3 | import com.rungroop.web.models.Club; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.Query; 6 | 7 | import java.util.List; 8 | import java.util.Optional; 9 | 10 | public interface ClubRepository extends JpaRepository { 11 | Optional findByTitle(String url); 12 | @Query("SELECT c from Club c WHERE c.title LIKE CONCAT('%', :query, '%')") 13 | List searchClubs(String query); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/models/Role.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.models; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | 8 | import javax.persistence.*; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | @Getter 13 | @Setter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @Entity(name = "roles") 17 | public class Role { 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.IDENTITY) 20 | private Long id; 21 | private String name; 22 | @ManyToMany(mappedBy = "roles") 23 | private List users = new ArrayList<>(); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/dto/EventDto.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.dto; 2 | 3 | import com.rungroop.web.models.Club; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import org.hibernate.annotations.CreationTimestamp; 9 | import org.hibernate.annotations.UpdateTimestamp; 10 | import org.springframework.format.annotation.DateTimeFormat; 11 | 12 | import java.time.LocalDateTime; 13 | 14 | @Data 15 | @Builder 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | public class EventDto { 19 | private Long id; 20 | private String name; 21 | @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm") 22 | private LocalDateTime startTime; 23 | @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm") 24 | private LocalDateTime endTime; 25 | private String type; 26 | private String photoUrl; 27 | private LocalDateTime createdOn; 28 | private LocalDateTime updatedOn; 29 | private Club club; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/models/Event.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.models; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.CreationTimestamp; 8 | import org.hibernate.annotations.UpdateTimestamp; 9 | 10 | import javax.persistence.*; 11 | import java.time.LocalDateTime; 12 | 13 | @Data 14 | @Builder 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @Entity 18 | public class Event { 19 | @Id 20 | @GeneratedValue(strategy = GenerationType.IDENTITY) 21 | private Long id; 22 | private String name; 23 | private LocalDateTime startTime; 24 | private LocalDateTime endTime; 25 | private String type; 26 | private String photoUrl; 27 | @CreationTimestamp 28 | private LocalDateTime createdOn; 29 | @UpdateTimestamp 30 | private LocalDateTime updatedOn; 31 | 32 | @ManyToOne 33 | @JoinColumn(name="club_id", nullable = false) 34 | private Club club; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/models/UserEntity.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.models; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | 8 | import javax.persistence.*; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | @Getter 13 | @Setter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @Entity(name = "users") 17 | public class UserEntity { 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.IDENTITY) 20 | private Long id; 21 | private String username; 22 | private String email; 23 | private String password; 24 | @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) 25 | @JoinTable( 26 | name = "users_roles", 27 | joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")}, 28 | inverseJoinColumns = {@JoinColumn(name = "role_id", referencedColumnName = "id")} 29 | ) 30 | private List roles = new ArrayList<>(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/dto/ClubDto.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.dto; 2 | 3 | import com.rungroop.web.models.UserEntity; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import org.hibernate.annotations.CreationTimestamp; 7 | import org.hibernate.annotations.UpdateTimestamp; 8 | 9 | import javax.persistence.GeneratedValue; 10 | import javax.persistence.GenerationType; 11 | import javax.persistence.Id; 12 | import javax.validation.constraints.NotEmpty; 13 | import java.time.LocalDateTime; 14 | import java.util.List; 15 | 16 | @Data 17 | @Builder 18 | public class ClubDto { 19 | private Long id; 20 | @NotEmpty(message = "Club title should not be empty") 21 | private String title; 22 | @NotEmpty(message = "Photo link should not be empty") 23 | private String photoUrl; 24 | @NotEmpty(message = "Content should not be empty") 25 | private String content; 26 | private UserEntity createdBy; 27 | private LocalDateTime createdOn; 28 | private LocalDateTime updatedOn; 29 | private List events; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/security/SecurityUtil.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.security; 2 | 3 | import com.rungroop.web.models.UserEntity; 4 | import org.springframework.security.authentication.AnonymousAuthenticationToken; 5 | import org.springframework.security.core.Authentication; 6 | import org.springframework.security.core.context.SecurityContext; 7 | import org.springframework.security.core.context.SecurityContextHolder; 8 | import org.springframework.security.core.context.SecurityContextImpl; 9 | import org.springframework.security.core.userdetails.User; 10 | import org.springframework.security.core.userdetails.UserDetails; 11 | 12 | public class SecurityUtil { 13 | public static String getSessionUser() { 14 | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); 15 | if (!(authentication instanceof AnonymousAuthenticationToken)) { 16 | String currentUserName = authentication.getName(); 17 | return currentUserName; 18 | } 19 | return null; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/models/Club.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.models; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.CreationTimestamp; 8 | import org.hibernate.annotations.UpdateTimestamp; 9 | 10 | import javax.persistence.*; 11 | import java.time.LocalDateTime; 12 | import java.util.ArrayList; 13 | import java.util.HashSet; 14 | import java.util.List; 15 | import java.util.Set; 16 | 17 | @Data 18 | @NoArgsConstructor 19 | @AllArgsConstructor 20 | @Builder 21 | @Entity 22 | @Table(name = "clubs") 23 | public class Club { 24 | @Id 25 | @GeneratedValue(strategy = GenerationType.IDENTITY) 26 | private Long id; 27 | private String title; 28 | private String photoUrl; 29 | private String content; 30 | 31 | @CreationTimestamp 32 | private LocalDateTime createdOn; 33 | 34 | @UpdateTimestamp 35 | private LocalDateTime updatedOn; 36 | 37 | @ManyToOne 38 | @JoinColumn(name = "created_by", nullable = false) 39 | private UserEntity createdBy; 40 | 41 | @OneToMany(mappedBy = "club", cascade = CascadeType.REMOVE) 42 | private List events = new ArrayList<>(); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/mapper/EventMapper.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.mapper; 2 | 3 | import com.rungroop.web.dto.EventDto; 4 | import com.rungroop.web.models.Event; 5 | 6 | public class EventMapper { 7 | public static Event mapToEvent(EventDto eventDto) { 8 | return Event.builder() 9 | .id(eventDto.getId()) 10 | .name(eventDto.getName()) 11 | .startTime(eventDto.getStartTime()) 12 | .endTime(eventDto.getEndTime()) 13 | .type(eventDto.getType()) 14 | .photoUrl(eventDto.getPhotoUrl()) 15 | .createdOn(eventDto.getCreatedOn()) 16 | .updatedOn(eventDto.getUpdatedOn()) 17 | .club(eventDto.getClub()) 18 | .build(); 19 | } 20 | 21 | public static EventDto mapToEventDto(Event event) { 22 | return EventDto.builder() 23 | .id(event.getId()) 24 | .name(event.getName()) 25 | .startTime(event.getStartTime()) 26 | .endTime(event.getEndTime()) 27 | .type(event.getType()) 28 | .photoUrl(event.getPhotoUrl()) 29 | .createdOn(event.getCreatedOn()) 30 | .updatedOn(event.getUpdatedOn()) 31 | .club(event.getClub()) 32 | .build(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/templates/events-list.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Event List 7 | 8 | 9 |
10 |
11 |
12 |
13 |

Find Running Events

14 |

Find running events near you

15 |
16 |
17 |
18 |
19 | ... 20 | 21 |
22 | View 23 |
24 | Edit 25 |
26 |
27 |
28 |
29 |
30 |
31 | 32 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/mapper/ClubMapper.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.mapper; 2 | 3 | import com.rungroop.web.dto.ClubDto; 4 | import com.rungroop.web.models.Club; 5 | 6 | import java.util.stream.Collectors; 7 | 8 | import static com.rungroop.web.mapper.EventMapper.mapToEventDto; 9 | 10 | public class ClubMapper { 11 | public static Club mapToClub(ClubDto club) { 12 | Club clubDto = Club.builder() 13 | .id(club.getId()) 14 | .title(club.getTitle()) 15 | .photoUrl(club.getPhotoUrl()) 16 | .content(club.getContent()) 17 | .createdBy(club.getCreatedBy()) 18 | .createdOn(club.getCreatedOn()) 19 | .updatedOn(club.getUpdatedOn()) 20 | .build(); 21 | return clubDto; 22 | } 23 | 24 | public static ClubDto mapToClubDto(Club club) { 25 | ClubDto clubDto = ClubDto.builder() 26 | .id(club.getId()) 27 | .title(club.getTitle()) 28 | .photoUrl(club.getPhotoUrl()) 29 | .content(club.getContent()) 30 | .createdBy(club.getCreatedBy()) 31 | .createdOn(club.getCreatedOn()) 32 | .updatedOn(club.getUpdatedOn()) 33 | .events(club.getEvents().stream().map((event) -> mapToEventDto(event)).collect(Collectors.toList())) 34 | .build(); 35 | return clubDto; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/security/CustomUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.security; 2 | 3 | import com.rungroop.web.models.UserEntity; 4 | import com.rungroop.web.repository.UserRepository; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 7 | import org.springframework.security.core.userdetails.User; 8 | import org.springframework.security.core.userdetails.UserDetails; 9 | import org.springframework.security.core.userdetails.UserDetailsService; 10 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.stream.Collectors; 14 | 15 | @Service 16 | public class CustomUserDetailsService implements UserDetailsService { 17 | private UserRepository userRepository; 18 | 19 | @Autowired 20 | public CustomUserDetailsService(UserRepository userRepository) { 21 | this.userRepository = userRepository; 22 | } 23 | 24 | @Override 25 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 26 | UserEntity user = userRepository.findFirstByUsername(username); 27 | if(user != null) { 28 | User authUser = new User( 29 | user.getEmail(), 30 | user.getPassword(), 31 | user.getRoles().stream().map((role) -> new SimpleGrantedAuthority(role.getName())) 32 | .collect(Collectors.toList()) 33 | ); 34 | return authUser; 35 | } else { 36 | throw new UsernameNotFoundException("Invalid username or password"); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.service.impl; 2 | 3 | import com.rungroop.web.dto.RegistrationDto; 4 | import com.rungroop.web.models.Role; 5 | import com.rungroop.web.models.UserEntity; 6 | import com.rungroop.web.repository.RoleRepository; 7 | import com.rungroop.web.repository.UserRepository; 8 | import com.rungroop.web.service.UserService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.security.crypto.password.PasswordEncoder; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.Arrays; 14 | 15 | @Service 16 | public class UserServiceImpl implements UserService { 17 | private UserRepository userRepository; 18 | private RoleRepository roleRepository; 19 | private PasswordEncoder passwordEncoder; 20 | 21 | @Autowired 22 | public UserServiceImpl(UserRepository userRepository, RoleRepository roleRepository, PasswordEncoder passwordEncoder) { 23 | this.userRepository = userRepository; 24 | this.roleRepository = roleRepository; 25 | this.passwordEncoder = passwordEncoder; 26 | } 27 | 28 | @Override 29 | public void saveUser(RegistrationDto registrationDto) { 30 | UserEntity user = new UserEntity(); 31 | user.setUsername(registrationDto.getUsername()); 32 | user.setEmail(registrationDto.getEmail()); 33 | user.setPassword(passwordEncoder.encode(registrationDto.getPassword())); 34 | Role role = roleRepository.findByName("USER"); 35 | user.setRoles(Arrays.asList(role)); 36 | userRepository.save(user); 37 | } 38 | 39 | @Override 40 | public UserEntity findByEmail(String email) { 41 | return userRepository.findByEmail(email); 42 | } 43 | 44 | @Override 45 | public UserEntity findByUsername(String username) { 46 | return userRepository.findByUsername(username); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/resources/templates/clubs-list.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Club List 7 | 8 | 9 |
10 |
11 |
12 |
13 | You are registered successfully! 14 |
15 |
16 |

Find Running Clubs

17 |

Groups of passionate near you

18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 |
26 |
27 | ... 28 | Project name 29 |
30 | View 31 |
32 | Edit 33 |
34 |
35 |
36 |
37 |
38 |
39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/templates/clubs-create.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Club Create 7 | 8 | 9 |
10 |
11 |
12 |
13 |
14 |
15 | 16 | 23 |

24 |
25 |
26 | 27 | 34 |

35 |
36 |
37 |
38 | 39 | 46 |

47 |
48 | 49 |
50 |
51 |
52 |
53 | 54 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/controller/AuthController.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.controller; 2 | 3 | import com.rungroop.web.dto.RegistrationDto; 4 | import com.rungroop.web.models.UserEntity; 5 | import com.rungroop.web.service.UserService; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.ui.Model; 8 | import org.springframework.validation.BindingResult; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.ModelAttribute; 11 | import org.springframework.web.bind.annotation.PostMapping; 12 | 13 | import javax.validation.Valid; 14 | 15 | @Controller 16 | public class AuthController { 17 | private UserService userService; 18 | 19 | public AuthController(UserService userService) { 20 | this.userService = userService; 21 | } 22 | 23 | @GetMapping("/login") 24 | public String loginPage(){ 25 | return "login"; 26 | } 27 | 28 | @GetMapping("/register") 29 | public String getRegisterForm(Model model) { 30 | RegistrationDto user = new RegistrationDto(); 31 | model.addAttribute("user", user); 32 | return "register"; 33 | } 34 | 35 | @PostMapping("/register/save") 36 | public String register(@Valid @ModelAttribute("user")RegistrationDto user, 37 | BindingResult result, Model model) { 38 | UserEntity existingUserEmail = userService.findByEmail(user.getEmail()); 39 | if(existingUserEmail != null && existingUserEmail.getEmail() != null && !existingUserEmail.getEmail().isEmpty()) { 40 | return "redirect:/register?fail"; 41 | } 42 | UserEntity existingUserUsername = userService.findByUsername(user.getUsername()); 43 | if(existingUserUsername != null && existingUserUsername.getUsername() != null && !existingUserUsername.getUsername().isEmpty()) { 44 | return "redirect:/register?fail"; 45 | } 46 | if(result.hasErrors()) { 47 | model.addAttribute("user", user); 48 | return "register"; 49 | } 50 | userService.saveUser(user); 51 | return "redirect:/clubs?success"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Register 7 | 8 |
9 | 36 |
37 |
38 |
39 | Invalid username and password. 40 |
41 |
42 | You have been logged out.
43 | 67 |
68 |
69 |
70 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/service/impl/EventServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.service.impl; 2 | 3 | import com.rungroop.web.dto.EventDto; 4 | import com.rungroop.web.models.Club; 5 | import com.rungroop.web.models.Event; 6 | import com.rungroop.web.repository.ClubRepository; 7 | import com.rungroop.web.repository.EventRepository; 8 | import com.rungroop.web.service.EventService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | import java.util.stream.Collectors; 14 | 15 | import static com.rungroop.web.mapper.ClubMapper.mapToClub; 16 | import static com.rungroop.web.mapper.EventMapper.mapToEvent; 17 | import static com.rungroop.web.mapper.EventMapper.mapToEventDto; 18 | 19 | @Service 20 | public class EventServiceImpl implements EventService { 21 | private EventRepository eventRepository; 22 | private ClubRepository clubRepository; 23 | 24 | @Autowired 25 | public EventServiceImpl(EventRepository eventRepository, ClubRepository clubRepository) { 26 | this.eventRepository = eventRepository; 27 | this.clubRepository = clubRepository; 28 | } 29 | 30 | @Override 31 | public void createEvent(Long clubId, EventDto eventDto) { 32 | Club club = clubRepository.findById(clubId).get(); 33 | Event event = mapToEvent(eventDto); 34 | event.setClub(club); 35 | eventRepository.save(event); 36 | } 37 | 38 | @Override 39 | public List findAllEvents() { 40 | List events = eventRepository.findAll(); 41 | return events.stream().map(event -> mapToEventDto(event)).collect(Collectors.toList()); 42 | } 43 | 44 | @Override 45 | public EventDto findByEventId(Long eventId) { 46 | Event event = eventRepository.findById(eventId).get(); 47 | return mapToEventDto(event); 48 | } 49 | 50 | @Override 51 | public void updateEvent(EventDto eventDto) { 52 | Event event = mapToEvent(eventDto); 53 | eventRepository.save(event); 54 | } 55 | 56 | @Override 57 | public void deleteEvent(long eventId) { 58 | eventRepository.deleteById(eventId); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/templates/clubs-edit.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Club Edit 7 | 8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 |
16 | 17 | 24 |

25 |
26 |
27 | 28 | 35 |

36 |
37 |
38 |
39 | 40 | 47 |

48 |
49 | 50 |
51 |
52 |
53 |
54 | 55 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/security/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.security; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 7 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 8 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 9 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 10 | import org.springframework.security.crypto.password.PasswordEncoder; 11 | import org.springframework.security.web.SecurityFilterChain; 12 | import org.springframework.security.web.util.matcher.AntPathRequestMatcher; 13 | 14 | @Configuration 15 | @EnableWebSecurity 16 | public class SecurityConfig { 17 | private CustomUserDetailsService userDetailsService; 18 | 19 | @Autowired 20 | public SecurityConfig(CustomUserDetailsService userDetailsService) { 21 | this.userDetailsService = userDetailsService; 22 | } 23 | 24 | @Bean 25 | public static PasswordEncoder passwordEncoder() { 26 | return new BCryptPasswordEncoder(); 27 | } 28 | 29 | @Bean 30 | public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{ 31 | http.csrf().disable() 32 | .authorizeRequests() 33 | .antMatchers("/login", "/register", "/clubs", "/css/**", "/js/**") 34 | .permitAll() 35 | .and() 36 | .formLogin(form -> form 37 | .loginPage("/login") 38 | .defaultSuccessUrl("/clubs") 39 | .loginProcessingUrl("/login") 40 | .failureUrl("/login?error=true") 41 | .permitAll() 42 | ).logout( 43 | logout -> logout 44 | .logoutRequestMatcher(new AntPathRequestMatcher("/logout")).permitAll() 45 | ); 46 | 47 | return http.build(); 48 | } 49 | public void configure(AuthenticationManagerBuilder builder) throws Exception { 50 | builder.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/service/impl/ClubServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.service.impl; 2 | 3 | import com.rungroop.web.dto.ClubDto; 4 | import com.rungroop.web.models.Club; 5 | import com.rungroop.web.models.UserEntity; 6 | import com.rungroop.web.repository.ClubRepository; 7 | import com.rungroop.web.repository.UserRepository; 8 | import com.rungroop.web.security.SecurityUtil; 9 | import com.rungroop.web.service.ClubService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.security.core.userdetails.User; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.List; 15 | import java.util.stream.Collectors; 16 | 17 | import static com.rungroop.web.mapper.ClubMapper.mapToClub; 18 | import static com.rungroop.web.mapper.ClubMapper.mapToClubDto; 19 | 20 | @Service 21 | public class ClubServiceImpl implements ClubService { 22 | private ClubRepository clubRepository; 23 | private UserRepository userRepository; 24 | 25 | @Autowired 26 | public ClubServiceImpl(ClubRepository clubRepository, UserRepository userRepository) { 27 | this.userRepository = userRepository; 28 | this.clubRepository = clubRepository; 29 | } 30 | 31 | @Override 32 | public List findAllClubs() { 33 | List clubs = clubRepository.findAll(); 34 | return clubs.stream().map((club) -> mapToClubDto(club)).collect(Collectors.toList()); 35 | } 36 | 37 | @Override 38 | public Club saveClub(ClubDto clubDto) { 39 | String username = SecurityUtil.getSessionUser(); 40 | UserEntity user = userRepository.findByUsername(username); 41 | Club club = mapToClub(clubDto); 42 | club.setCreatedBy(user); 43 | return clubRepository.save(club); 44 | } 45 | 46 | @Override 47 | public ClubDto findClubById(Long clubId) { 48 | Club club = clubRepository.findById(clubId).get(); 49 | return mapToClubDto(club); 50 | } 51 | 52 | @Override 53 | public void updateClub(ClubDto clubDto) { 54 | String username = SecurityUtil.getSessionUser(); 55 | UserEntity user = userRepository.findByUsername(username); 56 | Club club = mapToClub(clubDto); 57 | club.setCreatedBy(user); 58 | clubRepository.save(club); 59 | } 60 | 61 | @Override 62 | public void delete(Long clubId) { 63 | clubRepository.deleteById(clubId); 64 | } 65 | 66 | @Override 67 | public List searchClubs(String query) { 68 | List clubs = clubRepository.searchClubs(query); 69 | return clubs.stream().map(club -> mapToClubDto(club)).collect(Collectors.toList()); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/resources/templates/events-detail.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Club Create 7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 |

15 |

Charlotte, NC

16 |
17 |
18 |
19 | 20 |
21 |
22 | 23 |
24 | 25 |
26 | ... 27 |
28 |
29 |

About this running event

30 |

31 |
32 | Delete 33 |
34 |
35 |
36 | 37 |
38 | 39 |
40 |
Search
41 |
42 |
43 | 44 | 45 |
46 |
47 |
48 | 49 |
50 |
Categories
51 |
52 |
53 |
54 | 59 |
60 |
61 |
62 |
63 | 64 |
65 |
Side Widget
66 |
You can put anything you want inside of these side widgets. They are easy to use, and feature the Bootstrap 5 card component!
67 |
68 |
69 |
70 |
71 |
72 | 73 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.7.5 9 | 10 | 11 | com.rungroop 12 | web 13 | 0.0.1-SNAPSHOT 14 | web 15 | Running Application For 2022 16 | 17 | 17 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-thymeleaf 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-web 31 | 32 | 33 | nz.net.ultraq.thymeleaf 34 | thymeleaf-layout-dialect 35 | 36 | 37 | org.springframework.boot 38 | spring-boot-devtools 39 | runtime 40 | true 41 | 42 | 43 | org.postgresql 44 | postgresql 45 | runtime 46 | 47 | 48 | org.projectlombok 49 | lombok 50 | true 51 | 52 | 53 | org.springframework.boot 54 | spring-boot-starter-test 55 | test 56 | 57 | 58 | org.springframework.boot 59 | spring-boot-starter-validation 60 | 61 | 62 | org.springframework.boot 63 | spring-boot-starter-security 64 | 65 | 66 | org.thymeleaf.extras 67 | thymeleaf-extras-springsecurity5 68 | 69 | 70 | 71 | 72 | 73 | 74 | org.springframework.boot 75 | spring-boot-maven-plugin 76 | 77 | 78 | 79 | org.projectlombok 80 | lombok 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/main/resources/templates/events-create.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Events Create 7 | 8 | 9 |
10 |
11 |
12 |
13 |
14 |
15 | 16 | 23 |

24 |
25 |
26 | 27 | 34 |

35 |
36 |
37 |
38 | 39 | 46 |

47 |
48 |
49 | 50 | 57 |

58 |
59 |
60 | 61 | 68 |

69 |
70 | 71 |
72 |
73 |
74 |
75 | 76 | -------------------------------------------------------------------------------- /src/main/resources/templates/register.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Register 7 | 8 |
9 | 36 |
37 |
38 |
39 | Username or email already exists
40 | 73 |
74 |
75 |
76 | -------------------------------------------------------------------------------- /src/main/resources/templates/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | RunGroop 17 | 18 | 40 | 41 |
42 |
43 |

Let's build run together

44 | Contact us 45 |
46 |
47 | 48 | 49 |
50 |
51 |
52 |
Copyright © Your RunGroop 2022
53 |
54 | Privacy 55 | · 56 | Terms 57 | · 58 | Contact 59 |
60 |
61 |
62 |
63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/main/resources/templates/events-edit.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Events Edit 7 | 8 | 9 |
10 |
11 |
12 |
13 |
14 |
15 | 16 | 23 |

24 |
25 |
26 | 27 | 34 |

35 |
36 |
37 |
38 | 39 | 46 |

47 |
48 |
49 | 50 | 57 |

58 |
59 |
60 | 61 | 68 |

69 |
70 | 71 |
72 |
73 |
74 |
75 | 76 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/controller/ClubController.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.controller; 2 | 3 | import com.rungroop.web.dto.ClubDto; 4 | import com.rungroop.web.models.Club; 5 | import com.rungroop.web.models.UserEntity; 6 | import com.rungroop.web.security.SecurityUtil; 7 | import com.rungroop.web.service.ClubService; 8 | import com.rungroop.web.service.UserService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.validation.BindingResult; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import javax.validation.Valid; 16 | import java.util.List; 17 | 18 | @Controller 19 | public class ClubController { 20 | private ClubService clubService; 21 | private UserService userService; 22 | 23 | @Autowired 24 | public ClubController(ClubService clubService, UserService userService) { 25 | this.userService = userService; 26 | this.clubService = clubService; 27 | } 28 | 29 | @GetMapping("/clubs") 30 | public String listClubs(Model model) { 31 | UserEntity user = new UserEntity(); 32 | List clubs = clubService.findAllClubs(); 33 | String username = SecurityUtil.getSessionUser(); 34 | if(username != null) { 35 | user = userService.findByUsername(username); 36 | model.addAttribute("user", user); 37 | } 38 | model.addAttribute("user", user); 39 | model.addAttribute("clubs", clubs); 40 | return "clubs-list"; 41 | } 42 | 43 | @GetMapping("/clubs/{clubId}") 44 | public String clubDetail(@PathVariable("clubId") long clubId, Model model) { 45 | UserEntity user = new UserEntity(); 46 | ClubDto clubDto = clubService.findClubById(clubId); 47 | String username = SecurityUtil.getSessionUser(); 48 | if(username != null) { 49 | user = userService.findByUsername(username); 50 | model.addAttribute("user", user); 51 | } 52 | model.addAttribute("user", user); 53 | model.addAttribute("club", clubDto); 54 | return "clubs-detail"; 55 | } 56 | 57 | @GetMapping("/clubs/new") 58 | public String createClubForm(Model model) { 59 | Club club = new Club(); 60 | model.addAttribute("club", club); 61 | return "clubs-create"; 62 | } 63 | 64 | @GetMapping("/clubs/{clubId}/delete") 65 | public String deleteClub(@PathVariable("clubId")Long clubId) { 66 | clubService.delete(clubId); 67 | return "redirect:/clubs"; 68 | } 69 | 70 | @GetMapping("/clubs/search") 71 | public String searchClub(@RequestParam(value = "query") String query, Model model) { 72 | List clubs = clubService.searchClubs(query); 73 | model.addAttribute("clubs", clubs); 74 | return "clubs-list"; 75 | } 76 | 77 | @PostMapping("/clubs/new") 78 | public String saveClub(@Valid @ModelAttribute("club") ClubDto clubDto, BindingResult result, Model model) { 79 | if(result.hasErrors()) { 80 | model.addAttribute("club", clubDto); 81 | return "clubs-create"; 82 | } 83 | clubService.saveClub(clubDto); 84 | return "redirect:/clubs"; 85 | } 86 | 87 | @GetMapping("/clubs/{clubId}/edit") 88 | public String editClubForm(@PathVariable("clubId") Long clubId, Model model) { 89 | ClubDto club = clubService.findClubById(clubId); 90 | model.addAttribute("club", club); 91 | return "clubs-edit"; 92 | } 93 | @PostMapping("/clubs/{clubId}/edit") 94 | public String updateClub(@PathVariable("clubId") Long clubId, 95 | @Valid @ModelAttribute("club") ClubDto club, 96 | BindingResult result, Model model) { 97 | if(result.hasErrors()) { 98 | model.addAttribute("club", club); 99 | return "clubs-edit"; 100 | } 101 | club.setId(clubId); 102 | clubService.updateClub(club); 103 | return "redirect:/clubs"; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/rungroop/web/controller/EventController.java: -------------------------------------------------------------------------------- 1 | package com.rungroop.web.controller; 2 | 3 | import com.rungroop.web.dto.ClubDto; 4 | import com.rungroop.web.dto.EventDto; 5 | import com.rungroop.web.models.Event; 6 | import com.rungroop.web.models.UserEntity; 7 | import com.rungroop.web.security.SecurityUtil; 8 | import com.rungroop.web.service.ClubService; 9 | import com.rungroop.web.service.EventService; 10 | import com.rungroop.web.service.UserService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.ui.Model; 14 | import org.springframework.validation.BindingResult; 15 | import org.springframework.web.bind.annotation.GetMapping; 16 | import org.springframework.web.bind.annotation.ModelAttribute; 17 | import org.springframework.web.bind.annotation.PathVariable; 18 | import org.springframework.web.bind.annotation.PostMapping; 19 | 20 | import javax.validation.Valid; 21 | import java.util.List; 22 | 23 | @Controller 24 | public class EventController { 25 | 26 | private EventService eventService; 27 | private UserService userService; 28 | private ClubService clubService; 29 | 30 | @Autowired 31 | public EventController(EventService eventService, UserService userService) { 32 | this.userService = userService; 33 | this.eventService = eventService; 34 | } 35 | 36 | @GetMapping("/events") 37 | public String eventList(Model model) { 38 | UserEntity user = new UserEntity(); 39 | List events = eventService.findAllEvents(); 40 | String username = SecurityUtil.getSessionUser(); 41 | if(username != null) { 42 | user = userService.findByUsername(username); 43 | model.addAttribute("user", user); 44 | } 45 | model.addAttribute("user", user); 46 | model.addAttribute("events", events); 47 | return "events-list"; 48 | } 49 | 50 | @GetMapping("/events/{eventId}") 51 | public String viewEvent(@PathVariable("eventId")Long eventId, Model model) { 52 | UserEntity user = new UserEntity(); 53 | EventDto eventDto = eventService.findByEventId(eventId); 54 | String username = SecurityUtil.getSessionUser(); 55 | if(username != null) { 56 | user = userService.findByUsername(username); 57 | model.addAttribute("user", user); 58 | } 59 | model.addAttribute("club", eventDto.getClub()); 60 | model.addAttribute("user", user); 61 | model.addAttribute("event", eventDto); 62 | return "events-detail"; 63 | } 64 | 65 | @GetMapping("/events/{clubId}/new") 66 | public String createEventForm(@PathVariable("clubId") Long clubId, Model model) { 67 | Event event = new Event(); 68 | model.addAttribute("clubId", clubId); 69 | model.addAttribute("event", event); 70 | return "events-create"; 71 | } 72 | 73 | @GetMapping("/events/{eventId}/edit") 74 | public String editEventForm(@PathVariable("eventId") Long eventId, Model model) { 75 | EventDto event = eventService.findByEventId(eventId); 76 | model.addAttribute("event", event); 77 | return "events-edit"; 78 | } 79 | 80 | @PostMapping("/events/{clubId}") 81 | public String createEvent(@PathVariable("clubId") Long clubId, @ModelAttribute("event") EventDto eventDto, 82 | BindingResult result, 83 | Model model) { 84 | if(result.hasErrors()) { 85 | model.addAttribute("event", eventDto); 86 | return "clubs-create"; 87 | } 88 | eventService.createEvent(clubId, eventDto); 89 | return "redirect:/clubs/" + clubId; 90 | } 91 | 92 | @PostMapping("/events/{eventId}/edit") 93 | public String updateEvent(@PathVariable("eventId") Long eventId, 94 | @Valid @ModelAttribute("event") EventDto event, 95 | BindingResult result, Model model) { 96 | if(result.hasErrors()) { 97 | model.addAttribute("event", event); 98 | return "events-edit"; 99 | } 100 | EventDto eventDto = eventService.findByEventId(eventId); 101 | event.setId(eventId); 102 | event.setClub(eventDto.getClub()); 103 | eventService.updateEvent(event); 104 | return "redirect:/events"; 105 | } 106 | 107 | @GetMapping("/events/{eventId}/delete") 108 | public String deleteEvent(@PathVariable("eventId") long eventId) { 109 | eventService.deleteEvent(eventId); 110 | return "redirect:/events"; 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /src/main/resources/templates/clubs-detail.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | Club Create 7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 |

15 |

Charlotte, NC

16 |
17 |
18 |
19 | 20 |
21 |
22 | 23 |
24 | 25 |
26 | ... 27 |
28 |
29 |

About this running club

30 |

31 |
32 | Delete 33 | Create Event 34 |
35 |
36 |
37 | 38 |
39 |
40 | 41 |
42 | ... 43 |
44 |
January 1, 2022
45 |

46 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis aliquid atque, nulla.

47 | More 48 |
49 |
50 | 51 |
52 |
53 | 54 | 66 |
67 | 68 |
69 | 70 |
71 |
Search
72 |
73 |
74 | 75 | 76 |
77 |
78 |
79 | 80 |
81 |
Categories
82 |
83 |
84 |
85 | 90 |
91 |
92 |
93 |
94 | 95 |
96 |
Side Widget
97 |
You can put anything you want inside of these side widgets. They are easy to use, and feature the Bootstrap 5 card component!
98 |
99 |
100 |
101 |
102 |
103 | 104 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ] ; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ] ; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ] ; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false; 55 | darwin=false; 56 | mingw=false 57 | case "`uname`" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true;; 60 | Darwin*) darwin=true 61 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 62 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 63 | if [ -z "$JAVA_HOME" ]; then 64 | if [ -x "/usr/libexec/java_home" ]; then 65 | export JAVA_HOME="`/usr/libexec/java_home`" 66 | else 67 | export JAVA_HOME="/Library/Java/Home" 68 | fi 69 | fi 70 | ;; 71 | esac 72 | 73 | if [ -z "$JAVA_HOME" ] ; then 74 | if [ -r /etc/gentoo-release ] ; then 75 | JAVA_HOME=`java-config --jre-home` 76 | fi 77 | fi 78 | 79 | if [ -z "$M2_HOME" ] ; then 80 | ## resolve links - $0 may be a link to maven's home 81 | PRG="$0" 82 | 83 | # need this for relative symlinks 84 | while [ -h "$PRG" ] ; do 85 | ls=`ls -ld "$PRG"` 86 | link=`expr "$ls" : '.*-> \(.*\)$'` 87 | if expr "$link" : '/.*' > /dev/null; then 88 | PRG="$link" 89 | else 90 | PRG="`dirname "$PRG"`/$link" 91 | fi 92 | done 93 | 94 | saveddir=`pwd` 95 | 96 | M2_HOME=`dirname "$PRG"`/.. 97 | 98 | # make it fully qualified 99 | M2_HOME=`cd "$M2_HOME" && pwd` 100 | 101 | cd "$saveddir" 102 | # echo Using m2 at $M2_HOME 103 | fi 104 | 105 | # For Cygwin, ensure paths are in UNIX format before anything is touched 106 | if $cygwin ; then 107 | [ -n "$M2_HOME" ] && 108 | M2_HOME=`cygpath --unix "$M2_HOME"` 109 | [ -n "$JAVA_HOME" ] && 110 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 111 | [ -n "$CLASSPATH" ] && 112 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 113 | fi 114 | 115 | # For Mingw, ensure paths are in UNIX format before anything is touched 116 | if $mingw ; then 117 | [ -n "$M2_HOME" ] && 118 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 121 | fi 122 | 123 | if [ -z "$JAVA_HOME" ]; then 124 | javaExecutable="`which javac`" 125 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 126 | # readlink(1) is not available as standard on Solaris 10. 127 | readLink=`which readlink` 128 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 129 | if $darwin ; then 130 | javaHome="`dirname \"$javaExecutable\"`" 131 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 132 | else 133 | javaExecutable="`readlink -f \"$javaExecutable\"`" 134 | fi 135 | javaHome="`dirname \"$javaExecutable\"`" 136 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 137 | JAVA_HOME="$javaHome" 138 | export JAVA_HOME 139 | fi 140 | fi 141 | fi 142 | 143 | if [ -z "$JAVACMD" ] ; then 144 | if [ -n "$JAVA_HOME" ] ; then 145 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 146 | # IBM's JDK on AIX uses strange locations for the executables 147 | JAVACMD="$JAVA_HOME/jre/sh/java" 148 | else 149 | JAVACMD="$JAVA_HOME/bin/java" 150 | fi 151 | else 152 | JAVACMD="`\\unset -f command; \\command -v java`" 153 | fi 154 | fi 155 | 156 | if [ ! -x "$JAVACMD" ] ; then 157 | echo "Error: JAVA_HOME is not defined correctly." >&2 158 | echo " We cannot execute $JAVACMD" >&2 159 | exit 1 160 | fi 161 | 162 | if [ -z "$JAVA_HOME" ] ; then 163 | echo "Warning: JAVA_HOME environment variable is not set." 164 | fi 165 | 166 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 167 | 168 | # traverses directory structure from process work directory to filesystem root 169 | # first directory with .mvn subdirectory is considered project base directory 170 | find_maven_basedir() { 171 | 172 | if [ -z "$1" ] 173 | then 174 | echo "Path not specified to find_maven_basedir" 175 | return 1 176 | fi 177 | 178 | basedir="$1" 179 | wdir="$1" 180 | while [ "$wdir" != '/' ] ; do 181 | if [ -d "$wdir"/.mvn ] ; then 182 | basedir=$wdir 183 | break 184 | fi 185 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 186 | if [ -d "${wdir}" ]; then 187 | wdir=`cd "$wdir/.."; pwd` 188 | fi 189 | # end of workaround 190 | done 191 | echo "${basedir}" 192 | } 193 | 194 | # concatenates all lines of a file 195 | concat_lines() { 196 | if [ -f "$1" ]; then 197 | echo "$(tr -s '\n' ' ' < "$1")" 198 | fi 199 | } 200 | 201 | BASE_DIR=`find_maven_basedir "$(pwd)"` 202 | if [ -z "$BASE_DIR" ]; then 203 | exit 1; 204 | fi 205 | 206 | ########################################################################################## 207 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 208 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 209 | ########################################################################################## 210 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Found .mvn/wrapper/maven-wrapper.jar" 213 | fi 214 | else 215 | if [ "$MVNW_VERBOSE" = true ]; then 216 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 217 | fi 218 | if [ -n "$MVNW_REPOURL" ]; then 219 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 220 | else 221 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 222 | fi 223 | while IFS="=" read key value; do 224 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 225 | esac 226 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Downloading from: $jarUrl" 229 | fi 230 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 231 | if $cygwin; then 232 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 233 | fi 234 | 235 | if command -v wget > /dev/null; then 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Found wget ... using wget" 238 | fi 239 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 240 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 241 | else 242 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 243 | fi 244 | elif command -v curl > /dev/null; then 245 | if [ "$MVNW_VERBOSE" = true ]; then 246 | echo "Found curl ... using curl" 247 | fi 248 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 249 | curl -o "$wrapperJarPath" "$jarUrl" -f 250 | else 251 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 252 | fi 253 | 254 | else 255 | if [ "$MVNW_VERBOSE" = true ]; then 256 | echo "Falling back to using Java to download" 257 | fi 258 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 259 | # For Cygwin, switch paths to Windows format before running javac 260 | if $cygwin; then 261 | javaClass=`cygpath --path --windows "$javaClass"` 262 | fi 263 | if [ -e "$javaClass" ]; then 264 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 265 | if [ "$MVNW_VERBOSE" = true ]; then 266 | echo " - Compiling MavenWrapperDownloader.java ..." 267 | fi 268 | # Compiling the Java class 269 | ("$JAVA_HOME/bin/javac" "$javaClass") 270 | fi 271 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 272 | # Running the downloader 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Running MavenWrapperDownloader.java ..." 275 | fi 276 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 277 | fi 278 | fi 279 | fi 280 | fi 281 | ########################################################################################## 282 | # End of extension 283 | ########################################################################################## 284 | 285 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 286 | if [ "$MVNW_VERBOSE" = true ]; then 287 | echo $MAVEN_PROJECTBASEDIR 288 | fi 289 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 290 | 291 | # For Cygwin, switch paths to Windows format before running java 292 | if $cygwin; then 293 | [ -n "$M2_HOME" ] && 294 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 295 | [ -n "$JAVA_HOME" ] && 296 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 297 | [ -n "$CLASSPATH" ] && 298 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 299 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 300 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 301 | fi 302 | 303 | # Provide a "standardized" way to retrieve the CLI args that will 304 | # work with both Windows and non-Windows executions. 305 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 306 | export MAVEN_CMD_LINE_ARGS 307 | 308 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 309 | 310 | exec "$JAVACMD" \ 311 | $MAVEN_OPTS \ 312 | $MAVEN_DEBUG_OPTS \ 313 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 314 | "-Dmaven.home=${M2_HOME}" \ 315 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 316 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 317 | --------------------------------------------------------------------------------