Skip to content

Commit

Permalink
FINERACT-2091: Support for string type primary keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Marta Jankovics authored and adamsaghy committed Jun 13, 2024
1 parent 111e28e commit f48f94c
Show file tree
Hide file tree
Showing 216 changed files with 243 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Getter
public class FinancialActivityAccount extends AbstractPersistableCustom {
public class FinancialActivityAccount extends AbstractPersistableCustom<Long> {

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "gl_account_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class TrialBalance extends AbstractPersistableCustom {
public class TrialBalance extends AbstractPersistableCustom<Long> {

@Column(name = "office_id", nullable = false)
private Long officeId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@Entity
@Getter
@Table(name = "acc_gl_journal_entry")
public class JournalEntry extends AbstractAuditableWithUTCDateTimeCustom {
public class JournalEntry extends AbstractAuditableWithUTCDateTimeCustom<Long> {

@ManyToOne
@JoinColumn(name = "office_id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@Entity
@Table(name = "acc_product_mapping", uniqueConstraints = { @UniqueConstraint(columnNames = { "product_id", "product_type",
"financial_account_type", "payment_type" }, name = "financial_action") })
public class ProductToGLAccountMapping extends AbstractPersistableCustom {
public class ProductToGLAccountMapping extends AbstractPersistableCustom<Long> {

@ManyToOne(optional = true)
@JoinColumn(name = "gl_account_id")
Expand Down Expand Up @@ -69,5 +69,4 @@ public static ProductToGLAccountMapping createNew(final GLAccount glAccount, fin
return new ProductToGLAccountMapping().setGlAccount(glAccount).setProductId(productId).setProductType(productType)
.setFinancialAccountType(financialAccountType);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
@Entity
@Table(name = "acc_accounting_rule", uniqueConstraints = {
@UniqueConstraint(columnNames = { "name" }, name = "accounting_rule_name_unique") })
public class AccountingRule extends AbstractPersistableCustom {
public class AccountingRule extends AbstractPersistableCustom<Long> {

@Column(name = "name", nullable = false, length = 500)
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Entity
@Table(name = "acc_rule_tags", uniqueConstraints = {
@UniqueConstraint(columnNames = { "acc_rule_id", "tag_id", "acc_type_enum" }, name = "UNIQUE_ACCOUNT_RULE_TAGS") })
public class AccountingTagRule extends AbstractPersistableCustom {
public class AccountingTagRule extends AbstractPersistableCustom<Long> {

@ManyToOne
@JoinColumn(name = "acc_rule_id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Cashier extends AbstractPersistableCustom {
public class Cashier extends AbstractPersistableCustom<Long> {

// ManyToOne(fetch = FetchType.LAZY)
// JoinColumn(name = "office_id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class CashierTransaction extends AbstractPersistableCustom {
public class CashierTransaction extends AbstractPersistableCustom<Long> {

@Transient
private Office office;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Teller extends AbstractPersistableCustom {
public class Teller extends AbstractPersistableCustom<Long> {

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "office_id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class TellerTransaction extends AbstractPersistableCustom {
public class TellerTransaction extends AbstractPersistableCustom<Long> {

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "office_id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

@Entity
@Table(name = "m_charge", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }, name = "name") })
public class Charge extends AbstractPersistableCustom {
public class Charge extends AbstractPersistableCustom<Long> {

@Column(name = "name", length = 100)
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class GLAccount extends AbstractPersistableCustom {
public class GLAccount extends AbstractPersistableCustom<Long> {

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "parent_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;

public interface COBBusinessStep<T extends AbstractPersistableCustom> {
public interface COBBusinessStep<T extends AbstractPersistableCustom<Long>> {

T execute(T input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

@Entity
@Table(name = "m_portfolio_command_source")
public class CommandSource extends AbstractPersistableCustom {
public class CommandSource extends AbstractPersistableCustom<Long> {

@Column(name = "action_name", nullable = true, length = 100)
private String actionName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@Accessors(chain = true)
@Entity
@Table(name = "m_business_date", uniqueConstraints = { @UniqueConstraint(name = "uq_business_date_type", columnNames = { "type" }) })
public class BusinessDate extends AbstractAuditableWithUTCDateTimeCustom {
public class BusinessDate extends AbstractAuditableWithUTCDateTimeCustom<Long> {

@Enumerated(EnumType.STRING)
@Column(name = "type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class PlatformCache extends AbstractPersistableCustom {
public class PlatformCache extends AbstractPersistableCustom<Long> {

@Column(name = "cache_type_enum")
private Integer cacheType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class Code extends AbstractPersistableCustom {
public class Code extends AbstractPersistableCustom<Long> {

@Column(name = "code_name", length = 100)
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class CodeValue extends AbstractPersistableCustom {
public class CodeValue extends AbstractPersistableCustom<Long> {

@Column(name = "code_value", length = 100)
private String label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* the type of the auditing type's identifier
*/
@MappedSuperclass
public abstract class AbstractAuditableCustom extends AbstractPersistableCustom implements Auditable<Long, Long, LocalDateTime> {
public abstract class AbstractAuditableCustom extends AbstractPersistableCustom<Long> implements Auditable<Long, Long, LocalDateTime> {

private static final long serialVersionUID = 141481953116476081L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.OffsetDateTime;
import java.util.Optional;
import lombok.AccessLevel;
Expand All @@ -47,8 +48,8 @@
@Getter
@Setter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class AbstractAuditableWithUTCDateTimeCustom extends AbstractPersistableCustom
implements Auditable<Long, Long, OffsetDateTime> {
public abstract class AbstractAuditableWithUTCDateTimeCustom<T extends Serializable> extends AbstractPersistableCustom<T>
implements Auditable<Long, T, OffsetDateTime> {

private static final long serialVersionUID = 141481953116476081L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
@Getter
@Setter
@NoArgsConstructor
public abstract class AbstractPersistableCustom implements Persistable<Long>, Serializable {
public abstract class AbstractPersistableCustom<T extends Serializable> implements Persistable<T>, Serializable {

private static final long serialVersionUID = 9181640245194392646L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Getter(onMethod = @__(@Override))
private Long id;
private T id;

@Transient
@Setter(value = AccessLevel.NONE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Entity
@Table(name = "m_image")
public final class Image extends AbstractPersistableCustom {
public final class Image extends AbstractPersistableCustom<Long> {

@Column(name = "location", length = 500)
private String location;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@Table(name = "m_external_event")
@Getter
@NoArgsConstructor
public class ExternalEvent extends AbstractPersistableCustom {
public class ExternalEvent extends AbstractPersistableCustom<Long> {

@Column(name = "type", nullable = false)
private String type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class Holiday extends AbstractPersistableCustom {
public class Holiday extends AbstractPersistableCustom<Long> {

@Column(name = "name", unique = true, nullable = false, length = 100)
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@Entity
@Table(name = "m_currency")
public class ApplicationCurrency extends AbstractPersistableCustom {
public class ApplicationCurrency extends AbstractPersistableCustom<Long> {

@Column(name = "code", nullable = false, length = 3)
private String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
@Entity
@Table(name = "m_organisation_currency")
public class OrganisationCurrency extends AbstractPersistableCustom {
public class OrganisationCurrency extends AbstractPersistableCustom<Long> {

@Column(name = "code", nullable = false, length = 3)
private String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
@UniqueConstraint(columnNames = { "external_id" }, name = "externalid_org") })
@Getter
@Setter
public class Office extends AbstractPersistableCustom implements Serializable {
public class Office extends AbstractPersistableCustom<Long> implements Serializable {

@OneToMany(fetch = FetchType.LAZY)
@JoinColumn(name = "parent_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@Table(name = "m_staff", uniqueConstraints = { @UniqueConstraint(columnNames = { "display_name" }, name = "display_name"),
@UniqueConstraint(columnNames = { "external_id" }, name = "external_id_UNIQUE"),
@UniqueConstraint(columnNames = { "mobile_no" }, name = "mobile_no_UNIQUE") })
public class Staff extends AbstractPersistableCustom {
public class Staff extends AbstractPersistableCustom<Long> {

@Column(name = "firstname", length = 50)
private String firstname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@Getter
@Entity
@Table(name = "m_working_days")
public class WorkingDays extends AbstractPersistableCustom {
public class WorkingDays extends AbstractPersistableCustom<Long> {

@Column(name = "recurrence", length = 100, nullable = true)
private String recurrence;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

@Entity
@Table(name = "m_calendar")
public class Calendar extends AbstractAuditableWithUTCDateTimeCustom {
public class Calendar extends AbstractAuditableWithUTCDateTimeCustom<Long> {

@Column(name = "title", length = 50, nullable = false)
private String title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

@Entity
@Table(name = "m_calendar_history")
public class CalendarHistory extends AbstractPersistableCustom {
public class CalendarHistory extends AbstractPersistableCustom<Long> {

@ManyToOne(optional = false)
@JoinColumn(name = "calendar_id", referencedColumnName = "id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

@Entity
@Table(name = "m_calendar_instance")
public class CalendarInstance extends AbstractPersistableCustom {
public class CalendarInstance extends AbstractPersistableCustom<Long> {

@ManyToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name = "calendar_id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
@Setter
@Table(name = "m_client", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "account_no_UNIQUE"), //
@UniqueConstraint(columnNames = { "mobile_no" }, name = "mobile_no_UNIQUE") })
public class Client extends AbstractAuditableWithUTCDateTimeCustom {
public class Client extends AbstractAuditableWithUTCDateTimeCustom<Long> {

@Column(name = "account_no", length = 20, unique = true, nullable = false)
private String accountNumber;
Expand Down Expand Up @@ -181,16 +181,6 @@ public class Client extends AbstractAuditableWithUTCDateTimeCustom {
@Column(name = "submittedon_date")
private LocalDate submittedOnDate;

/*
* Deprecated since common Auditable fields were introduced. Columns and data left untouched to help migration.
*
* @Column(name = "updated_on") private LocalDate updatedOnDate;
*
* @ManyToOne(optional = true, fetch = FetchType.LAZY)
*
* @JoinColumn(name = "updated_by") private AppUser updatedBy;
*/

@ManyToOne(optional = true, fetch = FetchType.LAZY)
@JoinColumn(name = "activatedon_userid")
private AppUser activatedBy;
Expand Down Expand Up @@ -751,5 +741,4 @@ public void resetDerivedNames(final LegalForm legalForm) {
setDisplayName(null);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@Table(name = "m_client_identifier", uniqueConstraints = {
@UniqueConstraint(columnNames = { "document_type_id", "document_key" }, name = "unique_identifier_key"),
@UniqueConstraint(columnNames = { "client_id", "document_key", "active" }, name = "unique_active_client_identifier") })
public class ClientIdentifier extends AbstractAuditableWithUTCDateTimeCustom {
public class ClientIdentifier extends AbstractAuditableWithUTCDateTimeCustom<Long> {

@ManyToOne
@JoinColumn(name = "client_id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@Entity
@Table(name = "m_delinquency_bucket", uniqueConstraints = {
@UniqueConstraint(name = "uq_delinquency_bucket_name", columnNames = { "name" }) })
public class DelinquencyBucket extends AbstractAuditableWithUTCDateTimeCustom {
public class DelinquencyBucket extends AbstractAuditableWithUTCDateTimeCustom<Long> {

@Column(name = "name", nullable = false)
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@Entity
@Table(name = "m_delinquency_range", uniqueConstraints = {
@UniqueConstraint(name = "uq_delinquency_range_classification", columnNames = { "classification" }) })
public class DelinquencyRange extends AbstractAuditableWithUTCDateTimeCustom {
public class DelinquencyRange extends AbstractAuditableWithUTCDateTimeCustom<Long> {

@Column(name = "classification", nullable = false)
private String classification;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@Entity
@Table(name = "m_fund", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }, name = "fund_name_org"),
@UniqueConstraint(columnNames = { "external_id" }, name = "fund_externalid_org") })
public class Fund extends AbstractPersistableCustom {
public class Fund extends AbstractPersistableCustom<Long> {

@Column(name = "name")
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

@Entity
@Table(name = "m_group")
public final class Group extends AbstractPersistableCustom {
public final class Group extends AbstractPersistableCustom<Long> {

@Column(name = "external_id", length = 100, unique = true)
private String externalId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Entity
@Table(name = "m_group_level")
public class GroupLevel extends AbstractPersistableCustom {
public class GroupLevel extends AbstractPersistableCustom<Long> {

@Column(name = "parent_id")
private Long parentId;
Expand Down
Loading

0 comments on commit f48f94c

Please sign in to comment.