Details
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJson.java
index 58847fe..236b3bf 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJson.java
@@ -68,7 +68,7 @@ public class AccountJson extends AccountJsonSimple {
private final String phone;
- public AccountJson(Account account) {
+ public AccountJson(final Account account) {
super(account.getId().toString(), account.getExternalKey());
this.name = account.getName();
this.length = account.getFirstNameLength();
@@ -185,7 +185,7 @@ public class AccountJson extends AccountJsonSimple {
}
// Seems like Jackson (JacksonJsonProvider.readFrom(Class<Object>, Type, Annotation[], MediaType, MultivaluedMap<String,String>, InputStream) line: 443)
- // needs us to define a default CTOR to instanciate the class first.
+ // needs us to define a default CTOR to instantiate the class first.
public AccountJson() {
super();
this.name = null;
@@ -204,21 +204,21 @@ public class AccountJson extends AccountJsonSimple {
}
@JsonCreator
- public AccountJson(@JsonProperty("accountId") String accountId,
- @JsonProperty("name") String name,
- @JsonProperty("firstNameLength") Integer length,
- @JsonProperty("externalKey") String externalKey,
- @JsonProperty("email") String email,
- @JsonProperty("billingDay") Integer billCycleDay,
- @JsonProperty("currency") String currency,
- @JsonProperty("paymentProvider") String paymentProvider,
- @JsonProperty("timezone") String timeZone,
- @JsonProperty("address1") String address1,
- @JsonProperty("address2") String address2,
- @JsonProperty("company") String company,
- @JsonProperty("state") String state,
- @JsonProperty("country") String country,
- @JsonProperty("phone") String phone) {
+ public AccountJson(@JsonProperty("accountId") final String accountId,
+ @JsonProperty("name") final String name,
+ @JsonProperty("firstNameLength") final Integer length,
+ @JsonProperty("externalKey") final String externalKey,
+ @JsonProperty("email") final String email,
+ @JsonProperty("billingDay") final Integer billCycleDay,
+ @JsonProperty("currency") final String currency,
+ @JsonProperty("paymentProvider") final String paymentProvider,
+ @JsonProperty("timezone") final String timeZone,
+ @JsonProperty("address1") final String address1,
+ @JsonProperty("address2") final String address2,
+ @JsonProperty("company") final String company,
+ @JsonProperty("state") final String state,
+ @JsonProperty("country") final String country,
+ @JsonProperty("phone") final String phone) {
super(accountId, externalKey);
this.name = name;
this.length = length;
@@ -318,98 +318,131 @@ public class AccountJson extends AccountJsonSimple {
}
// Used to check POST versus GET
- public boolean equalsNoId(Object obj) {
- if (this == obj)
+ public boolean equalsNoId(final Object obj) {
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
- AccountJson other = (AccountJson) obj;
+ }
+ final AccountJson other = (AccountJson) obj;
if (address1 == null) {
- if (other.address1 != null)
+ if (other.address1 != null) {
return false;
- } else if (!address1.equals(other.address1))
+ }
+ } else if (!address1.equals(other.address1)) {
return false;
+ }
if (address2 == null) {
- if (other.address2 != null)
+ if (other.address2 != null) {
return false;
- } else if (!address2.equals(other.address2))
+ }
+ } else if (!address2.equals(other.address2)) {
return false;
+ }
if (billCycleDay == null) {
- if (other.billCycleDay != null)
+ if (other.billCycleDay != null) {
return false;
- } else if (!billCycleDay.equals(other.billCycleDay))
+ }
+ } else if (!billCycleDay.equals(other.billCycleDay)) {
return false;
+ }
if (company == null) {
- if (other.company != null)
+ if (other.company != null) {
return false;
- } else if (!company.equals(other.company))
+ }
+ } else if (!company.equals(other.company)) {
return false;
+ }
if (country == null) {
- if (other.country != null)
+ if (other.country != null) {
return false;
- } else if (!country.equals(other.country))
+ }
+ } else if (!country.equals(other.country)) {
return false;
+ }
if (currency == null) {
- if (other.currency != null)
+ if (other.currency != null) {
return false;
- } else if (!currency.equals(other.currency))
+ }
+ } else if (!currency.equals(other.currency)) {
return false;
+ }
if (email == null) {
- if (other.email != null)
+ if (other.email != null) {
return false;
- } else if (!email.equals(other.email))
+ }
+ } else if (!email.equals(other.email)) {
return false;
+ }
if (externalKey == null) {
- if (other.externalKey != null)
+ if (other.externalKey != null) {
return false;
- } else if (!externalKey.equals(other.externalKey))
+ }
+ } else if (!externalKey.equals(other.externalKey)) {
return false;
+ }
if (length == null) {
- if (other.length != null)
+ if (other.length != null) {
return false;
- } else if (!length.equals(other.length))
+ }
+ } else if (!length.equals(other.length)) {
return false;
+ }
if (name == null) {
- if (other.name != null)
+ if (other.name != null) {
return false;
- } else if (!name.equals(other.name))
+ }
+ } else if (!name.equals(other.name)) {
return false;
+ }
if (paymentProvider == null) {
- if (other.paymentProvider != null)
+ if (other.paymentProvider != null) {
return false;
- } else if (!paymentProvider.equals(other.paymentProvider))
+ }
+ } else if (!paymentProvider.equals(other.paymentProvider)) {
return false;
+ }
if (phone == null) {
- if (other.phone != null)
+ if (other.phone != null) {
return false;
- } else if (!phone.equals(other.phone))
+ }
+ } else if (!phone.equals(other.phone)) {
return false;
+ }
if (state == null) {
- if (other.state != null)
+ if (other.state != null) {
return false;
- } else if (!state.equals(other.state))
+ }
+ } else if (!state.equals(other.state)) {
return false;
+ }
if (timeZone == null) {
- if (other.timeZone != null)
+ if (other.timeZone != null) {
return false;
- } else if (!timeZone.equals(other.timeZone))
+ }
+ } else if (!timeZone.equals(other.timeZone)) {
return false;
+ }
return true;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (!equalsNoId(obj)) {
return false;
} else {
- AccountJson other = (AccountJson) obj;
+ final AccountJson other = (AccountJson) obj;
if (accountId == null) {
- if (other.accountId != null)
+ if (other.accountId != null) {
return false;
- } else if (!accountId.equals(other.accountId))
+ }
+ } else if (!accountId.equals(other.accountId)) {
return false;
+ }
}
return true;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJsonSimple.java
index f178fa7..911ec1f 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJsonSimple.java
@@ -32,8 +32,8 @@ public class AccountJsonSimple {
}
@JsonCreator
- public AccountJsonSimple(@JsonProperty("accountId") String accountId,
- @JsonProperty("externalKey") String externalKey) {
+ public AccountJsonSimple(@JsonProperty("accountId") final String accountId,
+ @JsonProperty("externalKey") final String externalKey) {
this.accountId = accountId;
this.externalKey = externalKey;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountTimelineJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountTimelineJson.java
index b3ca059..df726d4 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountTimelineJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountTimelineJson.java
@@ -32,7 +32,6 @@ import com.ning.billing.invoice.api.InvoiceItem;
import com.ning.billing.payment.api.PaymentAttempt;
public class AccountTimelineJson {
-
@JsonView(BundleTimelineViews.ReadTimeline.class)
private final List<PaymentJsonWithBundleKeys> payments;
@@ -46,18 +45,18 @@ public class AccountTimelineJson {
private final List<BundleJsonWithSubscriptions> bundles;
@JsonCreator
- public AccountTimelineJson(@JsonProperty("account") AccountJsonSimple account,
- @JsonProperty("bundles") List<BundleJsonWithSubscriptions> bundles,
- @JsonProperty("invoices") List<InvoiceJsonWithBundleKeys> invoices,
- @JsonProperty("payments") List<PaymentJsonWithBundleKeys> payments) {
+ public AccountTimelineJson(@JsonProperty("account") final AccountJsonSimple account,
+ @JsonProperty("bundles") final List<BundleJsonWithSubscriptions> bundles,
+ @JsonProperty("invoices") final List<InvoiceJsonWithBundleKeys> invoices,
+ @JsonProperty("payments") final List<PaymentJsonWithBundleKeys> payments) {
this.account = account;
this.bundles = bundles;
this.invoices = invoices;
this.payments = payments;
}
- private String getBundleExternalKey(UUID invoiceId, List<Invoice> invoices, List<BundleTimeline> bundles) {
- for (Invoice cur : invoices) {
+ private String getBundleExternalKey(final UUID invoiceId, final List<Invoice> invoices, final List<BundleTimeline> bundles) {
+ for (final Invoice cur : invoices) {
if (cur.getId().equals(invoiceId)) {
return getBundleExternalKey(cur, bundles);
}
@@ -65,13 +64,13 @@ public class AccountTimelineJson {
return null;
}
- private String getBundleExternalKey(Invoice invoice, List<BundleTimeline> bundles) {
- Set<UUID> b = new HashSet<UUID>();
+ private String getBundleExternalKey(final Invoice invoice, final List<BundleTimeline> bundles) {
+ final Set<UUID> b = new HashSet<UUID>();
for (final InvoiceItem cur : invoice.getInvoiceItems()) {
b.add(cur.getBundleId());
}
boolean first = true;
- StringBuilder tmp = new StringBuilder();
+ final StringBuilder tmp = new StringBuilder();
for (final UUID cur : b) {
for (final BundleTimeline bt : bundles) {
if (bt.getBundleId().equals(cur)) {
@@ -87,14 +86,14 @@ public class AccountTimelineJson {
return tmp.toString();
}
- public AccountTimelineJson(Account account, List<Invoice> invoices, List<PaymentAttempt> payments, List<BundleTimeline> bundles) {
+ public AccountTimelineJson(final Account account, final List<Invoice> invoices, final List<PaymentAttempt> payments, final List<BundleTimeline> bundles) {
this.account = new AccountJsonSimple(account.getId().toString(), account.getExternalKey());
this.bundles = new LinkedList<BundleJsonWithSubscriptions>();
- for (BundleTimeline cur : bundles) {
+ for (final BundleTimeline cur : bundles) {
this.bundles.add(new BundleJsonWithSubscriptions(account.getId(), cur));
}
this.invoices = new LinkedList<InvoiceJsonWithBundleKeys>();
- for (Invoice cur : invoices) {
+ for (final Invoice cur : invoices) {
this.invoices.add(new InvoiceJsonWithBundleKeys(cur.getAmountPaid(),
cur.getAmountCredited(),
cur.getId().toString(),
@@ -105,12 +104,11 @@ public class AccountTimelineJson {
cur.getAccountId().toString(),
getBundleExternalKey(cur, bundles)));
}
- this.payments = new LinkedList<PaymentJsonWithBundleKeys>();
- for (PaymentAttempt cur : payments) {
-
- String status = cur.getPaymentId() != null ? "Success" : "Failed";
- BigDecimal paidAmount = cur.getPaymentId() != null ? cur.getAmount() : BigDecimal.ZERO;
+ this.payments = new LinkedList<PaymentJsonWithBundleKeys>();
+ for (final PaymentAttempt cur : payments) {
+ final String status = cur.getPaymentId() != null ? "Success" : "Failed";
+ final BigDecimal paidAmount = cur.getPaymentId() != null ? cur.getAmount() : BigDecimal.ZERO;
this.payments.add(new PaymentJsonWithBundleKeys(cur.getAmount(),
paidAmount,
@@ -123,7 +121,7 @@ public class AccountTimelineJson {
status,
cur.getAccountId(),
getBundleExternalKey(cur.getInvoiceId(), invoices, bundles)));
- }
+ }
}
public AccountTimelineJson() {
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonNoSubscriptions.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonNoSubscriptions.java
index 1ab9e42..1c0fe54 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonNoSubscriptions.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonNoSubscriptions.java
@@ -21,19 +21,17 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
-
import com.ning.billing.entitlement.api.user.SubscriptionBundle;
public class BundleJsonNoSubscriptions extends BundleJsonSimple {
@JsonView(BundleTimelineViews.Base.class)
private final String accountId;
-
@JsonCreator
- public BundleJsonNoSubscriptions(@JsonProperty("bundleId") String bundleId,
- @JsonProperty("accountId") String accountId,
- @JsonProperty("externalKey") String externalKey,
- @JsonProperty("subscriptions") List<SubscriptionJsonWithEvents> subscriptions) {
+ public BundleJsonNoSubscriptions(@JsonProperty("bundleId") final String bundleId,
+ @JsonProperty("accountId") final String accountId,
+ @JsonProperty("externalKey") final String externalKey,
+ @JsonProperty("subscriptions") final List<SubscriptionJsonWithEvents> subscriptions) {
super(bundleId, externalKey);
this.accountId = accountId;
}
@@ -42,14 +40,14 @@ public class BundleJsonNoSubscriptions extends BundleJsonSimple {
return accountId;
}
-
- public BundleJsonNoSubscriptions(SubscriptionBundle bundle) {
+
+ public BundleJsonNoSubscriptions(final SubscriptionBundle bundle) {
super(bundle.getId().toString(), bundle.getKey());
this.accountId = bundle.getAccountId().toString();
}
-
+
public BundleJsonNoSubscriptions() {
- super(null, null);
+ super(null, null);
this.accountId = null;
}
@@ -67,39 +65,48 @@ public class BundleJsonNoSubscriptions extends BundleJsonSimple {
}
@Override
- public boolean equals(Object obj) {
- if (equalsNoId(obj) == false) {
+ public boolean equals(final Object obj) {
+ if (!equalsNoId(obj)) {
return false;
}
- BundleJsonNoSubscriptions other = (BundleJsonNoSubscriptions) obj;
+ final BundleJsonNoSubscriptions other = (BundleJsonNoSubscriptions) obj;
if (bundleId == null) {
- if (other.bundleId != null)
+ if (other.bundleId != null) {
return false;
- } else if (!bundleId.equals(other.bundleId))
+ }
+ } else if (!bundleId.equals(other.bundleId)) {
return false;
+ }
return true;
}
- public boolean equalsNoId(Object obj) {
- if (this == obj)
+ public boolean equalsNoId(final Object obj) {
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
- BundleJsonNoSubscriptions other = (BundleJsonNoSubscriptions) obj;
+ }
+ final BundleJsonNoSubscriptions other = (BundleJsonNoSubscriptions) obj;
if (accountId == null) {
- if (other.accountId != null)
+ if (other.accountId != null) {
return false;
- } else if (!accountId.equals(other.accountId))
+ }
+ } else if (!accountId.equals(other.accountId)) {
return false;
+ }
if (externalKey == null) {
- if (other.externalKey != null)
+ if (other.externalKey != null) {
return false;
- } else if (!externalKey.equals(other.externalKey))
+ }
+ } else if (!externalKey.equals(other.externalKey)) {
return false;
+ }
return true;
}
-
-
+
+
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonSimple.java
index b20f435..4b8d09f 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonSimple.java
@@ -15,12 +15,13 @@
*/
package com.ning.billing.jaxrs.json;
+import javax.annotation.Nullable;
+
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
public class BundleJsonSimple {
-
@JsonView(BundleTimelineViews.Base.class)
protected final String bundleId;
@@ -28,16 +29,14 @@ public class BundleJsonSimple {
protected final String externalKey;
@JsonCreator
- public BundleJsonSimple(@JsonProperty("bundleId") String bundleId,
- @JsonProperty("externalKey") String externalKey) {
- super();
+ public BundleJsonSimple(@JsonProperty("bundleId") @Nullable final String bundleId,
+ @JsonProperty("externalKey") @Nullable final String externalKey) {
this.bundleId = bundleId;
this.externalKey = externalKey;
}
-
+
public BundleJsonSimple() {
- this.bundleId = null;
- this.externalKey = null;
+ this(null, null);
}
@JsonProperty("bundleId")
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonWithSubscriptions.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonWithSubscriptions.java
index 10c90db..949f11b 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonWithSubscriptions.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonWithSubscriptions.java
@@ -22,20 +22,18 @@ import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
-
import com.ning.billing.entitlement.api.timeline.BundleTimeline;
import com.ning.billing.entitlement.api.timeline.SubscriptionTimeline;
import com.ning.billing.entitlement.api.user.SubscriptionBundle;
public class BundleJsonWithSubscriptions extends BundleJsonSimple {
-
@JsonView(BundleTimelineViews.Timeline.class)
private final List<SubscriptionJsonWithEvents> subscriptions;
@JsonCreator
- public BundleJsonWithSubscriptions(@JsonProperty("bundleId") String bundleId,
- @JsonProperty("externalKey") String externalKey,
- @JsonProperty("subscriptions") List<SubscriptionJsonWithEvents> subscriptions) {
+ public BundleJsonWithSubscriptions(@JsonProperty("bundleId") final String bundleId,
+ @JsonProperty("externalKey") final String externalKey,
+ @JsonProperty("subscriptions") final List<SubscriptionJsonWithEvents> subscriptions) {
super(bundleId, externalKey);
this.subscriptions = subscriptions;
}
@@ -48,18 +46,18 @@ public class BundleJsonWithSubscriptions extends BundleJsonSimple {
public BundleJsonWithSubscriptions(final UUID accountId, final BundleTimeline bundle) {
super(bundle.getBundleId().toString(), bundle.getExternalKey());
this.subscriptions = new LinkedList<SubscriptionJsonWithEvents>();
- for (SubscriptionTimeline cur : bundle.getSubscriptions()) {
- this.subscriptions.add(new SubscriptionJsonWithEvents(bundle.getBundleId(), cur));
+ for (final SubscriptionTimeline cur : bundle.getSubscriptions()) {
+ this.subscriptions.add(new SubscriptionJsonWithEvents(bundle.getBundleId(), cur));
}
}
-
- public BundleJsonWithSubscriptions(SubscriptionBundle bundle) {
+
+ public BundleJsonWithSubscriptions(final SubscriptionBundle bundle) {
super(bundle.getId().toString(), bundle.getKey());
this.subscriptions = null;
}
-
+
public BundleJsonWithSubscriptions() {
- super(null, null);
+ super(null, null);
this.subscriptions = null;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineJson.java
index 11fc814..47906ee 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineJson.java
@@ -23,7 +23,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
public class BundleTimelineJson {
-
@JsonView(BundleTimelineViews.Timeline.class)
private final String viewId;
@@ -37,19 +36,19 @@ public class BundleTimelineJson {
private final List<InvoiceJsonSimple> invoices;
@JsonView(BundleTimelineViews.WriteTimeline.class)
- private final String resonForChange;
+ private final String reasonForChange;
@JsonCreator
- public BundleTimelineJson(@JsonProperty("viewId") String viewId,
- @JsonProperty("bundle") BundleJsonWithSubscriptions bundle,
- @JsonProperty("payments") List<PaymentJsonSimple> payments,
- @JsonProperty("invoices") List<InvoiceJsonSimple> invoices,
- @JsonProperty("reasonForChange") String reason) {
+ public BundleTimelineJson(@JsonProperty("viewId") final String viewId,
+ @JsonProperty("bundle") final BundleJsonWithSubscriptions bundle,
+ @JsonProperty("payments") final List<PaymentJsonSimple> payments,
+ @JsonProperty("invoices") final List<InvoiceJsonSimple> invoices,
+ @JsonProperty("reasonForChange") final String reason) {
this.viewId = viewId;
this.bundle = bundle;
this.payments = payments;
this.invoices = invoices;
- this.resonForChange = reason;
+ this.reasonForChange = reason;
}
public String getViewId() {
@@ -68,7 +67,7 @@ public class BundleTimelineJson {
return invoices;
}
- public String getResonForChange() {
- return resonForChange;
+ public String getReasonForChange() {
+ return reasonForChange;
}
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineViews.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineViews.java
index 0397bec..94c2ce9 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineViews.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineViews.java
@@ -18,8 +18,11 @@ package com.ning.billing.jaxrs.json;
public class BundleTimelineViews {
- public static class Base {};
- public static class Timeline extends Base {};
- public static class ReadTimeline extends Timeline {};
- public static class WriteTimeline extends Timeline {};
+ public static class Base {}
+
+ public static class Timeline extends Base {}
+
+ public static class ReadTimeline extends Timeline {}
+
+ public static class WriteTimeline extends Timeline {}
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackCollectionJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackCollectionJson.java
index 3da8e81..1137618 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackCollectionJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackCollectionJson.java
@@ -16,13 +16,13 @@
package com.ning.billing.jaxrs.json;
+import java.util.List;
+
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.List;
-
public class ChargebackCollectionJson {
- private final String accountId;
+ private final String accountId;
private final List<ChargebackJson> chargebacks;
@JsonCreator
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackJson.java
index 071f971..232d864 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/ChargebackJson.java
@@ -16,27 +16,28 @@
package com.ning.billing.jaxrs.json;
+import java.math.BigDecimal;
+
+import org.joda.time.DateTime;
+
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ning.billing.invoice.api.InvoicePayment;
-import org.joda.time.DateTime;
-
-import java.math.BigDecimal;
// TODO: populate reason code, requested date from audit log
public class ChargebackJson {
- private final DateTime requestedDate;
- private final DateTime effectiveDate;
+ private final DateTime requestedDate;
+ private final DateTime effectiveDate;
private final BigDecimal chargebackAmount;
- private final String paymentId;
- private final String reason;
+ private final String paymentId;
+ private final String reason;
@JsonCreator
- public ChargebackJson(@JsonProperty("requestedDate") DateTime requestedDate,
- @JsonProperty("effectiveDate") DateTime effectiveDate,
- @JsonProperty("chargebackAmount") BigDecimal chargebackAmount,
- @JsonProperty("paymentId") String paymentId,
- @JsonProperty("reason") String reason) {
+ public ChargebackJson(@JsonProperty("requestedDate") final DateTime requestedDate,
+ @JsonProperty("effectiveDate") final DateTime effectiveDate,
+ @JsonProperty("chargebackAmount") final BigDecimal chargebackAmount,
+ @JsonProperty("paymentId") final String paymentId,
+ @JsonProperty("reason") final String reason) {
this.requestedDate = requestedDate;
this.effectiveDate = effectiveDate;
this.chargebackAmount = chargebackAmount;
@@ -44,7 +45,7 @@ public class ChargebackJson {
this.reason = reason;
}
- public ChargebackJson(InvoicePayment chargeback) {
+ public ChargebackJson(final InvoicePayment chargeback) {
this.requestedDate = null;
this.effectiveDate = chargeback.getPaymentAttemptDate();
this.chargebackAmount = chargeback.getAmount().negate();
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CreditCollectionJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CreditCollectionJson.java
index 66f4d0c..14e8031 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CreditCollectionJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CreditCollectionJson.java
@@ -16,14 +16,14 @@
package com.ning.billing.jaxrs.json;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.List;
import java.util.UUID;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
public class CreditCollectionJson {
- private final UUID accountId;
+ private final UUID accountId;
private final List<CreditJson> credits;
@JsonCreator
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CreditJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CreditJson.java
index bea3cf4..fadff6b 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CreditJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CreditJson.java
@@ -16,22 +16,23 @@
package com.ning.billing.jaxrs.json;
+import java.math.BigDecimal;
+import java.util.UUID;
+
+import org.joda.time.DateTime;
+
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ning.billing.invoice.api.InvoiceItem;
-import org.joda.time.DateTime;
-
-import java.math.BigDecimal;
-import java.util.UUID;
// TODO: add invoice number, reason and requested date to the json
public class CreditJson {
private final BigDecimal creditAmount;
- private final UUID invoiceId;
- private final String invoiceNumber;
- private final DateTime requestedDate;
- private final DateTime effectiveDate;
- private final String reason;
+ private final UUID invoiceId;
+ private final String invoiceNumber;
+ private final DateTime requestedDate;
+ private final DateTime effectiveDate;
+ private final String reason;
@JsonCreator
public CreditJson(@JsonProperty("creditAmount") final BigDecimal creditAmount,
@@ -48,7 +49,7 @@ public class CreditJson {
this.reason = reason;
}
- public CreditJson(InvoiceItem credit) {
+ public CreditJson(final InvoiceItem credit) {
this.creditAmount = credit.getAmount();
this.invoiceId = credit.getInvoiceId();
this.invoiceNumber = null;
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CustomFieldJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CustomFieldJson.java
index 6ba6884..85c3863 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CustomFieldJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/CustomFieldJson.java
@@ -15,30 +15,28 @@
*/
package com.ning.billing.jaxrs.json;
-import com.fasterxml.jackson.annotation.JsonCreator;
+import javax.annotation.Nullable;
+import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ning.billing.util.customfield.CustomField;
public class CustomFieldJson {
-
private final String name;
private final String value;
-
+
public CustomFieldJson() {
- this.name = null;
- this.value = null;
+ this(null, null);
}
-
+
@JsonCreator
- public CustomFieldJson(@JsonProperty("name") String name,
- @JsonProperty("value") String value) {
- super();
+ public CustomFieldJson(@JsonProperty("name") @Nullable final String name,
+ @JsonProperty("value") @Nullable final String value) {
this.name = name;
this.value = value;
}
-
- public CustomFieldJson(CustomField input) {
+
+ public CustomFieldJson(final CustomField input) {
this.name = input.getName();
this.value = input.getValue();
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceItemJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceItemJsonSimple.java
index e3011f3..6df38a5 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceItemJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceItemJsonSimple.java
@@ -26,29 +26,29 @@ import com.ning.billing.catalog.api.Currency;
import com.ning.billing.invoice.api.InvoiceItem;
public class InvoiceItemJsonSimple {
- private final UUID invoiceId;
- private final UUID accountId;
- private final UUID bundleId;
- private final UUID subscriptionId;
- private final String planName;
- private final String phaseName;
- private final String description;
- private final DateTime startDate;
- private final DateTime endDate;
+ private final UUID invoiceId;
+ private final UUID accountId;
+ private final UUID bundleId;
+ private final UUID subscriptionId;
+ private final String planName;
+ private final String phaseName;
+ private final String description;
+ private final DateTime startDate;
+ private final DateTime endDate;
private final BigDecimal amount;
- private final Currency currency;
-
- public InvoiceItemJsonSimple(@JsonProperty("invoiceId") UUID invoiceId,
- @JsonProperty("accountId") UUID accountId,
- @JsonProperty("bundleId") UUID bundleId,
- @JsonProperty("subscriptionId") UUID subscriptionId,
- @JsonProperty("planName") String planName,
- @JsonProperty("phaseName") String phaseName,
- @JsonProperty("description") String description,
- @JsonProperty("startDate") DateTime startDate,
- @JsonProperty("endDate") DateTime endDate,
- @JsonProperty("amount") BigDecimal amount,
- @JsonProperty("currency") Currency currency) {
+ private final Currency currency;
+
+ public InvoiceItemJsonSimple(@JsonProperty("invoiceId") final UUID invoiceId,
+ @JsonProperty("accountId") final UUID accountId,
+ @JsonProperty("bundleId") final UUID bundleId,
+ @JsonProperty("subscriptionId") final UUID subscriptionId,
+ @JsonProperty("planName") final String planName,
+ @JsonProperty("phaseName") final String phaseName,
+ @JsonProperty("description") final String description,
+ @JsonProperty("startDate") final DateTime startDate,
+ @JsonProperty("endDate") final DateTime endDate,
+ @JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("currency") final Currency currency) {
this.invoiceId = invoiceId;
this.accountId = accountId;
this.bundleId = bundleId;
@@ -62,7 +62,7 @@ public class InvoiceItemJsonSimple {
this.currency = currency;
}
- public InvoiceItemJsonSimple(InvoiceItem item) {
+ public InvoiceItemJsonSimple(final InvoiceItem item) {
this.invoiceId = item.getInvoiceId();
this.accountId = item.getAccountId();
this.bundleId = item.getBundleId();
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonSimple.java
index 7b0d504..9adf285 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonSimple.java
@@ -27,12 +27,12 @@ import com.ning.billing.invoice.api.Invoice;
public class InvoiceJsonSimple {
private final BigDecimal amount;
private final BigDecimal credit;
- private final String invoiceId;
- private final DateTime invoiceDate;
- private final DateTime targetDate;
- private final String invoiceNumber;
+ private final String invoiceId;
+ private final DateTime invoiceDate;
+ private final DateTime targetDate;
+ private final String invoiceNumber;
private final BigDecimal balance;
- private final String accountId;
+ private final String accountId;
public InvoiceJsonSimple() {
this.amount = BigDecimal.ZERO;
@@ -46,14 +46,14 @@ public class InvoiceJsonSimple {
}
@JsonCreator
- public InvoiceJsonSimple(@JsonProperty("amount") BigDecimal amount,
- @JsonProperty("credit") BigDecimal credit,
- @JsonProperty("invoiceId") String invoiceId,
- @JsonProperty("invoiceDate") DateTime invoiceDate,
- @JsonProperty("targetDate") DateTime targetDate,
- @JsonProperty("invoiceNumber") String invoiceNumber,
- @JsonProperty("balance") BigDecimal balance,
- @JsonProperty("accountId") String accountId) {
+ public InvoiceJsonSimple(@JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("credit") final BigDecimal credit,
+ @JsonProperty("invoiceId") final String invoiceId,
+ @JsonProperty("invoiceDate") final DateTime invoiceDate,
+ @JsonProperty("targetDate") final DateTime targetDate,
+ @JsonProperty("invoiceNumber") final String invoiceNumber,
+ @JsonProperty("balance") final BigDecimal balance,
+ @JsonProperty("accountId") final String accountId) {
super();
this.amount = amount;
this.credit = credit;
@@ -65,7 +65,7 @@ public class InvoiceJsonSimple {
this.accountId = accountId;
}
- public InvoiceJsonSimple(Invoice input) {
+ public InvoiceJsonSimple(final Invoice input) {
this.amount = input.getAmountCharged();
this.credit = input.getAmountCredited();
this.invoiceId = input.getId().toString();
@@ -125,55 +125,72 @@ public class InvoiceJsonSimple {
}
@Override
- public boolean equals(Object obj) {
- if (this == obj)
+ public boolean equals(final Object obj) {
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
- InvoiceJsonSimple other = (InvoiceJsonSimple) obj;
+ }
+ final InvoiceJsonSimple other = (InvoiceJsonSimple) obj;
if (amount == null) {
- if (other.amount != null)
+ if (other.amount != null) {
return false;
- } else if (!amount.equals(other.amount))
+ }
+ } else if (!amount.equals(other.amount)) {
return false;
+ }
if (balance == null) {
- if (other.balance != null)
+ if (other.balance != null) {
return false;
- } else if (!balance.equals(other.balance))
+ }
+ } else if (!balance.equals(other.balance)) {
return false;
+ }
if (credit == null) {
- if (other.credit != null)
+ if (other.credit != null) {
return false;
- } else if (!credit.equals(other.credit))
+ }
+ } else if (!credit.equals(other.credit)) {
return false;
+ }
if (invoiceDate == null) {
- if (other.invoiceDate != null)
+ if (other.invoiceDate != null) {
return false;
- } else if (!invoiceDate.equals(other.invoiceDate))
+ }
+ } else if (!invoiceDate.equals(other.invoiceDate)) {
return false;
+ }
if (invoiceId == null) {
- if (other.invoiceId != null)
+ if (other.invoiceId != null) {
return false;
- } else if (!invoiceId.equals(other.invoiceId))
+ }
+ } else if (!invoiceId.equals(other.invoiceId)) {
return false;
+ }
if (invoiceNumber == null) {
- if (other.invoiceNumber != null)
+ if (other.invoiceNumber != null) {
return false;
- } else if (!invoiceNumber.equals(other.invoiceNumber))
+ }
+ } else if (!invoiceNumber.equals(other.invoiceNumber)) {
return false;
+ }
if (accountId == null) {
- if (other.accountId != null)
+ if (other.accountId != null) {
return false;
- } else if (!accountId.equals(other.accountId))
+ }
+ } else if (!accountId.equals(other.accountId)) {
return false;
+ }
return true;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithBundleKeys.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithBundleKeys.java
index da3ccf4..1e3e165 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithBundleKeys.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithBundleKeys.java
@@ -1,4 +1,5 @@
package com.ning.billing.jaxrs.json;
+
import java.math.BigDecimal;
import org.joda.time.DateTime;
@@ -32,20 +33,20 @@ public class InvoiceJsonWithBundleKeys extends InvoiceJsonSimple {
}
@JsonCreator
- public InvoiceJsonWithBundleKeys(@JsonProperty("amount") BigDecimal amount,
- @JsonProperty("credit") BigDecimal credit,
- @JsonProperty("invoiceId") String invoiceId,
- @JsonProperty("invoiceDate") DateTime invoiceDate,
- @JsonProperty("targetDate") DateTime targetDate,
- @JsonProperty("invoiceNumber") String invoiceNumber,
- @JsonProperty("balance") BigDecimal balance,
- @JsonProperty("accountId") String accountId,
- @JsonProperty("externalBundleKeys") String bundleKeys) {
+ public InvoiceJsonWithBundleKeys(@JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("credit") final BigDecimal credit,
+ @JsonProperty("invoiceId") final String invoiceId,
+ @JsonProperty("invoiceDate") final DateTime invoiceDate,
+ @JsonProperty("targetDate") final DateTime targetDate,
+ @JsonProperty("invoiceNumber") final String invoiceNumber,
+ @JsonProperty("balance") final BigDecimal balance,
+ @JsonProperty("accountId") final String accountId,
+ @JsonProperty("externalBundleKeys") final String bundleKeys) {
super(amount, credit, invoiceId, invoiceDate, targetDate, invoiceNumber, balance, accountId);
this.bundleKeys = bundleKeys;
}
- public InvoiceJsonWithBundleKeys(Invoice input, String bundleKeys) {
+ public InvoiceJsonWithBundleKeys(final Invoice input, final String bundleKeys) {
super(input);
this.bundleKeys = bundleKeys;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithItems.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithItems.java
index b68d34d..fff10ea 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithItems.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithItems.java
@@ -32,23 +32,23 @@ public class InvoiceJsonWithItems extends InvoiceJsonSimple {
private final List<InvoiceItemJsonSimple> items;
@JsonCreator
- public InvoiceJsonWithItems(@JsonProperty("amount") BigDecimal amount,
- @JsonProperty("credit") BigDecimal credit,
- @JsonProperty("invoiceId") String invoiceId,
- @JsonProperty("invoiceDate") DateTime invoiceDate,
- @JsonProperty("targetDate") DateTime targetDate,
- @JsonProperty("invoiceNumber") String invoiceNumber,
- @JsonProperty("balance") BigDecimal balance,
- @JsonProperty("accountId") String accountId,
- @JsonProperty("items") List<InvoiceItemJsonSimple> items) {
+ public InvoiceJsonWithItems(@JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("credit") final BigDecimal credit,
+ @JsonProperty("invoiceId") final String invoiceId,
+ @JsonProperty("invoiceDate") final DateTime invoiceDate,
+ @JsonProperty("targetDate") final DateTime targetDate,
+ @JsonProperty("invoiceNumber") final String invoiceNumber,
+ @JsonProperty("balance") final BigDecimal balance,
+ @JsonProperty("accountId") final String accountId,
+ @JsonProperty("items") final List<InvoiceItemJsonSimple> items) {
super(amount, credit, invoiceId, invoiceDate, targetDate, invoiceNumber, balance, accountId);
this.items = new ArrayList<InvoiceItemJsonSimple>(items);
}
- public InvoiceJsonWithItems(Invoice input) {
+ public InvoiceJsonWithItems(final Invoice input) {
super(input);
this.items = new ArrayList<InvoiceItemJsonSimple>(input.getInvoiceItems().size());
- for (InvoiceItem item : input.getInvoiceItems()) {
+ for (final InvoiceItem item : input.getInvoiceItems()) {
this.items.add(new InvoiceItemJsonSimple(item));
}
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonSimple.java
index 4c76e5b..922c15b 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonSimple.java
@@ -26,7 +26,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.ning.billing.util.clock.DefaultClock;
public class PaymentJsonSimple {
-
private final BigDecimal paidAmount;
private final BigDecimal amount;
@@ -61,16 +60,16 @@ public class PaymentJsonSimple {
}
@JsonCreator
- public PaymentJsonSimple(@JsonProperty("amount") BigDecimal amount,
- @JsonProperty("paidAmount") BigDecimal paidAmount,
- @JsonProperty("invoiceId") UUID invoiceId,
- @JsonProperty("paymentId") UUID paymentId,
- @JsonProperty("requestedDate") DateTime requestedDate,
- @JsonProperty("effectiveDate") DateTime effectiveDate,
- @JsonProperty("retryCount") Integer retryCount,
- @JsonProperty("currency") String currency,
- @JsonProperty("status") String status,
- @JsonProperty("accountId") UUID accountId) {
+ public PaymentJsonSimple(@JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("paidAmount") final BigDecimal paidAmount,
+ @JsonProperty("invoiceId") final UUID invoiceId,
+ @JsonProperty("paymentId") final UUID paymentId,
+ @JsonProperty("requestedDate") final DateTime requestedDate,
+ @JsonProperty("effectiveDate") final DateTime effectiveDate,
+ @JsonProperty("retryCount") final Integer retryCount,
+ @JsonProperty("currency") final String currency,
+ @JsonProperty("status") final String status,
+ @JsonProperty("accountId") final UUID accountId) {
super();
this.amount = amount;
this.paidAmount = paidAmount;
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonWithBundleKeys.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonWithBundleKeys.java
index 8430a1b..a751a21 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonWithBundleKeys.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonWithBundleKeys.java
@@ -25,7 +25,6 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
public class PaymentJsonWithBundleKeys extends PaymentJsonSimple {
-
private final String bundleKeys;
public PaymentJsonWithBundleKeys() {
@@ -34,17 +33,17 @@ public class PaymentJsonWithBundleKeys extends PaymentJsonSimple {
}
@JsonCreator
- public PaymentJsonWithBundleKeys(@JsonProperty("amount") BigDecimal amount,
- @JsonProperty("paidAmount") BigDecimal paidAmount,
- @JsonProperty("invoiceId") UUID invoiceId,
- @JsonProperty("paymentId") UUID paymentId,
- @JsonProperty("requestedDt") DateTime requestedDate,
- @JsonProperty("effectiveDt") DateTime effectiveDate,
- @JsonProperty("retryCount") Integer retryCount,
- @JsonProperty("currency") String currency,
- @JsonProperty("status") String status,
- @JsonProperty("accountId") UUID accountId,
- @JsonProperty("externalBundleKeys") String bundleKeys) {
+ public PaymentJsonWithBundleKeys(@JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("paidAmount") final BigDecimal paidAmount,
+ @JsonProperty("invoiceId") final UUID invoiceId,
+ @JsonProperty("paymentId") final UUID paymentId,
+ @JsonProperty("requestedDt") final DateTime requestedDate,
+ @JsonProperty("effectiveDt") final DateTime effectiveDate,
+ @JsonProperty("retryCount") final Integer retryCount,
+ @JsonProperty("currency") final String currency,
+ @JsonProperty("status") final String status,
+ @JsonProperty("accountId") final UUID accountId,
+ @JsonProperty("externalBundleKeys") final String bundleKeys) {
super(amount, paidAmount, invoiceId, paymentId, requestedDate, effectiveDate, retryCount, currency, status, accountId);
this.bundleKeys = bundleKeys;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PlanDetailJason.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PlanDetailJason.java
index 7474315..89acd18 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PlanDetailJason.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PlanDetailJason.java
@@ -22,27 +22,27 @@ import com.ning.billing.catalog.api.InternationalPrice;
import com.ning.billing.catalog.api.Listing;
public class PlanDetailJason {
+ final String productName;
+ final String planName;
+ final BillingPeriod billingPeriod;
+ final String priceListName;
+ final InternationalPrice finalPhasePrice;
- final String productName;
- final String planName;
- final BillingPeriod billingPeriod;
- final String priceListName;
- final InternationalPrice finalPhasePrice;
public PlanDetailJason(
- @JsonProperty("product") String productName,
- @JsonProperty("plan") String planName,
- @JsonProperty("final_phase_billing_period") BillingPeriod billingPeriod,
- @JsonProperty("priceList") String priceListName,
- @JsonProperty("final_phase_recurring_price") InternationalPrice finalPhasePrice
- ) {
+ @JsonProperty("product") final String productName,
+ @JsonProperty("plan") final String planName,
+ @JsonProperty("final_phase_billing_period") final BillingPeriod billingPeriod,
+ @JsonProperty("priceList") final String priceListName,
+ @JsonProperty("final_phase_recurring_price") final InternationalPrice finalPhasePrice
+ ) {
this.productName = productName;
this.planName = planName;
this.billingPeriod = billingPeriod;
this.priceListName = priceListName;
this.finalPhasePrice = finalPhasePrice;
}
-
- public PlanDetailJason(Listing listing) {
+
+ public PlanDetailJason(final Listing listing) {
this.productName = listing.getPlan().getProduct().getName();
this.planName = listing.getPlan().getName();
this.billingPeriod = listing.getPlan().getBillingPeriod();
@@ -69,6 +69,6 @@ public class PlanDetailJason {
public InternationalPrice getFinalPhasePrice() {
return finalPhasePrice;
}
-
-
+
+
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonNoEvents.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonNoEvents.java
index c28c6b4..aa3972a 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonNoEvents.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonNoEvents.java
@@ -16,26 +16,17 @@
package com.ning.billing.jaxrs.json;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.UUID;
+import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
-import org.joda.time.DateTime;
-
-import com.ning.billing.catalog.api.PlanPhaseSpecifier;
-import com.ning.billing.entitlement.api.timeline.SubscriptionTimeline;
-import com.ning.billing.entitlement.api.timeline.SubscriptionTimeline.ExistingEvent;
import com.ning.billing.entitlement.api.user.Subscription;
-import com.ning.billing.util.clock.DefaultClock;
public class SubscriptionJsonNoEvents extends SubscriptionJsonSimple {
-
@JsonView(BundleTimelineViews.Base.class)
private final DateTime startDate;
-
+
@JsonView(BundleTimelineViews.Base.class)
private final String bundleId;
@@ -53,18 +44,17 @@ public class SubscriptionJsonNoEvents extends SubscriptionJsonSimple {
@JsonView(BundleTimelineViews.Base.class)
private final DateTime chargedThroughDate;
-
@JsonCreator
- public SubscriptionJsonNoEvents(@JsonProperty("subscriptionId") String subscriptionId,
- @JsonProperty("bundleId") String bundleId,
- @JsonProperty("startDate") DateTime startDate,
- @JsonProperty("productName") String productName,
- @JsonProperty("productCategory") String productCategory,
- @JsonProperty("billingPeriod") String billingPeriod,
- @JsonProperty("priceList") String priceList,
- @JsonProperty("chargedThroughDate") DateTime chargedThroughDate) {
+ public SubscriptionJsonNoEvents(@JsonProperty("subscriptionId") final String subscriptionId,
+ @JsonProperty("bundleId") final String bundleId,
+ @JsonProperty("startDate") final DateTime startDate,
+ @JsonProperty("productName") final String productName,
+ @JsonProperty("productCategory") final String productCategory,
+ @JsonProperty("billingPeriod") final String billingPeriod,
+ @JsonProperty("priceList") final String priceList,
+ @JsonProperty("chargedThroughDate") final DateTime chargedThroughDate) {
super(subscriptionId);
this.bundleId = bundleId;
this.startDate = startDate;
@@ -74,7 +64,7 @@ public class SubscriptionJsonNoEvents extends SubscriptionJsonSimple {
this.priceList = priceList;
this.chargedThroughDate = chargedThroughDate;
}
-
+
public SubscriptionJsonNoEvents() {
super(null);
this.bundleId = null;
@@ -83,9 +73,9 @@ public class SubscriptionJsonNoEvents extends SubscriptionJsonSimple {
this.productCategory = null;
this.billingPeriod = null;
this.priceList = null;
- this.chargedThroughDate = null;
+ this.chargedThroughDate = null;
}
-
+
public SubscriptionJsonNoEvents(final Subscription data) {
super(data.getId().toString());
this.bundleId = data.getBundleId().toString();
@@ -96,7 +86,7 @@ public class SubscriptionJsonNoEvents extends SubscriptionJsonSimple {
this.priceList = data.getCurrentPriceList().getName();
this.chargedThroughDate = data.getChargedThroughDate();
}
-
+
public String getSubscriptionId() {
return subscriptionId;
@@ -105,7 +95,7 @@ public class SubscriptionJsonNoEvents extends SubscriptionJsonSimple {
public String getBundleId() {
return bundleId;
}
-
+
public DateTime getStartDate() {
return startDate;
}
@@ -125,7 +115,7 @@ public class SubscriptionJsonNoEvents extends SubscriptionJsonSimple {
public String getPriceList() {
return priceList;
}
-
+
public DateTime getChargedThroughDate() {
return chargedThroughDate;
}
@@ -159,52 +149,67 @@ public class SubscriptionJsonNoEvents extends SubscriptionJsonSimple {
}
@Override
- public boolean equals(Object obj) {
- if (equalsNoId(obj) == false) {
+ public boolean equals(final Object obj) {
+ if (!equalsNoId(obj)) {
return false;
}
- SubscriptionJsonNoEvents other = (SubscriptionJsonNoEvents) obj;
+ final SubscriptionJsonNoEvents other = (SubscriptionJsonNoEvents) obj;
if (subscriptionId == null) {
- if (other.subscriptionId != null)
+ if (other.subscriptionId != null) {
return false;
- } else if (!subscriptionId.equals(other.subscriptionId))
+ }
+ } else if (!subscriptionId.equals(other.subscriptionId)) {
return false;
+ }
return true;
}
- public boolean equalsNoId(Object obj) {
- if (this == obj)
+ public boolean equalsNoId(final Object obj) {
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
- SubscriptionJsonNoEvents other = (SubscriptionJsonNoEvents) obj;
+ }
+ final SubscriptionJsonNoEvents other = (SubscriptionJsonNoEvents) obj;
if (billingPeriod == null) {
- if (other.billingPeriod != null)
+ if (other.billingPeriod != null) {
return false;
- } else if (!billingPeriod.equals(other.billingPeriod))
+ }
+ } else if (!billingPeriod.equals(other.billingPeriod)) {
return false;
+ }
if (bundleId == null) {
- if (other.bundleId != null)
+ if (other.bundleId != null) {
return false;
- } else if (!bundleId.equals(other.bundleId))
+ }
+ } else if (!bundleId.equals(other.bundleId)) {
return false;
+ }
if (priceList == null) {
- if (other.priceList != null)
+ if (other.priceList != null) {
return false;
- } else if (!priceList.equals(other.priceList))
+ }
+ } else if (!priceList.equals(other.priceList)) {
return false;
+ }
if (productCategory == null) {
- if (other.productCategory != null)
+ if (other.productCategory != null) {
return false;
- } else if (!productCategory.equals(other.productCategory))
+ }
+ } else if (!productCategory.equals(other.productCategory)) {
return false;
+ }
if (productName == null) {
- if (other.productName != null)
+ if (other.productName != null) {
return false;
- } else if (!productName.equals(other.productName))
+ }
+ } else if (!productName.equals(other.productName)) {
return false;
+ }
return true;
}
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonSimple.java
index 7d1d018..6cd2a37 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonSimple.java
@@ -15,21 +15,22 @@
*/
package com.ning.billing.jaxrs.json;
+import javax.annotation.Nullable;
+
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
public class SubscriptionJsonSimple {
-
@JsonView(BundleTimelineViews.Base.class)
protected final String subscriptionId;
public SubscriptionJsonSimple() {
- this.subscriptionId = null;
+ this(null);
}
@JsonCreator
- public SubscriptionJsonSimple(@JsonProperty("subscriptionId") String subscriptionId) {
+ public SubscriptionJsonSimple(@JsonProperty("subscriptionId") @Nullable final String subscriptionId) {
this.subscriptionId = subscriptionId;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonWithEvents.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonWithEvents.java
index 27f05e4..6200788 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonWithEvents.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonWithEvents.java
@@ -19,20 +19,18 @@ import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
+import org.joda.time.DateTime;
+
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
-import org.joda.time.DateTime;
-
import com.ning.billing.catalog.api.PlanPhaseSpecifier;
import com.ning.billing.entitlement.api.timeline.SubscriptionTimeline;
import com.ning.billing.entitlement.api.timeline.SubscriptionTimeline.ExistingEvent;
import com.ning.billing.entitlement.api.user.Subscription;
-
import com.ning.billing.util.clock.DefaultClock;
public class SubscriptionJsonWithEvents extends SubscriptionJsonSimple {
-
@JsonView(BundleTimelineViews.ReadTimeline.class)
private final List<SubscriptionReadEventJson> events;
@@ -56,16 +54,16 @@ public class SubscriptionJsonWithEvents extends SubscriptionJsonSimple {
this.eventId = null;
this.effectiveDate = null;
}
-
+
@JsonCreator
- public SubscriptionReadEventJson(@JsonProperty("eventId") String eventId,
- @JsonProperty("billingPeriod") String billingPeriod,
- @JsonProperty("requestedDt") DateTime requestedDate,
- @JsonProperty("effectiveDt") DateTime effectiveDate,
- @JsonProperty("product") String product,
- @JsonProperty("priceList") String priceList,
- @JsonProperty("eventType") String eventType,
- @JsonProperty("phase") String phase) {
+ public SubscriptionReadEventJson(@JsonProperty("eventId") final String eventId,
+ @JsonProperty("billingPeriod") final String billingPeriod,
+ @JsonProperty("requestedDt") final DateTime requestedDate,
+ @JsonProperty("effectiveDt") final DateTime effectiveDate,
+ @JsonProperty("product") final String product,
+ @JsonProperty("priceList") final String priceList,
+ @JsonProperty("eventType") final String eventType,
+ @JsonProperty("phase") final String phase) {
super(billingPeriod, requestedDate, product, priceList, eventType, phase);
this.eventId = eventId;
this.effectiveDate = effectiveDate;
@@ -95,14 +93,14 @@ public class SubscriptionJsonWithEvents extends SubscriptionJsonSimple {
public static class SubscriptionDeletedEventJson extends SubscriptionReadEventJson {
@JsonCreator
- public SubscriptionDeletedEventJson(@JsonProperty("event_id") String eventId,
- @JsonProperty("billing_period") String billingPeriod,
- @JsonProperty("requested_date") DateTime requestedDate,
- @JsonProperty("effective_date") DateTime effectiveDate,
- @JsonProperty("product") String product,
- @JsonProperty("price_list") String priceList,
- @JsonProperty("event_type") String eventType,
- @JsonProperty("phase") String phase) {
+ public SubscriptionDeletedEventJson(@JsonProperty("event_id") final String eventId,
+ @JsonProperty("billing_period") final String billingPeriod,
+ @JsonProperty("requested_date") final DateTime requestedDate,
+ @JsonProperty("effective_date") final DateTime effectiveDate,
+ @JsonProperty("product") final String product,
+ @JsonProperty("price_list") final String priceList,
+ @JsonProperty("event_type") final String eventType,
+ @JsonProperty("phase") final String phase) {
super(eventId, billingPeriod, requestedDate, effectiveDate, product, priceList, eventType, phase);
}
@@ -111,12 +109,12 @@ public class SubscriptionJsonWithEvents extends SubscriptionJsonSimple {
public static class SubscriptionNewEventJson extends SubscriptionBaseEventJson {
@JsonCreator
- public SubscriptionNewEventJson(@JsonProperty("billing_period") String billingPeriod,
- @JsonProperty("requested_date") DateTime requestedDate,
- @JsonProperty("product") String product,
- @JsonProperty("price_list") String priceList,
- @JsonProperty("event_type") String eventType,
- @JsonProperty("phase") String phase) {
+ public SubscriptionNewEventJson(@JsonProperty("billing_period") final String billingPeriod,
+ @JsonProperty("requested_date") final DateTime requestedDate,
+ @JsonProperty("product") final String product,
+ @JsonProperty("price_list") final String priceList,
+ @JsonProperty("event_type") final String eventType,
+ @JsonProperty("phase") final String phase) {
super(billingPeriod, requestedDate, product, priceList, eventType, phase);
}
@@ -162,14 +160,14 @@ public class SubscriptionJsonWithEvents extends SubscriptionJsonSimple {
this.eventType = null;
this.phase = null;
}
-
+
@JsonCreator
- public SubscriptionBaseEventJson(@JsonProperty("billing_period") String billingPeriod,
- @JsonProperty("requested_date") DateTime requestedDate,
- @JsonProperty("product") String product,
- @JsonProperty("price_list") String priceList,
- @JsonProperty("event_type") String eventType,
- @JsonProperty("phase") String phase) {
+ public SubscriptionBaseEventJson(@JsonProperty("billing_period") final String billingPeriod,
+ @JsonProperty("requested_date") final DateTime requestedDate,
+ @JsonProperty("product") final String product,
+ @JsonProperty("price_list") final String priceList,
+ @JsonProperty("event_type") final String eventType,
+ @JsonProperty("phase") final String phase) {
super();
this.billingPeriod = billingPeriod;
this.requestedDate = DefaultClock.toUTCDateTime(requestedDate);
@@ -206,38 +204,38 @@ public class SubscriptionJsonWithEvents extends SubscriptionJsonSimple {
@JsonCreator
- public SubscriptionJsonWithEvents(@JsonProperty("subscription_id") String subscriptionId,
- @JsonProperty("events") List<SubscriptionReadEventJson> events,
- @JsonProperty("new_events") List<SubscriptionNewEventJson> newEvents,
- @JsonProperty("deleted_events") List<SubscriptionDeletedEventJson> deletedEvents) {
+ public SubscriptionJsonWithEvents(@JsonProperty("subscription_id") final String subscriptionId,
+ @JsonProperty("events") final List<SubscriptionReadEventJson> events,
+ @JsonProperty("new_events") final List<SubscriptionNewEventJson> newEvents,
+ @JsonProperty("deleted_events") final List<SubscriptionDeletedEventJson> deletedEvents) {
super(subscriptionId);
this.events = events;
this.deletedEvents = deletedEvents;
this.newEvents = newEvents;
}
-
+
public SubscriptionJsonWithEvents() {
- super(null);
+ super(null);
this.events = null;
this.deletedEvents = null;
this.newEvents = null;
}
-
+
public SubscriptionJsonWithEvents(final Subscription data,
- List<SubscriptionReadEventJson> events, List<SubscriptionDeletedEventJson> deletedEvents, List<SubscriptionNewEventJson> newEvents) {
+ final List<SubscriptionReadEventJson> events, final List<SubscriptionDeletedEventJson> deletedEvents, final List<SubscriptionNewEventJson> newEvents) {
super(data.getId().toString());
this.events = events;
this.deletedEvents = deletedEvents;
this.newEvents = newEvents;
}
-
+
public SubscriptionJsonWithEvents(final UUID bundleId, final SubscriptionTimeline input) {
super(input.getId().toString());
this.events = new LinkedList<SubscriptionReadEventJson>();
- for (ExistingEvent cur : input.getExistingEvents()) {
- PlanPhaseSpecifier spec = cur.getPlanPhaseSpecifier();
+ for (final ExistingEvent cur : input.getExistingEvents()) {
+ final PlanPhaseSpecifier spec = cur.getPlanPhaseSpecifier();
this.events.add(new SubscriptionReadEventJson(cur.getEventId().toString(), spec.getBillingPeriod().toString(), cur.getRequestedDate(), cur.getEffectiveDate(),
- spec.getProductName(), spec.getPriceListName(), cur.getSubscriptionTransitionType().toString(), spec.getPhaseType().toString()));
+ spec.getProductName(), spec.getPriceListName(), cur.getSubscriptionTransitionType().toString(), spec.getPhaseType().toString()));
}
this.deletedEvents = null;
this.newEvents = null;
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/TagDefinitionJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/TagDefinitionJson.java
index d620d0f..01c1dc8 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/TagDefinitionJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/TagDefinitionJson.java
@@ -19,26 +19,26 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
public class TagDefinitionJson {
-
private final String name;
private final String description;
- public TagDefinitionJson() {
+ public TagDefinitionJson() {
this.name = null;
this.description = null;
}
-
+
@JsonCreator
- public TagDefinitionJson(@JsonProperty("name") String name,
- @JsonProperty("description") String description) {
+ public TagDefinitionJson(@JsonProperty("name") final String name,
+ @JsonProperty("description") final String description) {
super();
this.name = name;
this.description = description;
}
-
+
public String getName() {
return name;
}
+
public String getDescription() {
return description;
}
@@ -54,24 +54,31 @@ public class TagDefinitionJson {
}
@Override
- public boolean equals(Object obj) {
- if (this == obj)
+ public boolean equals(final Object obj) {
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
- TagDefinitionJson other = (TagDefinitionJson) obj;
+ }
+ final TagDefinitionJson other = (TagDefinitionJson) obj;
if (description == null) {
- if (other.description != null)
+ if (other.description != null) {
return false;
- } else if (!description.equals(other.description))
+ }
+ } else if (!description.equals(other.description)) {
return false;
+ }
if (name == null) {
- if (other.name != null)
+ if (other.name != null) {
return false;
- } else if (!name.equals(other.name))
+ }
+ } else if (!name.equals(other.name)) {
return false;
+ }
return true;
}
}
diff --git a/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestAccountTimelineJson.java b/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestAccountTimelineJson.java
new file mode 100644
index 0000000..564454e
--- /dev/null
+++ b/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestAccountTimelineJson.java
@@ -0,0 +1,4 @@
+package com.ning.billing.jaxrs.json;
+
+public class TestAccountTimelineJson {
+}