Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ebean refactor portugal #24

Merged
merged 36 commits into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e5ffd19
Created billy-portugal-ebean as a copy of billy-portugal
Sep 15, 2017
b6ffb7b
Removed unnecessary javadoc. Removed orm-core.xml and persistence.xml…
Sep 15, 2017
529842e
In pom.xml:
Sep 14, 2017
9b01f80
Removed all references to hibernate.envers @Audited
Sep 15, 2017
d1ae0a1
Removed @Inheritance JOINED because it is not supported by Ebean
Sep 14, 2017
fe70cde
Removed from all DAOs the constructor that provided hibernation Entit…
Sep 14, 2017
f7d37bc
Commented all the hibernate-query code to translate later, once the p…
Sep 15, 2017
4a4bac0
[billy-gin] Changed dependency from billy-core-jpa to billy-core
Sep 19, 2017
45484a4
Changed all import packages of billy-core-jpa classes to billy-core-e…
Sep 20, 2017
375df4a
Removed useless @Override that was the cause of compilation problems.
Sep 20, 2017
02072e9
Updated the Copyright header of all source files
Sep 20, 2017
6ac5a47
Commented EntityManager calls in several tests that need to be transl…
Sep 20, 2017
0fbcd67
Changed package declarations from jpa to ebean
Sep 27, 2017
75b60bf
Changed the type of a @OneToOne relation to link to the concrete JPAP…
Sep 29, 2017
fe68e26
Translated all previously-commented JPA queries to Ebean query beans
Oct 4, 2017
b9a45d7
Updated VAT values and time period to 2017-2018
Oct 6, 2017
d56fa0c
Removed SchemaExport DDL generator which is no longer needed with Ebe…
Oct 9, 2017
7f84335
When finding a generic invoice, if the instance found is of the wrong…
Oct 16, 2017
d50bf1f
When finding the credit notes referencing a document, if no document …
Oct 16, 2017
32b95ab
Added missing ebean.mf with the entity & querybean packages that need…
Oct 16, 2017
aca99af
[billy-core-ebean] Added @Inheritance and @DiscriminatorColumn annota…
Oct 18, 2017
608bc1d
@DiscriminatorValue annotation to all entities, which extend entities…
Oct 18, 2017
e274a48
Added missing package property to ebean.mf
Oct 23, 2017
91ea678
Removed from PortugalBootstrap the initialization of PortugalPErsiste…
Oct 24, 2017
f30e559
Added generic specifications to all invocations of BillyValidator.man…
Oct 26, 2017
04560df
Made the relations between Customer and Address, Supplier and Address…
Oct 27, 2017
a105acc
[billy-core-ebean] Made the @OneToMany relations to the Contact entit…
Nov 8, 2017
475ae43
[billy-core-ebean] Added @JoinColumn to all unidireccional @OneToMany…
Nov 8, 2017
77d656a
Services.java and PersistenceServices.java now use @Inject annotation…
Nov 9, 2017
24668cd
Corrected a bug in the GenericInvoiceBuilderImpl that prevented using…
Nov 15, 2017
985fe39
Changed the relation of the CreditNoteEntry to the referenced Invoice…
Nov 15, 2017
50c37e1
Corrected a problem with comparing BigDecimals with ZERO in regard to…
Nov 16, 2017
1b782e9
[billy-core] Added a new field to the InvoiceEntry: taxExemptionCode
Nov 16, 2017
3cf3787
Corrected a problem a query of DAOPTTaxImpl which was returning no taxes
Nov 16, 2017
2db48b2
[billy-portugal] When building a GenericInvoice, having one or more p…
Nov 20, 2017
70c7ba8
[billy-portugal-ebean] Added the module to billy's main pom.xml. Comm…
Nov 24, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ billy-portugal/src/test/resources/documents/
billy-portugal/src/main/java/com/premiumminds/billy/portugal/services/export/saftpt/schema/*

billy-portugal/src-generated/*
billy-portugal-ebean/src-generated/*
billy-spain/src-generated/*

billy-core-jpa/src/main/filters/*.properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,35 @@
package com.premiumminds.billy.core.persistence.entities.ebean;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.premiumminds.billy.core.Config;
import com.premiumminds.billy.core.persistence.entities.AddressEntity;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPAAddressEntity")
@Table(name = Config.TABLE_PREFIX + "ADDRESS")
public class JPAAddressEntity extends JPABaseEntity implements AddressEntity {

private static final long serialVersionUID = 1L;

// Private field without getters or setters that is needed to map the inverse @OneToMany relation
// Avoids ownership limitation problem of Ebean http://ebean-orm.github.io/docs/mapping/jpa/oneToMany
@ManyToOne(targetEntity = JPACustomerEntity.class)
private JPACustomerEntity customer;

// Private field without getters or setters that is needed to map the inverse @OneToMany relation
// Avoids ownership limitation problem of Ebean http://ebean-orm.github.io/docs/mapping/jpa/oneToMany
@ManyToOne(targetEntity = JPASupplierEntity.class)
private JPASupplierEntity supplier;

@Column(name = "NUMBER")
protected String number;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
Expand All @@ -36,6 +39,9 @@
import com.premiumminds.billy.core.services.entities.Contact;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPAApplicationEntity")
@Table(name = Config.TABLE_PREFIX + "APPLICATION")
public class JPAApplicationEntity extends JPABaseEntity implements ApplicationEntity {

Expand All @@ -62,7 +68,7 @@ public class JPAApplicationEntity extends JPABaseEntity implements ApplicationEn
protected JPAContactEntity mainContact;

@OneToMany(fetch = FetchType.EAGER, targetEntity = JPAContactEntity.class,
cascade = { CascadeType.PERSIST, CascadeType.MERGE })
cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "application")
protected List<JPAContactEntity> contacts;

public JPAApplicationEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
Expand All @@ -41,6 +44,9 @@
import com.premiumminds.billy.core.services.entities.Context;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPABusinessEntity")
@Table(name = Config.TABLE_PREFIX + "BUSINESS")
public class JPABusinessEntity extends JPABaseEntity implements BusinessEntity {

Expand Down Expand Up @@ -79,13 +85,15 @@ public class JPABusinessEntity extends JPABaseEntity implements BusinessEntity {
@JoinColumn(name = "ID_MAIN_CONTACT", referencedColumnName = "ID")
protected JPAContactEntity mainContact;

@OneToMany(targetEntity = JPAContactEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@OneToMany(targetEntity = JPAContactEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE },
mappedBy = "business")
protected List<JPAContactEntity> contacts;

@Column(name = "WEBSITE")
protected String website;

@OneToMany(targetEntity = JPAApplicationEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "ID_BUSINESS")
protected List<JPAApplicationEntity> applications;

public JPABusinessEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,45 @@
package com.premiumminds.billy.core.persistence.entities.ebean;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.premiumminds.billy.core.Config;
import com.premiumminds.billy.core.persistence.entities.ContactEntity;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPAContactEntity")
@Table(name = Config.TABLE_PREFIX + "CONTACT")
public class JPAContactEntity extends JPABaseEntity implements ContactEntity {

private static final long serialVersionUID = 1L;

// Private field without getters or setters that is needed to map the inverse @OneToMany relation
// Avoids ownership limitation problem of Ebean http://ebean-orm.github.io/docs/mapping/jpa/oneToMany
@ManyToOne(targetEntity = JPAApplicationEntity.class)
private JPAApplicationEntity application;

// Private field without getters or setters that is needed to map the inverse @OneToMany relation
// Avoids ownership limitation problem of Ebean http://ebean-orm.github.io/docs/mapping/jpa/oneToMany
@ManyToOne(targetEntity = JPABusinessEntity.class)
private JPABusinessEntity business;

// Private field without getters or setters that is needed to map the inverse @OneToMany relation
// Avoids ownership limitation problem of Ebean http://ebean-orm.github.io/docs/mapping/jpa/oneToMany
@ManyToOne(targetEntity = JPACustomerEntity.class)
private JPACustomerEntity customer;

// Private field without getters or setters that is needed to map the inverse @OneToMany relation
// Avoids ownership limitation problem of Ebean http://ebean-orm.github.io/docs/mapping/jpa/oneToMany
@ManyToOne(targetEntity = JPASupplierEntity.class)
private JPASupplierEntity supplier;

@Column(name = "NAME")
protected String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
package com.premiumminds.billy.core.persistence.entities.ebean;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
Expand All @@ -29,6 +32,9 @@
import com.premiumminds.billy.core.services.entities.Context;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPAContextEntity")
@Table(name = Config.TABLE_PREFIX + "CONTEXT")
public class JPAContextEntity extends JPABaseEntity implements ContextEntity {

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

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
Expand All @@ -37,6 +40,9 @@
import com.premiumminds.billy.core.services.entities.Contact;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPACustomerEntity")
@Table(name = Config.TABLE_PREFIX + "CUSTOMER")
public class JPACustomerEntity extends JPABaseEntity implements CustomerEntity {

Expand All @@ -48,7 +54,8 @@ public class JPACustomerEntity extends JPABaseEntity implements CustomerEntity {
@Column(name = "TAX_ID")
protected String taxId;

@OneToMany(targetEntity = JPAAddressEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@OneToMany(targetEntity = JPAAddressEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE },
mappedBy = "customer")
protected List<JPAAddressEntity> addresses;

@OneToOne(targetEntity = JPAAddressEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
Expand All @@ -67,13 +74,15 @@ public class JPACustomerEntity extends JPABaseEntity implements CustomerEntity {
@JoinColumn(name = "ID_CONTACT", referencedColumnName = "ID")
protected JPAContactEntity mainContact;

@OneToMany(targetEntity = JPAContactEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@OneToMany(targetEntity = JPAContactEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE },
mappedBy = "customer")
protected List<JPAContactEntity> contacts;

@Column(name = "SELF_BILLING")
protected Boolean selfBilling;

@OneToMany(targetEntity = JPABankAccountEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "ID_CUSTOMER")
protected List<JPABankAccountEntity> bankAccounts;

public JPACustomerEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
Expand All @@ -52,6 +55,9 @@
import com.premiumminds.billy.core.services.entities.documents.GenericInvoiceEntry;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPAGenericInvoiceEntity")
@Table(name = Config.TABLE_PREFIX + "GENERIC_INVOICE",
uniqueConstraints = { @UniqueConstraint(columnNames = { "NUMBER", "ID_BUSINESS" }),
@UniqueConstraint(columnNames = { "SERIES", "SERIES_NUMBER", "ID_BUSINESS" }) })
Expand Down Expand Up @@ -153,9 +159,11 @@ public class JPAGenericInvoiceEntity extends JPABaseEntity implements GenericInv
protected Integer scale;

@OneToMany(targetEntity = JPAGenericInvoiceEntryEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "ID_INVOICE")
protected List<JPAGenericInvoiceEntryEntity> entries;

@OneToMany(targetEntity = JPAPaymentEntity.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "ID_INVOICE")
protected List<JPAPaymentEntity> payments;

public JPAGenericInvoiceEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
Expand All @@ -46,6 +49,9 @@
import com.premiumminds.billy.core.services.entities.documents.GenericInvoice.CreditOrDebit;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPAGenericInvoiceEntryEntity")
@Table(name = Config.TABLE_PREFIX + "GENERIC_INVOICE_ENTRY")
public class JPAGenericInvoiceEntryEntity extends JPABaseEntity implements GenericInvoiceEntryEntity {

Expand Down Expand Up @@ -112,6 +118,9 @@ public class JPAGenericInvoiceEntryEntity extends JPABaseEntity implements Gener
@Column(name = "TAX_EXEMPTION_REASON")
protected String taxExemptionReason;

@Column(name = "TAX_EXEMPTION_CODE")
protected String taxExemptionCode;

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "TAX_POINT_DATE")
protected Date taxPointDate;
Expand Down Expand Up @@ -247,6 +256,11 @@ public String getTaxExemptionReason() {
return this.taxExemptionReason;
}

@Override
public String getTaxExemptionCode() {
return this.taxExemptionCode;
}

@Override
public AmountType getAmountType() {
return this.type;
Expand Down Expand Up @@ -367,6 +381,11 @@ public void setTaxExemptionReason(String exemptionReason) {
this.taxExemptionReason = exemptionReason;
}

@Override
public void setTaxExemptionCode(String exemptionCode) {
this.taxExemptionCode = exemptionCode;
}

@Override
public void setAmountType(AmountType type) {
this.type = type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
Expand All @@ -30,6 +33,9 @@
import com.premiumminds.billy.core.persistence.entities.PaymentEntity;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPAPaymentEntity")
@Table(name = Config.TABLE_PREFIX + "PAYMENT")
public class JPAPaymentEntity extends JPABaseEntity implements PaymentEntity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
import java.util.List;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
Expand All @@ -34,6 +37,9 @@
import com.premiumminds.billy.core.persistence.entities.ProductEntity;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPAProductEntity")
@Table(name = Config.TABLE_PREFIX + "PRODUCT")
public class JPAProductEntity extends JPABaseEntity implements ProductEntity {

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

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
Expand All @@ -35,6 +38,9 @@
import com.premiumminds.billy.core.services.entities.Address;

@Entity
@Inheritance
@DiscriminatorColumn(length = 255)
@DiscriminatorValue("JPAShippingPointEntity")
@Table(name = Config.TABLE_PREFIX + "SHIPPING_POINT")
public class JPAShippingPointEntity extends JPABaseEntity implements ShippingPointEntity {

Expand Down
Loading