Skip to content

Commit 6d20fc6

Browse files
author
gcornacchia
committed
re added control per version compatibility in field serialization when updating API Proxy
1 parent 6f7a53e commit 6d20fc6

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

modules/apim-adapter/src/main/java/com/axway/apim/adapter/apis/APIManagerAPIAdapter.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,27 @@ public API updateAPIProxy(API api) throws AppException {
608608
}
609609
}
610610

611-
public String[] getSerializeAllExcept() {
612-
return new String[]{"apiDefinition", "certFile", "useForInbound", "useForOutbound", "organization", "applications", "image", "clientOrganizations", "applicationQuota", "systemQuota", "backendBasepath", "remoteHost"};
611+
public String[] getSerializeAllExcept() throws AppException {
612+
String[] serializeAllExcept;
613+
// queryStringPassThrough added in inboundProfiles on API manager version 7.7.20220530
614+
if (isAPIManagerVersionGreaterThan7720220530(APIManagerAdapter.getInstance().getApiManagerVersion())) {
615+
serializeAllExcept = new String[]{"apiDefinition", "certFile", "useForInbound", "useForOutbound", "organization", "applications", "image", "clientOrganizations", "applicationQuota", "systemQuota", "backendBasepath", "remoteHost"};
616+
} else {
617+
serializeAllExcept = new String[]{"queryStringPassThrough", "apiDefinition", "certFile", "useForInbound", "useForOutbound", "organization", "applications", "image", "clientOrganizations", "applicationQuota", "systemQuota", "backendBasepath", "remoteHost"};
618+
}
619+
LOG.debug("serializeAllExcept={}", serializeAllExcept);
620+
return serializeAllExcept;
621+
}
622+
623+
private boolean isAPIManagerVersionGreaterThan7720220530(String apiManagerVersion) {
624+
try {
625+
apiManagerVersion = apiManagerVersion.replace("7.7.", "");
626+
LOG.debug("apiManagerVersion for conversion: {}",apiManagerVersion);
627+
return (Integer.parseInt(apiManagerVersion) >= 20220530);
628+
} catch (NumberFormatException nfe){
629+
LOG.warn("Failed to convert API Manager version to integer: {}, returning false", apiManagerVersion);
630+
return false;
631+
}
613632
}
614633

615634
public void deleteAPIProxy(API api) throws AppException {

0 commit comments

Comments
 (0)