use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.SettingsDTO in project carbon-apimgt by wso2.
the class SettingsApiServiceImpl method getSettings.
@Override
public Response getSettings(MessageContext messageContext) {
try {
String username = RestApiCommonUtil.getLoggedInUsername();
boolean isUserAvailable = false;
if (!APIConstants.WSO2_ANONYMOUS_USER.equalsIgnoreCase(username)) {
isUserAvailable = true;
}
SettingsMappingUtil settingsMappingUtil = new SettingsMappingUtil();
String organization = RestApiUtil.getValidatedOrganization(messageContext);
SettingsDTO settingsDTO = settingsMappingUtil.fromSettingstoDTO(isUserAvailable, organization);
settingsDTO.setScopes(GetScopeList());
return Response.ok().entity(settingsDTO).build();
} catch (APIManagementException | IOException e) {
String errorMessage = "Error while retrieving Publisher Settings";
RestApiUtil.handleInternalServerError(errorMessage, e, log);
}
return null;
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.SettingsDTO in project carbon-apimgt by wso2.
the class SettingsApiServiceImpl method getSettings.
public Response getSettings(MessageContext messageContext) {
try {
SettingsMappingUtil settingsMappingUtil = new SettingsMappingUtil();
SettingsDTO settingsDTO = settingsMappingUtil.fromSettingsToDTO();
return Response.ok().entity(settingsDTO).build();
} catch (APIManagementException e) {
String errorMessage = "Error while retrieving Service Catalog Settings";
RestApiUtil.handleInternalServerError(errorMessage, e, log);
}
return null;
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.SettingsDTO in project carbon-apimgt by wso2.
the class SettingsApiServiceImpl method settingsGet.
@Override
public Response settingsGet(String xWSO2Tenant, MessageContext messageContext) throws APIManagementException {
try {
String username = RestApiCommonUtil.getLoggedInUsername();
APIConsumer apiConsumer = RestApiCommonUtil.getConsumer(username);
String requestedTenantDomain = RestApiUtil.getRequestedTenantDomain(xWSO2Tenant);
boolean monetizationEnabled = apiConsumer.isMonetizationEnabled(requestedTenantDomain);
boolean recommendationEnabled = apiConsumer.isRecommendationEnabled(requestedTenantDomain);
boolean anonymousEnabled = RestApiUtil.isDevPortalAnonymousEnabled(requestedTenantDomain);
boolean isUserAvailable = false;
if (!APIConstants.WSO2_ANONYMOUS_USER.equalsIgnoreCase(username)) {
isUserAvailable = true;
}
String organization = RestApiUtil.getValidatedOrganization(messageContext);
SettingsMappingUtil settingsMappingUtil = new SettingsMappingUtil();
SettingsDTO settingsDTO = settingsMappingUtil.fromSettingstoDTO(isUserAvailable, monetizationEnabled, recommendationEnabled, anonymousEnabled, organization);
return Response.ok().entity(settingsDTO).build();
} catch (APIManagementException e) {
String errorMessage = "Error while retrieving Store Settings";
RestApiUtil.handleInternalServerError(errorMessage, e, log);
}
return null;
}
Aggregations