Skip to content

Commit

Permalink
jaxrs: Fix json for boolean value to always be prefixed by 'is'. See #…
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrossie committed Mar 21, 2018
1 parent ef55c92 commit ce56d58
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 81 deletions.
Expand Up @@ -163,19 +163,19 @@ public static final class StackTraceElementJson {
private final String fileName;
private final Integer lineNumber;
private final String methodName;
private final Boolean nativeMethod;
private final Boolean isNativeMethod;

@JsonCreator
public StackTraceElementJson(@JsonProperty("className") final String className,
@JsonProperty("fileName") final String fileName,
@JsonProperty("lineNumber") final Integer lineNumber,
@JsonProperty("methodName") final String methodName,
@JsonProperty("nativeMethod") final Boolean nativeMethod) {
@JsonProperty("isNativeMethod") final Boolean isNativeMethod) {
this.className = className;
this.fileName = fileName;
this.lineNumber = lineNumber;
this.methodName = methodName;
this.nativeMethod = nativeMethod;
this.isNativeMethod = isNativeMethod;
}

public String getClassName() {
Expand All @@ -194,8 +194,9 @@ public String getMethodName() {
return methodName;
}

public Boolean getNativeMethod() {
return nativeMethod;
@JsonProperty("isNativeMethod")
public Boolean isNativeMethod() {
return isNativeMethod;
}

@Override
Expand All @@ -205,7 +206,7 @@ public String toString() {
sb.append(", fileName='").append(fileName).append('\'');
sb.append(", lineNumber=").append(lineNumber);
sb.append(", methodName='").append(methodName).append('\'');
sb.append(", nativeMethod=").append(nativeMethod);
sb.append(", isNativeMethod=").append(isNativeMethod);
sb.append('}');
return sb.toString();
}
Expand Down Expand Up @@ -233,7 +234,7 @@ public boolean equals(final Object o) {
if (methodName != null ? !methodName.equals(that.methodName) : that.methodName != null) {
return false;
}
if (nativeMethod != null ? !nativeMethod.equals(that.nativeMethod) : that.nativeMethod != null) {
if (isNativeMethod != null ? !isNativeMethod.equals(that.isNativeMethod) : that.isNativeMethod != null) {
return false;
}

Expand All @@ -246,7 +247,7 @@ public int hashCode() {
result = 31 * result + (fileName != null ? fileName.hashCode() : 0);
result = 31 * result + (lineNumber != null ? lineNumber.hashCode() : 0);
result = 31 * result + (methodName != null ? methodName.hashCode() : 0);
result = 31 * result + (nativeMethod != null ? nativeMethod.hashCode() : 0);
result = 31 * result + (isNativeMethod != null ? isNativeMethod.hashCode() : 0);
return result;
}
}
Expand Down
Expand Up @@ -23,45 +23,43 @@
import javax.annotation.Nullable;

import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.killbill.billing.entitlement.api.BlockingState;
import org.killbill.billing.entitlement.api.BlockingStateType;
import org.killbill.billing.util.audit.AccountAuditLogs;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value="BlockingState", parent = JsonBase.class)
public class BlockingStateJson extends JsonBase {

private final UUID blockedId;
private final String stateName;
private final String service;
private final Boolean blockChange;
private final Boolean blockEntitlement;
private final Boolean blockBilling;
private final Boolean isBlockChange;
private final Boolean isBlockEntitlement;
private final Boolean isBlockBilling;
private final DateTime effectiveDate;
private final BlockingStateType type;

@JsonCreator
public BlockingStateJson(@JsonProperty("blockedId") final UUID blockedId,
@JsonProperty("stateName") final String stateName,
@JsonProperty("service") final String service,
@JsonProperty("blockChange") final Boolean blockChange,
@JsonProperty("blockEntitlement") final Boolean blockEntitlement,
@JsonProperty("blockBilling") final Boolean blockBilling,
@JsonProperty("isBlockChange") final Boolean isBlockChange,
@JsonProperty("isBlockEntitlement") final Boolean isBlockEntitlement,
@JsonProperty("isBlockBilling") final Boolean isBlockBilling,
@JsonProperty("effectiveDate") final DateTime effectiveDate,
@JsonProperty("type") final BlockingStateType type,
@JsonProperty("auditLogs") @Nullable final List<AuditLogJson> auditLogs) {
super(auditLogs);
this.blockedId = blockedId;
this.stateName = stateName;
this.service = service;
this.blockChange = blockChange;
this.blockEntitlement = blockEntitlement;
this.blockBilling = blockBilling;
this.isBlockChange = isBlockChange;
this.isBlockEntitlement = isBlockEntitlement;
this.isBlockBilling = isBlockBilling;
this.effectiveDate = effectiveDate;
this.type = type;
}
Expand Down Expand Up @@ -91,16 +89,19 @@ public String getService() {
return service;
}

@JsonProperty("isBlockChange")
public Boolean isBlockChange() {
return blockChange;
return isBlockChange;
}

@JsonProperty("isBlockEntitlement")
public Boolean isBlockEntitlement() {
return blockEntitlement;
return isBlockEntitlement;
}

@JsonProperty("isBlockBilling")
public Boolean isBlockBilling() {
return blockBilling;
return isBlockBilling;
}

public DateTime getEffectiveDate() {
Expand All @@ -122,13 +123,13 @@ public boolean equals(final Object o) {

final BlockingStateJson that = (BlockingStateJson) o;

if (blockChange != that.blockChange) {
if (isBlockChange != that.isBlockChange) {
return false;
}
if (blockEntitlement != that.blockEntitlement) {
if (isBlockEntitlement != that.isBlockEntitlement) {
return false;
}
if (blockBilling != that.blockBilling) {
if (isBlockBilling != that.isBlockBilling) {
return false;
}
if (blockedId != null ? !blockedId.equals(that.blockedId) : that.blockedId != null) {
Expand All @@ -152,9 +153,9 @@ public int hashCode() {
int result = blockedId != null ? blockedId.hashCode() : 0;
result = 31 * result + (stateName != null ? stateName.hashCode() : 0);
result = 31 * result + (service != null ? service.hashCode() : 0);
result = 31 * result + (blockChange ? 1 : 0);
result = 31 * result + (blockEntitlement ? 1 : 0);
result = 31 * result + (blockBilling ? 1 : 0);
result = 31 * result + (isBlockChange ? 1 : 0);
result = 31 * result + (isBlockEntitlement ? 1 : 0);
result = 31 * result + (isBlockBilling ? 1 : 0);
result = 31 * result + (effectiveDate != null ? effectiveDate.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
return result;
Expand All @@ -166,9 +167,9 @@ public String toString() {
"blockedId='" + blockedId + '\'' +
", stateName='" + stateName + '\'' +
", service='" + service + '\'' +
", blockChange=" + blockChange +
", blockEntitlement=" + blockEntitlement +
", blockBilling=" + blockBilling +
", isBlockChange=" + isBlockChange +
", isBlockEntitlement=" + isBlockEntitlement +
", isBlockBilling=" + isBlockBilling +
", effectiveDate=" + effectiveDate +
", type=" + type +
'}';
Expand Down
Expand Up @@ -19,30 +19,29 @@

import java.util.List;

import org.killbill.billing.util.nodes.NodeCommandProperty;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;

@ApiModel(value="NodeCommand")
public class NodeCommandJson {

private final boolean systemCommandType;
private final boolean isSystemCommandType;
private final String nodeCommandType;
private final List<NodeCommandPropertyJson> nodeCommandProperties;

@JsonCreator
public NodeCommandJson(@JsonProperty("systemCommandType") final boolean systemCommandType,
public NodeCommandJson(@JsonProperty("isSystemCommandType") final boolean isSystemCommandType,
@JsonProperty("nodeCommandType") final String nodeCommandType,
@JsonProperty("nodeCommandProperties") final List<NodeCommandPropertyJson> nodeCommandProperties) {
this.systemCommandType = systemCommandType;
this.isSystemCommandType = isSystemCommandType;
this.nodeCommandType = nodeCommandType;
this.nodeCommandProperties = nodeCommandProperties;
}

@JsonProperty("isSystemCommandType")
public boolean isSystemCommandType() {
return systemCommandType;
return isSystemCommandType;
}

public String getNodeCommandType() {
Expand Down
Expand Up @@ -19,9 +19,7 @@

import java.util.List;

import org.killbill.billing.catalog.api.CurrencyValueNull;
import org.killbill.billing.catalog.api.TimeUnit;
import org.killbill.billing.overdue.api.OverdueApiException;
import org.killbill.billing.overdue.api.OverdueConfig;
import org.killbill.billing.overdue.api.OverdueState;
import org.killbill.billing.overdue.config.DefaultDuration;
Expand Down Expand Up @@ -126,8 +124,8 @@ public static OverdueConfig toOverdueConfigWithValidation(final OverdueJson inpu
final DefaultOverdueState state = new DefaultOverdueState();
state.setName(cur.getName());
state.setExternalMessage(cur.getExternalMessage());
state.setBlockChanges(cur.getBlockChanges());
state.setDisableEntitlement(cur.getDisableEntitlement());
state.setBlockChanges(cur.isBlockChanges());
state.setDisableEntitlement(cur.isDisableEntitlement());
state.setSubscriptionCancellationPolicy(cur.getSubscriptionCancellationPolicy());
state.setClearState(cur.isClearState());
state.setAutoReevaluationInterval(computeReevaluationInterval(cur.getAutoReevaluationIntervalDays(), prevTimeSinceEarliestUnpaidInvoice, cur.getCondition().getTimeSinceEarliestUnpaidInvoiceEqualsOrExceeds().getNumber()));
Expand Down
Expand Up @@ -32,8 +32,8 @@ public class OverdueStateConfigJson {
private final Boolean isClearState;
private final OverdueConditionJson condition;
private final String externalMessage;
private final Boolean blockChanges;
private final Boolean disableEntitlement;
private final Boolean isBlockChanges;
private final Boolean isDisableEntitlement;
private final OverdueCancellationPolicy subscriptionCancellationPolicy;
private final Integer autoReevaluationIntervalDays;

Expand All @@ -42,16 +42,16 @@ public OverdueStateConfigJson(@JsonProperty("name") final String name,
@JsonProperty("isClearState") final Boolean isClearState,
@JsonProperty("condition") final OverdueConditionJson condition,
@JsonProperty("externalMessage") final String externalMessage,
@JsonProperty("blockChanges") final Boolean blockChanges,
@JsonProperty("disableEntitlement") final Boolean disableEntitlement,
@JsonProperty("isBlockChanges") final Boolean isBlockChanges,
@JsonProperty("isDisableEntitlement") final Boolean isDisableEntitlement,
@JsonProperty("subscriptionCancellationPolicy") final OverdueCancellationPolicy subscriptionCancellationPolicy,
@JsonProperty("autoReevaluationIntervalDays") final Integer autoReevaluationInterval) {
this.name = name;
this.isClearState = isClearState;
this.condition = condition;
this.externalMessage = externalMessage;
this.blockChanges = blockChanges;
this.disableEntitlement = disableEntitlement;
this.isBlockChanges = isBlockChanges;
this.isDisableEntitlement = isDisableEntitlement;
this.subscriptionCancellationPolicy = subscriptionCancellationPolicy;
this.autoReevaluationIntervalDays = autoReevaluationInterval;
}
Expand All @@ -61,8 +61,8 @@ public OverdueStateConfigJson(final OverdueState input) {
this.isClearState = input.isClearState();
this.condition = input.getOverdueCondition() != null ? new OverdueConditionJson(input.getOverdueCondition()) : null;
this.externalMessage = input.getExternalMessage();
this.blockChanges = input.isBlockChanges();
this.disableEntitlement = input.isDisableEntitlementAndChangesBlocked();
this.isBlockChanges = input.isBlockChanges();
this.isDisableEntitlement = input.isDisableEntitlementAndChangesBlocked();
this.subscriptionCancellationPolicy = input.getOverdueCancellationPolicy();
Integer tmpAutoReevaluationIntervalDays = null;
try {
Expand Down Expand Up @@ -90,12 +90,14 @@ public String getExternalMessage() {
return externalMessage;
}

public Boolean getBlockChanges() {
return blockChanges;
@JsonProperty("isBlockChanges")
public Boolean isBlockChanges() {
return isBlockChanges;
}

public Boolean getDisableEntitlement() {
return disableEntitlement;
@JsonProperty("isDisableEntitlement")
public Boolean isDisableEntitlement() {
return isDisableEntitlement;
}

public OverdueCancellationPolicy getSubscriptionCancellationPolicy() {
Expand Down Expand Up @@ -129,10 +131,10 @@ public boolean equals(final Object o) {
if (externalMessage != null ? !externalMessage.equals(that.externalMessage) : that.externalMessage != null) {
return false;
}
if (blockChanges != null ? !blockChanges.equals(that.blockChanges) : that.blockChanges != null) {
if (isBlockChanges != null ? !isBlockChanges.equals(that.isBlockChanges) : that.isBlockChanges != null) {
return false;
}
if (disableEntitlement != null ? !disableEntitlement.equals(that.disableEntitlement) : that.disableEntitlement != null) {
if (isDisableEntitlement != null ? !isDisableEntitlement.equals(that.isDisableEntitlement) : that.isDisableEntitlement != null) {
return false;
}
if (subscriptionCancellationPolicy != that.subscriptionCancellationPolicy) {
Expand All @@ -148,8 +150,8 @@ public int hashCode() {
result = 31 * result + (isClearState != null ? isClearState.hashCode() : 0);
result = 31 * result + (condition != null ? condition.hashCode() : 0);
result = 31 * result + (externalMessage != null ? externalMessage.hashCode() : 0);
result = 31 * result + (blockChanges != null ? blockChanges.hashCode() : 0);
result = 31 * result + (disableEntitlement != null ? disableEntitlement.hashCode() : 0);
result = 31 * result + (isBlockChanges != null ? isBlockChanges.hashCode() : 0);
result = 31 * result + (isDisableEntitlement != null ? isDisableEntitlement.hashCode() : 0);
result = 31 * result + (subscriptionCancellationPolicy != null ? subscriptionCancellationPolicy.hashCode() : 0);
result = 31 * result + (autoReevaluationIntervalDays != null ? autoReevaluationIntervalDays.hashCode() : 0);
return result;
Expand All @@ -162,8 +164,8 @@ public String toString() {
", isClearState=" + isClearState +
", condition=" + condition +
", externalMessage='" + externalMessage + '\'' +
", blockChanges=" + blockChanges +
", disableEntitlement=" + disableEntitlement +
", isBlockChanges=" + isBlockChanges +
", isDisableEntitlement=" + isDisableEntitlement +
", subscriptionCancellationPolicy=" + subscriptionCancellationPolicy +
", autoReevaluationIntervalDays=" + autoReevaluationIntervalDays +
'}';
Expand Down

0 comments on commit ce56d58

Please sign in to comment.