some fixes

This commit is contained in:
Radek Davidek 2025-12-22 21:00:36 +01:00
parent d44dbfabc7
commit 0d25f854ec
6 changed files with 14 additions and 9 deletions

View File

@ -4,8 +4,6 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -181,7 +179,7 @@ public class Wso2v32ToApicurioFromDir extends AbstractProcess {
api.getVersion(),
api.getName(), fullDesc, new ByteArrayInputStream(swaggerObj.toString().getBytes()),
references);
setArtifactMetaData(meta, api.getName(), fullDesc,props);
setArtifactMetaData(meta, api.getName(), fullDesc, props);
} else {
// Version already exists no action needed
log.warn("API {} with version {} already exists. Skipping import.",

View File

@ -59,7 +59,10 @@ public class ZipUtils {
return FileType.DOCUMENTATION_FILE;
} else if (lowerFileName.contains("/docs/")) {
return FileType.DOCUMENTATION;
} else if (lowerFileName.contains("/image/icon.png")) {
return FileType.ICON;
}
return FileType.UNKNOWN;
}

View File

@ -103,7 +103,7 @@ public class ExportApisToWso2FromV32 extends AbstractProcess {
if (ref != null && !ref.isEmpty()) {
log.info("Artifact has {} references", ref.size());
byte[] data = prepareApiZipFile32to45(ver, ref);
String fileName = api.getName() + "-" + ver.getVersion() + ".zip";
String fileName = ver.getName() + "-" + ver.getVersion() + ".zip";
if (config.isStoreMigratedArtifacts()) {
File tmpFile = new File("tmp/api/", fileName);
@ -213,6 +213,8 @@ public class ExportApisToWso2FromV32 extends AbstractProcess {
} else if (FileType.DOCUMENTATION_FILE.toString().equals(amd.getGroupId())) {
// Handled in convertAndAddDocument method
appendFile = false;
} else if (FileType.ICON.toString().equals(amd.getGroupId())) {
subDir = "Image/";
}
if (appendFile) {

View File

@ -54,10 +54,11 @@ public class ApiDefinitionMapper32to45 {
oldApi.getTransports() != null ? List.of(oldApi.getTransports().split(",")) : Collections.emptyList());
data.setTags(oldApi.getTags());
data.setVisibility(oldApi.getVisibility().toUpperCase());
data.setVisibleRoles(Collections.emptyList());
//data.setVisibleRoles(oldApi.getVisibleRoles()!=null ? List.of(oldApi.getVisibleRoles().split(",")) : Collections.emptyList());
data.setVisibleRoles(List.of("Internal/publisher"));
data.setVisibleTenants(Collections.emptyList());
data.setAccessControl("NONE");
data.setAccessControlRoles(Collections.emptyList());
//data.setAccessControlRoles(Collections.emptyList());
data.setOrganizationPolicies(Collections.emptyList());
data.setType(oldApi.getType()!=null && !oldApi.getType().toLowerCase().equals("null") ? oldApi.getType() : "HTTP");
data.setAudiences(Arrays.asList("all"));
@ -159,7 +160,7 @@ public class ApiDefinitionMapper32to45 {
return new HashMap();
Map<String, Object> endpointProd = (Map<String, Object>) endpointConfig.get("production_endpoints");
if (endpointProd.containsKey("config")) {
if (endpointProd != null && endpointProd.containsKey("config")) {
Object value = endpointProd.get("config");
if (value==null) {
endpointProd.remove("config");
@ -167,7 +168,7 @@ public class ApiDefinitionMapper32to45 {
}
Map<String, Object> endpointSand = (Map<String, Object>) endpointConfig.get("sandbox_endpoints");
if (endpointSand.containsKey("config")) {
if (endpointSand != null && endpointSand.containsKey("config")) {
Object value = endpointSand.get("config");
if (value==null) {
endpointSand.remove("config");

View File

@ -1,5 +1,5 @@
package cz.trask.migration.model;
public enum FileType {
APIDEF, OPENAPI, WSDL, POLICY_IN, POLICY_OUT, POLICY_FAULT, CERTIFICATE, SUBSCRIPTIONS, DOCUMENTATION, DOCUMENTATION_FILE, UNKNOWN
APIDEF, OPENAPI, WSDL, POLICY_IN, POLICY_OUT, POLICY_FAULT, CERTIFICATE, SUBSCRIPTIONS, DOCUMENTATION, DOCUMENTATION_FILE, ICON, UNKNOWN
}

View File

@ -42,6 +42,7 @@ public class ApiDefinition32 {
private boolean apiResourcePatternsChanged;
private String status;
private String visibility;
private String visibleRoles;
private List<Object> gatewayLabels;
private boolean endpointSecured;
private boolean endpointAuthDigest;