Skip to content

Commit

Permalink
fixed a bug where saving the implementation endpoint of a service ver…
Browse files Browse the repository at this point in the history
…sion may cause the IsPublicService flag to be reset to false
  • Loading branch information
EricWittmann committed Feb 3, 2015
1 parent c46f938 commit 7b5032d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Expand Up @@ -35,7 +35,7 @@ public class UpdateServiceVersionBean implements Serializable {
private String endpoint;
private EndpointType endpointType;
private Set<ServiceGatewayBean> gateways;
private boolean publicService;
private Boolean publicService;
private Set<ServicePlanBean> plans;

/**
Expand Down Expand Up @@ -89,14 +89,14 @@ public void setGateways(Set<ServiceGatewayBean> gateways) {
/**
* @return the publicService
*/
public boolean isPublicService() {
public Boolean getPublicService() {
return publicService;
}

/**
* @param publicService the publicService to set
*/
public void setPublicService(boolean publicService) {
public void setPublicService(Boolean publicService) {
this.publicService = publicService;
}

Expand Down
Expand Up @@ -1346,9 +1346,9 @@ public void updateServiceVersion(String organizationId, String serviceId, String
data.addChange("endpointType", svb.getEndpointType(), bean.getEndpointType()); //$NON-NLS-1$
svb.setEndpointType(bean.getEndpointType());
}
if (AuditUtils.valueChanged(String.valueOf(svb.isPublicService()), String.valueOf(bean.isPublicService()))) {
data.addChange("publicService", String.valueOf(svb.isPublicService()), String.valueOf(bean.isPublicService())); //$NON-NLS-1$
svb.setPublicService(bean.isPublicService());
if (AuditUtils.valueChanged(svb.isPublicService(), bean.getPublicService())) {
data.addChange("publicService", String.valueOf(svb.isPublicService()), String.valueOf(bean.getPublicService())); //$NON-NLS-1$
svb.setPublicService(bean.getPublicService());
}

try {
Expand Down
Expand Up @@ -69,6 +69,24 @@ public static boolean valueChanged(String before, String after) {
return !before.trim().equals(after.trim());
}

/**
* Returns true only if the value changed.
* @param before
* @param after
*/
public static boolean valueChanged(Boolean before, Boolean after) {
if (before == null && after == null) {
return false;
}
if (after == null) {
return false;
}
if (before == null && after != null) {
return true;
}
return !before.equals(after);
}

/**
* Returns true only if the set has changed.
* @param before
Expand Down

0 comments on commit 7b5032d

Please sign in to comment.