fixed api url context
This commit is contained in:
parent
b77f50c3e3
commit
3107c62627
@ -21,6 +21,8 @@ import cz.trask.migration.util.CredentialsDecoder;
|
|||||||
|
|
||||||
public class ApiDefinitionMapper32to45 {
|
public class ApiDefinitionMapper32to45 {
|
||||||
|
|
||||||
|
private static final String CONTEXT_VERSION_TEMPLATE = "/{version}";
|
||||||
|
|
||||||
public static ApiDefinition45 map(ApiDefinition32 oldApi, String swagger) throws Exception {
|
public static ApiDefinition45 map(ApiDefinition32 oldApi, String swagger) throws Exception {
|
||||||
if (oldApi == null)
|
if (oldApi == null)
|
||||||
return null;
|
return null;
|
||||||
@ -45,7 +47,7 @@ public class ApiDefinitionMapper32to45 {
|
|||||||
data.setProvider(oldApi.getId() != null ? oldApi.getId().getProviderName() : null);
|
data.setProvider(oldApi.getId() != null ? oldApi.getId().getProviderName() : null);
|
||||||
// data.setContext(swaggerData.get("basePath") != null ?
|
// data.setContext(swaggerData.get("basePath") != null ?
|
||||||
// swaggerData.get("basePath").toString() : "");
|
// swaggerData.get("basePath").toString() : "");
|
||||||
data.setContext(oldApi.getContext());
|
data.setContext(getContext(oldApi.getContext(), oldApi.getContextTemplate(), oldApi.getId().getVersion()));
|
||||||
data.setLifeCycleStatus(oldApi.getStatus());
|
data.setLifeCycleStatus(oldApi.getStatus());
|
||||||
data.setDefaultVersion(oldApi.isDefaultVersion());
|
data.setDefaultVersion(oldApi.isDefaultVersion());
|
||||||
data.setRevision(false);
|
data.setRevision(false);
|
||||||
@ -158,6 +160,16 @@ public class ApiDefinitionMapper32to45 {
|
|||||||
return newApi;
|
return newApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getContext(String context, String contextTemplate, String version) {
|
||||||
|
if (contextTemplate != null && !contextTemplate.isEmpty()) {
|
||||||
|
return contextTemplate.replace(CONTEXT_VERSION_TEMPLATE, "");
|
||||||
|
}
|
||||||
|
if (context != null && !context.isEmpty()) {
|
||||||
|
return context.replace(version, "");
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
private static Map mapEndpointConfig(Map endpointConfig) {
|
private static Map mapEndpointConfig(Map endpointConfig) {
|
||||||
if (endpointConfig == null || endpointConfig.isEmpty())
|
if (endpointConfig == null || endpointConfig.isEmpty())
|
||||||
return new HashMap();
|
return new HashMap();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user