use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationKeyListDTO in project carbon-apimgt by wso2.
the class ApplicationsApiServiceImpl method applicationsApplicationIdOauthKeysGet.
@Override
public Response applicationsApplicationIdOauthKeysGet(String applicationId, String xWso2Tenant, MessageContext messageContext) throws APIManagementException {
String organization = RestApiUtil.getValidatedOrganization(messageContext);
Set<APIKey> applicationKeys = getApplicationKeys(applicationId, organization);
List<ApplicationKeyDTO> keyDTOList = new ArrayList<>();
ApplicationKeyListDTO applicationKeyListDTO = new ApplicationKeyListDTO();
applicationKeyListDTO.setCount(0);
if (applicationKeys != null) {
for (APIKey apiKey : applicationKeys) {
ApplicationKeyDTO appKeyDTO = ApplicationKeyMappingUtil.fromApplicationKeyToDTO(apiKey);
keyDTOList.add(appKeyDTO);
}
applicationKeyListDTO.setList(keyDTOList);
applicationKeyListDTO.setCount(keyDTOList.size());
}
return Response.ok().entity(applicationKeyListDTO).build();
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationKeyListDTO in project carbon-apimgt by wso2.
the class ApplicationsApiServiceImpl method applicationsApplicationIdKeysGet.
/**
* Retrieve all keys of an application
*
* @param applicationId Application Id
* @return Application Key Information list
*/
@Override
public Response applicationsApplicationIdKeysGet(String applicationId, MessageContext messageContext) {
Set<APIKey> applicationKeys = getApplicationKeys(applicationId);
List<ApplicationKeyDTO> keyDTOList = new ArrayList<>();
ApplicationKeyListDTO applicationKeyListDTO = new ApplicationKeyListDTO();
applicationKeyListDTO.setCount(0);
if (applicationKeys != null) {
for (APIKey apiKey : applicationKeys) {
ApplicationKeyDTO appKeyDTO = ApplicationKeyMappingUtil.fromApplicationKeyToDTO(apiKey);
keyDTOList.add(appKeyDTO);
}
applicationKeyListDTO.setList(keyDTOList);
applicationKeyListDTO.setCount(keyDTOList.size());
}
return Response.ok().entity(applicationKeyListDTO).build();
}
Aggregations