-
Notifications
You must be signed in to change notification settings - Fork 18
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
Showing
12 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
code/core-api/src/main/java/com/decathlon/ara/coreapi/config/JpaAuditingConfiguration.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,23 @@ | ||
package com.decathlon.ara.coreapi.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.domain.AuditorAware; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
|
||
import java.util.Optional; | ||
|
||
@Configuration | ||
@EnableJpaAuditing(auditorAwareRef = "auditorProvider") | ||
public class JpaAuditingConfiguration { | ||
|
||
@Bean | ||
public AuditorAware<String> auditorProvider() { | ||
|
||
/* | ||
if you are using spring security, you can get the currently logged username with following code segment. | ||
SecurityContextHolder.getContext().getAuthentication().getName() | ||
*/ | ||
return () -> Optional.ofNullable("Anonymous"); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/AraBugTracker.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,20 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.OneToOne; | ||
|
||
@Data | ||
@Entity | ||
public class AraBugTracker { | ||
@Id | ||
private String code; | ||
|
||
private String name; | ||
private String description; | ||
|
||
@OneToOne(optional = false) | ||
private AraProject project; | ||
} |
28 changes: 28 additions & 0 deletions
28
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/AraFeature.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 com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.*; | ||
import java.time.LocalDateTime; | ||
|
||
@Data | ||
@Entity | ||
public class AraFeature extends Auditable<String> { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ara_feature_id") | ||
@SequenceGenerator(name = "ara_feature_id", sequenceName = "ara_feature_id", allocationSize = 1) | ||
private Long id; | ||
|
||
private String name; | ||
private String description; | ||
private String code; | ||
private String path; | ||
private String status; | ||
private String comment; | ||
|
||
@ManyToOne | ||
private AraPriority priority; | ||
|
||
@ManyToOne | ||
private AraTeam team; | ||
} |
18 changes: 18 additions & 0 deletions
18
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/AraPriority.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,18 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.EmbeddedId; | ||
import javax.persistence.Entity; | ||
|
||
@Data | ||
@Entity | ||
public class AraPriority { | ||
|
||
@EmbeddedId | ||
private CodeWithProjectId id; | ||
|
||
private String name; | ||
private long level; | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/AraProject.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,20 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.OneToOne; | ||
|
||
@Data | ||
@Entity | ||
public class AraProject { | ||
|
||
@Id | ||
private String code; | ||
|
||
private String name; | ||
private String description; | ||
private boolean enabled = true; | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/AraRepository.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,26 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.*; | ||
import java.io.Serializable; | ||
|
||
@Data | ||
@Entity | ||
public class AraRepository { | ||
|
||
@EmbeddedId | ||
private AraRepositoryId id; | ||
|
||
private String name; | ||
private String description; | ||
|
||
@Data | ||
@Embeddable | ||
public static class AraRepositoryId implements Serializable { | ||
@ManyToOne | ||
private AraProject project; | ||
private String url; | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/AraRule.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,27 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.*; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
@Data | ||
@Entity | ||
public class AraRule { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ara_rule_id") | ||
@SequenceGenerator(name = "ara_rule_id", sequenceName = "ara_rule_id", allocationSize = 1) | ||
private Long id; | ||
|
||
@OneToOne(optional = false) | ||
private AraProject project; | ||
|
||
@OneToMany | ||
private Set<AraTag> runTags = Collections.emptySet(); | ||
|
||
@OneToMany | ||
private Set<AraTag> executionTags = Collections.emptySet(); | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/AraSeverity.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,20 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.EmbeddedId; | ||
import javax.persistence.Entity; | ||
|
||
@Data | ||
@Entity | ||
public class AraSeverity { | ||
@EmbeddedId | ||
private CodeWithProjectId id; | ||
|
||
private String name; | ||
private String description; | ||
|
||
private long level; | ||
private double warningThreshold; | ||
private double failureThreshold; | ||
} |
18 changes: 18 additions & 0 deletions
18
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/AraTag.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,18 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.EmbeddedId; | ||
import javax.persistence.Entity; | ||
|
||
@Data | ||
@Entity | ||
public class AraTag { | ||
|
||
@EmbeddedId | ||
private CodeWithProjectId id; | ||
|
||
private String name; | ||
private String description; | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/AraTeam.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,20 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.EmbeddedId; | ||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.ManyToOne; | ||
|
||
@Data | ||
@Entity | ||
public class AraTeam { | ||
|
||
@EmbeddedId | ||
private CodeWithProjectId id; | ||
|
||
private String name; | ||
private String description; | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/Auditable.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,35 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.data.annotation.CreatedBy; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedBy; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.EntityListeners; | ||
import javax.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
|
||
@Getter(AccessLevel.PROTECTED) | ||
@Setter(AccessLevel.PROTECTED) | ||
@MappedSuperclass | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class Auditable<U> { | ||
|
||
@CreatedBy | ||
private U createdBy; | ||
|
||
@CreatedDate | ||
private LocalDateTime createdDate; | ||
|
||
@LastModifiedBy | ||
private U lastModifiedBy; | ||
|
||
@LastModifiedDate | ||
private LocalDateTime lastModifiedDate; | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
code/core-api/src/main/java/com/decathlon/ara/coreapi/domain/CodeWithProjectId.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,14 @@ | ||
package com.decathlon.ara.coreapi.domain; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Embeddable; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import java.io.Serializable; | ||
|
||
@Embeddable | ||
public class CodeWithProjectId implements Serializable { | ||
@ManyToOne | ||
private AraProject project; | ||
private String code; | ||
} |