-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c20c85
commit 6d69a21
Showing
21 changed files
with
514 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/main/java/uk/gleissner/loomwebflux/movie/domain/Actor.java
This file was deleted.
Oops, something went wrong.
25 changes: 20 additions & 5 deletions
25
src/main/java/uk/gleissner/loomwebflux/movie/domain/Award.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
package uk.gleissner.loomwebflux.movie.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Value; | ||
import lombok.extern.jackson.Jacksonized; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Value | ||
@Builder | ||
@Jacksonized | ||
import static jakarta.persistence.GenerationType.IDENTITY; | ||
|
||
@Entity | ||
@Data | ||
@Builder(toBuilder = true) | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Award { | ||
|
||
@Id | ||
@GeneratedValue(strategy = IDENTITY) | ||
@EqualsAndHashCode.Exclude | ||
Long id; | ||
|
||
String name; | ||
int year; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/uk/gleissner/loomwebflux/movie/domain/Character.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package uk.gleissner.loomwebflux.movie.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
|
||
import static jakarta.persistence.CascadeType.PERSIST; | ||
import static jakarta.persistence.GenerationType.IDENTITY; | ||
|
||
@Entity | ||
@Data | ||
@Builder(toBuilder = true) | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Character { | ||
|
||
@Id | ||
@GeneratedValue(strategy = IDENTITY) | ||
@EqualsAndHashCode.Exclude | ||
Long id; | ||
|
||
String name; | ||
|
||
@ManyToOne(cascade = PERSIST) | ||
Person actor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/uk/gleissner/loomwebflux/movie/repo/AppPropertiesAwareMovieRepo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package uk.gleissner.loomwebflux.movie.repo; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
import uk.gleissner.loomwebflux.config.AppProperties; | ||
import uk.gleissner.loomwebflux.movie.domain.Movie; | ||
|
||
import java.util.Set; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class AppPropertiesAwareMovieRepo { | ||
private final AppProperties appProperties; | ||
private final MovieRepo underlying; | ||
|
||
public Set<Movie> findByDirectorName(String directorName) { | ||
return underlying.findByDirectorName(directorName); | ||
} | ||
|
||
public Movie save(Movie movie) { | ||
return appProperties.repoReadOnly() ? movie : underlying.save(movie); | ||
} | ||
|
||
public void deleteById(Long id) { | ||
if (!appProperties.repoReadOnly()) | ||
underlying.deleteById(id); | ||
} | ||
} |
Oops, something went wrong.