diff --git a/pom.xml b/pom.xml index b5c2e7c..d298a44 100644 --- a/pom.xml +++ b/pom.xml @@ -33,11 +33,21 @@ gson 2.13.1 + + com.googlecode.json-simple + json-simple + 1.1.1 + org.yaml snakeyaml 2.4 + + org.apache.commons + commons-lang3 + 3.18.0 + diff --git a/src/main/java/cz/trask/migration/model/ApiDefinition.java b/src/main/java/cz/trask/migration/model/ApiDefinition.java deleted file mode 100644 index 4710b48..0000000 --- a/src/main/java/cz/trask/migration/model/ApiDefinition.java +++ /dev/null @@ -1,96 +0,0 @@ -package cz.trask.migration.model; - -import java.util.List; -import java.util.Map; - -public class ApiDefinition { - private String id; - private String name; - private Object description; - private String context; - private String version; - private String provider; - private String apiDefinition; - private Object wsdlUri; - private String lifeCycleStatus; - private boolean isDefaultVersion; - private String type; - private List transport; - private List operations; - private String authorizationHeader; - private List securityScheme; - private List tags; - private List tiers; - private boolean hasThumbnail; - private Map additionalProperties; - private Monetization monetization; - private List ingressURLs; - private List endpointURLs; - private BusinessInformation businessInformation; - private List labels; - private List environmentList; - private List scopes; - private String avgRating; - private AdvertiseInfo advertiseInfo; - private boolean isSubscriptionAvailable; - private List categories; - private List keyManagers; - - // Getters and Setters - - public static class Tier { - private String tierName; - private String tierPlan; - private Object monetizationAttributes; - - // Getters and Setters - } - - public static class EndpointURLs { - private String environmentName; - private String environmentType; - private URLs URLs; - private DefaultVersionURLs defaultVersionURLs; - - public static class URLs { - private String http; - private String https; - private Object ws; - private Object wss; - - // Getters and Setters - } - - public static class DefaultVersionURLs { - private Object http; - private Object https; - private Object ws; - private Object wss; - - // Getters and Setters - } - } - - public static class Monetization { - private boolean enabled; - - // Getters and Setters - } - - public static class BusinessInformation { - private String businessOwner; - private String businessOwnerEmail; - private String technicalOwner; - private String technicalOwnerEmail; - - // Getters and Setters - } - - public static class AdvertiseInfo { - private boolean advertised; - private String originalStoreUrl; - private String apiOwner; - - // Getters and Setters - } -} diff --git a/src/main/java/cz/trask/migration/model/EventAPIInfo.java b/src/main/java/cz/trask/migration/model/EventAPIInfo.java deleted file mode 100644 index 23de51c..0000000 --- a/src/main/java/cz/trask/migration/model/EventAPIInfo.java +++ /dev/null @@ -1,122 +0,0 @@ -package cz.trask.migration.model; - -public class EventAPIInfo { - - String apiName; - String apiId; - String uuid; - String apiVersion; - String apiContext; - String apiProvider; - String apiType; - String apiStatus; - String eventId; - String timeStamp; - String type; - String tenantId; - String tenantDomain; - - public String getApiName() { - return apiName; - } - - public void setApiName(String apiName) { - this.apiName = apiName; - } - - public String getApiId() { - return apiId; - } - - public void setApiId(String apiId) { - this.apiId = apiId; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getApiVersion() { - return apiVersion; - } - - public void setApiVersion(String apiVersion) { - this.apiVersion = apiVersion; - } - - public String getApiContext() { - return apiContext; - } - - public void setApiContext(String apiContext) { - this.apiContext = apiContext; - } - - public String getApiProvider() { - return apiProvider; - } - - public void setApiProvider(String apiProvider) { - this.apiProvider = apiProvider; - } - - public String getApiType() { - return apiType; - } - - public void setApiType(String apiType) { - this.apiType = apiType; - } - - public String getApiStatus() { - return apiStatus; - } - - public void setApiStatus(String apiStatus) { - this.apiStatus = apiStatus; - } - - public String getEventId() { - return eventId; - } - - public void setEventId(String eventId) { - this.eventId = eventId; - } - - public String getTimeStamp() { - return timeStamp; - } - - public void setTimeStamp(String timeStamp) { - this.timeStamp = timeStamp; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getTenantDomain() { - return tenantDomain; - } - - public void setTenantDomain(String tenantDomain) { - this.tenantDomain = tenantDomain; - } -} diff --git a/src/main/java/cz/trask/migration/model/v32/API.java b/src/main/java/cz/trask/migration/model/v32/API.java new file mode 100644 index 0000000..61580ac --- /dev/null +++ b/src/main/java/cz/trask/migration/model/v32/API.java @@ -0,0 +1,1073 @@ +/* +* Copyright (c) 2005-2011, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +package cz.trask.migration.model.v32; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +import org.apache.commons.lang3.StringUtils; +import org.json.simple.JSONObject; + + +/** + * Provider's & system's view of API + */ +@SuppressWarnings("unused") +public class API implements Serializable { + + private static final long serialVersionUID = 1L; + + private APIIdentifier id; + + // uuid of registry artifact + // this id is provider's username independent + private String uuid; + + private String description; + private String url; + private String sandboxUrl; + private String wsdlUrl; + private String wsdlArchivePath; + private String wadlUrl; + private String swaggerDefinition; + private String graphQLSchema; + private String type; + private String context; + private String contextTemplate; + private String thumbnailUrl; + private ResourceFile wsdlResource; + private Set tags = new LinkedHashSet(); + private Set documents = new LinkedHashSet(); + private String httpVerb; + private Date lastUpdated; + private Set availableTiers = new LinkedHashSet(); + private Set availableSubscriptionLevelPolicies = new LinkedHashSet(); + private String apiLevelPolicy; + private AuthorizationPolicy authorizationPolicy; + private Set uriTemplates = new LinkedHashSet(); + + //dirty pattern to identify which parts to be updated + private boolean apiHeaderChanged; + private boolean apiResourcePatternsChanged; + + private String status; + + private String technicalOwner; + private String technicalOwnerEmail; + private String businessOwner; + private String businessOwnerEmail; + + // Used for keeping Production & Sandbox Throttling limits. + private String productionMaxTps; + private String sandboxMaxTps; + + private String visibility; + private String visibleRoles; + private String visibleTenants; + + private List