forked from box/mojito
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Denormalized job type and job status. Added version to base scheduled…
… job properties
- Loading branch information
1 parent
a501246
commit cc04046
Showing
12 changed files
with
189 additions
and
127 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
28 changes: 28 additions & 0 deletions
28
webapp/src/main/java/com/box/l10n/mojito/entity/ScheduledJobStatusEntity.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.box.l10n.mojito.entity; | ||
|
||
import static org.hibernate.envers.RelationTargetAuditMode.NOT_AUDITED; | ||
|
||
import com.box.l10n.mojito.rest.View; | ||
import com.box.l10n.mojito.service.scheduledjob.ScheduledJobStatus; | ||
import com.fasterxml.jackson.annotation.JsonView; | ||
import jakarta.persistence.Basic; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import org.hibernate.envers.Audited; | ||
|
||
@Entity | ||
@Table(name = "scheduled_job_status") | ||
@Audited(targetAuditMode = NOT_AUDITED) | ||
public class ScheduledJobStatusEntity extends BaseEntity { | ||
@Id private Long id; | ||
|
||
@Basic(optional = false) | ||
@Column(name = "name") | ||
@Enumerated(EnumType.STRING) | ||
@JsonView(View.Repository.class) | ||
private ScheduledJobStatus jobStatus; | ||
} |
46 changes: 46 additions & 0 deletions
46
webapp/src/main/java/com/box/l10n/mojito/entity/ScheduledJobTypeEntity.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,46 @@ | ||
package com.box.l10n.mojito.entity; | ||
|
||
import static org.hibernate.envers.RelationTargetAuditMode.NOT_AUDITED; | ||
|
||
import com.box.l10n.mojito.rest.View; | ||
import com.box.l10n.mojito.service.scheduledjob.ScheduledJobType; | ||
import com.fasterxml.jackson.annotation.JsonView; | ||
import jakarta.persistence.Basic; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import org.hibernate.envers.Audited; | ||
|
||
@Entity | ||
@Table(name = "scheduled_job_type") | ||
@Audited(targetAuditMode = NOT_AUDITED) | ||
public class ScheduledJobTypeEntity extends BaseEntity { | ||
@Id private Long id; | ||
|
||
@Basic(optional = false) | ||
@Column(name = "name") | ||
@Enumerated(EnumType.STRING) | ||
@JsonView(View.Repository.class) | ||
private ScheduledJobType jobType; | ||
|
||
@Override | ||
public Long getId() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public ScheduledJobType getEnum() { | ||
return jobType; | ||
} | ||
|
||
public void setEnum(ScheduledJobType jobType) { | ||
this.jobType = jobType; | ||
} | ||
} |
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
12 changes: 11 additions & 1 deletion
12
webapp/src/main/java/com/box/l10n/mojito/service/scheduledjob/ScheduledJobProperties.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,3 +1,13 @@ | ||
package com.box.l10n.mojito.service.scheduledjob; | ||
|
||
public interface ScheduledJobProperties {} | ||
public abstract class ScheduledJobProperties { | ||
private int version = 1; | ||
|
||
public int getVersion() { | ||
return version; | ||
} | ||
|
||
public void setVersion(int version) { | ||
this.version = version; | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
.../src/main/java/com/box/l10n/mojito/service/scheduledjob/ScheduledJobStatusRepository.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,11 @@ | ||
package com.box.l10n.mojito.service.scheduledjob; | ||
|
||
import com.box.l10n.mojito.entity.ScheduledJobStatusEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
public interface ScheduledJobStatusRepository | ||
extends JpaRepository<ScheduledJobStatusEntity, Long> { | ||
@Query("SELECT sjs FROM ScheduledJobStatusEntity sjs " + "WHERE sjs.jobStatus = :jobStatus") | ||
ScheduledJobStatusEntity findByEnum(ScheduledJobStatus jobStatus); | ||
} |
11 changes: 11 additions & 0 deletions
11
...pp/src/main/java/com/box/l10n/mojito/service/scheduledjob/ScheduledJobTypeRepository.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,11 @@ | ||
package com.box.l10n.mojito.service.scheduledjob; | ||
|
||
import com.box.l10n.mojito.entity.ScheduledJobTypeEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
public interface ScheduledJobTypeRepository extends JpaRepository<ScheduledJobTypeEntity, Long> { | ||
@Query("SELECT sjt FROM ScheduledJobTypeEntity sjt " + "WHERE sjt.jobType = :jobType") | ||
ScheduledJobTypeEntity findByEnum( | ||
com.box.l10n.mojito.service.scheduledjob.ScheduledJobType jobType); | ||
} |
Oops, something went wrong.