Skip to content

Commit

Permalink
Fixing request changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HiranyaKavishani committed Dec 18, 2023
1 parent 632eea2 commit 342208f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4184,6 +4184,14 @@ public Map<API, List<APIProductResource>> addAPIProductWithoutPublishingToGatewa
String apiProductUUID = createAPIProduct(product);
product.setUuid(apiProductUUID);

//If the context template ends with {version} this means that the version will be at the end of the context.
String contextTemplate = product.getContextTemplate();
if (contextTemplate.endsWith("/" + APIConstants.VERSION_PLACEHOLDER)) {
//Remove the {version} part from the context template.
contextTemplate = contextTemplate.split(Pattern.quote("/" + APIConstants.VERSION_PLACEHOLDER))[0];
}
product.setContextTemplate(contextTemplate);

// Add to database
apiMgtDAO.addAPIProduct(product, product.getOrganization());

Expand All @@ -4200,13 +4208,6 @@ private static void validateAPIProductContextTemplate(APIProduct product) throws
"Cannot add API Product : " + product.getId() + " with unsupported context : "
+ contextTemplate);
}

//If the context template ends with {version} this means that the version will be at the end of the context.
if (contextTemplate.endsWith("/" + APIConstants.VERSION_PLACEHOLDER)) {
//Remove the {version} part from the context template.
contextTemplate = contextTemplate.split(Pattern.quote("/" + APIConstants.VERSION_PLACEHOLDER))[0];
}
product.setContextTemplate(contextTemplate);
}

private String calculateVersionTimestamp(String provider, String name, String version, String org)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,6 @@ public List<API> getAllApis(String organization, boolean isExpand) {
return apiList;
}



/*
* This method can be used to retrieve all the APIs of a given tesanat in the database
*
Expand Down Expand Up @@ -1224,6 +1222,7 @@ public API getAPIByContextAndVersion(String context, String version, String depl
} else {
api.setPolicy(null);
}
return api;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
* Copyright WSO2 Inc.
* Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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
* Licensed 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
* 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.
* 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 org.wso2.carbon.apimgt.impl.utils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void changeLifecycle(String user, APIProvider apiProvider, String
targetStatus = LCManagerFactory.getInstance().getLCManager().getStateForTransition(action);

// Update lifecycle state in the registry
UpdateLifeCycleState(apiProvider, orgId, apiTypeWrapper, checklist, targetStatus, currentStatus);
updateLifeCycleState(apiProvider, orgId, apiTypeWrapper, checklist, targetStatus, currentStatus);

//Sending Notifications to existing subscribers
if (APIConstants.PUBLISHED.equals(targetStatus)) {
Expand Down Expand Up @@ -100,7 +100,7 @@ public static void changeLifecycle(String user, APIProvider apiProvider, String
}
}

private static void UpdateLifeCycleState(APIProvider apiProvider, String orgId, ApiTypeWrapper apiTypeWrapper,
private static void updateLifeCycleState(APIProvider apiProvider, String orgId, ApiTypeWrapper apiTypeWrapper,
Map<String, Boolean> checklist, String targetStatus, String currentStatus) throws APIManagementException {
if (!apiTypeWrapper.isAPIProduct()) {
API api = apiTypeWrapper.getApi();
Expand Down

0 comments on commit 342208f

Please sign in to comment.