-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted domain representation of Environment
- Loading branch information
Showing
9 changed files
with
123 additions
and
79 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
...main/environment/SpaceServiceVersion.java → ...ed/server/domain/SpaceServiceVersion.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
80 changes: 25 additions & 55 deletions
80
judge-d-server/src/main/java/com/hltech/judged/server/domain/environment/Environment.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
38 changes: 38 additions & 0 deletions
38
...ava/com/hltech/judged/server/infrastructure/persistence/environment/EnvironmentTuple.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,38 @@ | ||
package com.hltech.judged.server.infrastructure.persistence.environment; | ||
|
||
import com.hltech.judged.server.domain.SpaceServiceVersion; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.Access; | ||
import javax.persistence.AccessType; | ||
import javax.persistence.ElementCollection; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.JoinTable; | ||
import javax.persistence.Table; | ||
import java.util.Set; | ||
|
||
@Entity | ||
@Table(name = "environments") | ||
@Access(AccessType.FIELD) | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class EnvironmentTuple { | ||
|
||
public static final String DEFAULT_NAMESPACE = "default"; | ||
|
||
@Id | ||
private String name; | ||
|
||
@ElementCollection(fetch = FetchType.EAGER, targetClass = SpaceServiceVersion.class) | ||
@JoinTable(name = "service_versions", joinColumns = { | ||
@JoinColumn(name = "environment_name", referencedColumnName = "name"), | ||
}) | ||
private Set<SpaceServiceVersion> spaceServiceVersions; | ||
} |
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
5 changes: 2 additions & 3 deletions
5
...judged/server/infrastructure/persistence/environment/SpringDataEnvironmentRepository.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,14 +1,13 @@ | ||
package com.hltech.judged.server.infrastructure.persistence.environment; | ||
|
||
import com.hltech.judged.server.domain.environment.Environment; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import java.util.Set; | ||
|
||
interface SpringDataEnvironmentRepository extends JpaRepository<Environment, String> { | ||
interface SpringDataEnvironmentRepository extends JpaRepository<EnvironmentTuple, String> { | ||
|
||
@Query("SELECT e.name FROM Environment e") | ||
@Query("SELECT e.name FROM EnvironmentTuple e") | ||
Set<String> getNames(); | ||
|
||
} |
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