Skip to content

Commit

Permalink
Merge pull request #51 from pagopa/hotfix-boolean-converters-to-stand…
Browse files Browse the repository at this point in the history
…in-and-aca

fix: updated flag converters for aca and standIn.
  • Loading branch information
jacopocarlini authored Jul 26, 2024
2 parents 6624024 + 7ae5852 commit 5d43074
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.gov.pagopa.apiconfig.starter.entity;

import it.gov.pagopa.apiconfig.starter.util.DummyBooleanConverter;
import it.gov.pagopa.apiconfig.starter.util.YesNoConverter;
import javax.persistence.Column;
import javax.persistence.Convert;
Expand Down Expand Up @@ -78,9 +79,11 @@ public class PaStazionePa {
@Column(name = "PAGAMENTO_SPONTANEO", nullable = false)
private Boolean pagamentoSpontaneo = false;

@Convert(converter = DummyBooleanConverter.class)
@Column(name = "ACA", nullable = false)
private Boolean aca = true;

@Convert(converter = DummyBooleanConverter.class)
@Column(name = "STANDIN", nullable = false)
private Boolean standin = true;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.gov.pagopa.apiconfig.starter.entity;

import it.gov.pagopa.apiconfig.starter.util.DummyBooleanConverter;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -9,6 +10,7 @@
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
Expand Down Expand Up @@ -44,6 +46,7 @@ public class StationMaintenance {
@Column(name = "DATA_ORA_FINE", nullable = false)
private OffsetDateTime endDateTime;

@Convert(converter = DummyBooleanConverter.class)
@Column(name = "STANDIN", nullable = false)
private Boolean standIn;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package it.gov.pagopa.apiconfig.starter.util;

import javax.persistence.AttributeConverter;

/**
* Dummy converter for boolean values, to deprecate once all entities using the numeric converter are
* defined without the use of the auto-apply
*/
public class DummyBooleanConverter implements AttributeConverter<Boolean, Boolean> {

@Override
public Boolean convertToDatabaseColumn(final Boolean value) {
return value;
}

@Override
public Boolean convertToEntityAttribute(final Boolean value) {
return value;
}

}

0 comments on commit 5d43074

Please sign in to comment.