-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/spring-updates
- Loading branch information
Showing
29 changed files
with
592 additions
and
87 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
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
29 changes: 29 additions & 0 deletions
29
apps/dolly-backend/src/main/java/no/nav/dolly/config/MigrationConfig.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,29 @@ | ||
package no.nav.dolly.config; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import no.nav.dolly.service.MigrateDokumentService; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
|
||
import javax.annotation.PostConstruct; | ||
|
||
@Slf4j | ||
@Configuration | ||
@Profile("!test") | ||
@RequiredArgsConstructor | ||
public class MigrationConfig { | ||
|
||
private final MigrateDokumentService migrateDokumentService; | ||
|
||
@PostConstruct | ||
public void migrateDokumenter() { | ||
|
||
var time = System.currentTimeMillis(); | ||
log.info("Starter migrering av dokumenter."); | ||
|
||
migrateDokumentService.migrateDokumenter(); | ||
|
||
log.info("Migrering av dokumenter ferdig, medgått tid: {} sekunder", (System.currentTimeMillis() - time) / 1000); | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/Dokument.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,91 @@ | ||
package no.nav.dolly.domain.jpa; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import jakarta.persistence.Version; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import org.apache.commons.lang3.builder.EqualsBuilder; | ||
import org.apache.commons.lang3.builder.HashCodeBuilder; | ||
import org.hibernate.annotations.UpdateTimestamp; | ||
|
||
import java.io.Serializable; | ||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Table(name = "DOKUMENT") | ||
public class Dokument implements Serializable { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Version | ||
@Column(name = "VERSJON") | ||
private Long versjon; | ||
|
||
@Column(name = "BESTILLING_ID") | ||
private Long bestillingId; | ||
|
||
@Column(name = "DOKUMENT_TYPE") | ||
@Enumerated(value = EnumType.STRING) | ||
private DokumentType dokumentType; | ||
|
||
@Column(name = "SIST_OPPDATERT") | ||
@UpdateTimestamp | ||
private LocalDateTime sistOppdatert; | ||
|
||
@Column(name = "CONTENTS") | ||
private String contents; | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
|
||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
Dokument dokument = (Dokument) o; | ||
|
||
return new EqualsBuilder() | ||
.append(id, dokument.id) | ||
.append(versjon, dokument.versjon) | ||
.append(bestillingId, dokument.bestillingId) | ||
.append(dokumentType, dokument.dokumentType) | ||
.append(sistOppdatert, dokument.sistOppdatert) | ||
.append(contents, dokument.contents) | ||
.isEquals(); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return new HashCodeBuilder(17, 37) | ||
.append(id) | ||
.append(versjon) | ||
.append(bestillingId) | ||
.append(dokumentType) | ||
.append(sistOppdatert) | ||
.append(contents) | ||
.toHashCode(); | ||
} | ||
|
||
public enum DokumentType { | ||
BESTILLING_DOKARKIV, | ||
BESTILLING_HISTARK, | ||
MAL_BESTILLING_DOKARKIV, | ||
MAL_BESTILLING_HISTARK | ||
} | ||
} |
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
Oops, something went wrong.