use of org.wso2.carbon.apimgt.api.model.APIRevisionDeployment in project carbon-apimgt by wso2.
the class SolaceNotifierUtils method checkWhetherAPIDeployedToSolaceUsingRevision.
/**
* Check whether the given API is already deployed in the Solace using revision
*
* @param api Name of the API
* @return returns true if the given API is already deployed
* @throws APIManagementException If an error occurs when checking API product availability
*/
public static boolean checkWhetherAPIDeployedToSolaceUsingRevision(API api) throws APIManagementException {
apiMgtDAO = ApiMgtDAO.getInstance();
Map<String, Environment> gatewayEnvironments = APIUtil.getReadOnlyGatewayEnvironments();
List<APIRevisionDeployment> deployments = apiMgtDAO.getAPIRevisionDeploymentsByApiUUID(api.getUuid());
for (APIRevisionDeployment deployment : deployments) {
if (deployment.isDisplayOnDevportal()) {
String environmentName = deployment.getDeployment();
if (gatewayEnvironments.containsKey(environmentName)) {
Environment deployedEnvironment = gatewayEnvironments.get(environmentName);
if (SolaceConstants.SOLACE_ENVIRONMENT.equalsIgnoreCase(deployedEnvironment.getProvider())) {
return true;
}
}
}
}
return false;
}
use of org.wso2.carbon.apimgt.api.model.APIRevisionDeployment in project carbon-apimgt by wso2.
the class SolaceNotifierUtils method getDeployedSolaceEnvironmentsFromRevisionDeployments.
/**
* Get deployed solace environment name form the revision deployments
*
* @param api Name of the API
* @return List<ThirdPartyEnvironment> List of deployed solace environments
* @throws APIManagementException is error occurs when getting the list of solace environments
*/
public static List<Environment> getDeployedSolaceEnvironmentsFromRevisionDeployments(API api) throws APIManagementException {
apiMgtDAO = ApiMgtDAO.getInstance();
List<Environment> deployedSolaceEnvironments = new ArrayList<>();
Map<String, Environment> gatewayEnvironments = APIUtil.getReadOnlyGatewayEnvironments();
List<APIRevisionDeployment> deployments = apiMgtDAO.getAPIRevisionDeploymentsByApiUUID(api.getUuid());
for (APIRevisionDeployment deployment : deployments) {
String environmentName = deployment.getDeployment();
if (gatewayEnvironments.containsKey(environmentName)) {
Environment deployedEnvironment = gatewayEnvironments.get(environmentName);
if (SolaceConstants.SOLACE_ENVIRONMENT.equalsIgnoreCase(deployedEnvironment.getProvider())) {
deployedSolaceEnvironments.add(deployedEnvironment);
}
}
}
return deployedSolaceEnvironments;
}
use of org.wso2.carbon.apimgt.api.model.APIRevisionDeployment in project carbon-apimgt by wso2.
the class SolaceNotifierUtils method getThirdPartySolaceBrokerEnvironmentNameOfAPIDeployment.
/**
* Get third party Solace broker environment Name for API deployment
*
* @param api Name of the API
* @return String of the name of environment in Solace broker
* @throws APIManagementException is error occurs when getting the name of the environment name
*/
private String getThirdPartySolaceBrokerEnvironmentNameOfAPIDeployment(API api) throws APIManagementException {
apiMgtDAO = ApiMgtDAO.getInstance();
Map<String, Environment> gatewayEnvironments = APIUtil.getReadOnlyGatewayEnvironments();
List<APIRevisionDeployment> deployments = apiMgtDAO.getAPIRevisionDeploymentsByApiUUID(api.getUuid());
for (APIRevisionDeployment deployment : deployments) {
String environmentName = deployment.getDeployment();
if (gatewayEnvironments.containsKey(environmentName)) {
Environment deployedEnvironment = gatewayEnvironments.get(environmentName);
if (SolaceConstants.SOLACE_ENVIRONMENT.equalsIgnoreCase(deployedEnvironment.getProvider())) {
return environmentName;
}
}
}
return null;
}
Aggregations