use of org.wso2.carbon.humantask.client.api.types in project carbon-apimgt by wso2.
the class ServiceReferenceHolder method getAPIMAppConfiguration.
public APIMAppConfigurations getAPIMAppConfiguration() {
try {
if (configProvider != null) {
config = configProvider.getConfigurationObject(APIMAppConfigurations.class);
} else {
log.error("Configuration provider is null");
}
} catch (ConfigurationException e) {
log.error("Error getting config : org.wso2.carbon.apimgt.rest.api.authenticator.internal.APIMAppConfiguration", e);
}
if (config == null) {
config = new APIMAppConfigurations();
log.info("Setting default configurations...");
}
return config;
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-apimgt by wso2.
the class APIGatewayPublisherImplTestCase method testGetContainerBasedGatewayGeneratorForException.
@Test(expected = ContainerBasedGatewayException.class)
public void testGetContainerBasedGatewayGeneratorForException() throws ContainerBasedGatewayException, ConfigurationException {
APIGatewayPublisherImpl apiGatewayPublisher = new APIGatewayPublisherImpl();
ConfigProvider configProvider = Mockito.mock(ConfigProvider.class);
ContainerBasedGatewayConfiguration containerBasedGatewayConfig = new ContainerBasedGatewayConfiguration();
containerBasedGatewayConfig.setImplClass("org.wso2.invalid.class.name");
Mockito.when(configProvider.getConfigurationObject(ContainerBasedGatewayConfiguration.class)).thenReturn(containerBasedGatewayConfig);
ContainerBasedGatewayConfigBuilder.build(configProvider);
ContainerBasedGatewayGenerator containerBasedGatewayGenerator = apiGatewayPublisher.getContainerBasedGatewayGenerator();
Assert.assertNotNull(containerBasedGatewayGenerator);
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-apimgt by wso2.
the class ApplicationsApiServiceImpl method applicationsGet.
@Override
public Response applicationsGet(String accept, Request request) throws NotFoundException {
try {
APIMgtAdminService apiMgtAdminService = APIManagerFactory.getInstance().getAPIMgtAdminService();
List<Application> applicationList = apiMgtAdminService.getAllApplications();
ApplicationListDTO applicationListDTO = new ApplicationListDTO();
applicationListDTO.setList(MappingUtil.convertToApplicationDtoList(applicationList));
return Response.ok(applicationListDTO).build();
} catch (APIManagementException e) {
String errorMessage = "Error while retrieving Applications.";
HashMap<String, String> paramList = new HashMap<String, String>();
org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler(), paramList);
log.error(errorMessage, e);
return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
}
}
use of org.wso2.carbon.humantask.client.api.types in project ballerina by ballerina-lang.
the class SwaggerConverterUtils method getTopLevelNodeFromBallerinaFile.
/**
* Generate ballerina fine from the String definition.
*
* @param bFile ballerina string definition
* @return ballerina file created from ballerina string definition
* @throws IOException IO exception
*/
public static BLangCompilationUnit getTopLevelNodeFromBallerinaFile(BFile bFile) throws IOException {
String filePath = bFile.getFilePath();
String fileName = bFile.getFileName();
String content = bFile.getContent();
Path fileRoot = Paths.get(filePath);
org.wso2.ballerinalang.compiler.tree.BLangPackage model;
// Sometimes we are getting Ballerina content without a file in the file-system.
if (!Files.exists(Paths.get(filePath, fileName))) {
BallerinaFile ballerinaFile = ParserUtils.getBallerinaFileForContent(fileRoot, fileName, content, CompilerPhase.CODE_ANALYZE);
model = ballerinaFile.getBLangPackage();
} else {
BallerinaFile ballerinaFile = ParserUtils.getBallerinaFile(filePath, fileName);
model = ballerinaFile.getBLangPackage();
}
final Map<String, ModelPackage> modelPackage = new HashMap<>();
ParserUtils.loadPackageMap(Constants.CURRENT_PACKAGE_NAME, model, modelPackage);
Optional<BLangCompilationUnit> compilationUnit = model.getCompilationUnits().stream().filter(compUnit -> fileName.equals(compUnit.getName())).findFirst();
return compilationUnit.orElse(null);
}
use of org.wso2.carbon.humantask.client.api.types in project ballerina by ballerina-lang.
the class ServiceProtoUtils method getResponseMessage.
private static Message getResponseMessage(ResourceNode resourceNode) throws GrpcServerException {
org.wso2.ballerinalang.compiler.semantics.model.types.BType responseType;
BLangInvocation sendExpression = getInvocationExpression(resourceNode.getBody());
if (sendExpression != null) {
responseType = getReturnType(sendExpression);
} else {
// if compiler plugin could not find
responseType = new BNullType();
}
return responseType != null ? generateMessageDefinition(responseType) : null;
}
Aggregations