use of org.wso2.carbon.apimgt.keymgt.model.entity.SubscriptionList in project carbon-apimgt by wso2.
the class APISubscriptionDAOImpl method createSubscriptionValidationDataFromResultSet.
private List<SubscriptionValidationData> createSubscriptionValidationDataFromResultSet(ResultSet rs) throws APIMgtDAOException {
List<SubscriptionValidationData> subscriptionList = new ArrayList<>();
if (rs == null) {
return new ArrayList<>();
}
try {
while (rs.next()) {
SubscriptionValidationData subValidationData = new SubscriptionValidationData(rs.getString("API_CONTEXT"), rs.getString("API_VERSION"), rs.getString("CLIENT_ID"));
subValidationData.setSubscriptionPolicy(rs.getString("SUBS_POLICY"));
subValidationData.setApiName(rs.getString("API_NAME"));
subValidationData.setApiProvider(rs.getString("API_PROVIDER"));
subValidationData.setKeyEnvType(rs.getString("KEY_ENV_TYPE"));
subValidationData.setApplicationId(rs.getString("APP_ID"));
subValidationData.setStatus(rs.getString("SUB_STATUS"));
subscriptionList.add(subValidationData);
}
} catch (SQLException e) {
throw new APIMgtDAOException(DAOUtil.DAO_ERROR_PREFIX + "creating subscription validation data", e);
}
return subscriptionList;
}
use of org.wso2.carbon.apimgt.keymgt.model.entity.SubscriptionList in project carbon-apimgt by wso2.
the class APIPublisherImpl method getSubscribersByAPIId.
@Override
public Set<String> getSubscribersByAPIId(String apiId) throws APIManagementException {
List<Subscription> subscriptionList = new ArrayList();
Set<String> subscriberList = new HashSet<>();
if (StringUtils.isNotEmpty(apiId)) {
subscriptionList = getSubscriptionsByAPI(apiId);
}
for (Subscription listItem : subscriptionList) {
subscriberList.add(listItem.getApplication().getCreatedUser());
}
return subscriberList;
}
use of org.wso2.carbon.apimgt.keymgt.model.entity.SubscriptionList in project carbon-apimgt by wso2.
the class MappingUtil method fromSubscriptionListToDTO.
/**
* Converts Subscription model into SubscriptionListDTO object
*
* @param subscriptionList list of subscriptions
* @param limit no of items to return
* @param offset value to offset
* @return SubscriptionListDTO containing subscriptions
*/
public static SubscriptionListDTO fromSubscriptionListToDTO(List<Subscription> subscriptionList, Integer limit, Integer offset) {
SubscriptionListDTO subscriptionListDTO = new SubscriptionListDTO();
for (Subscription subscription : subscriptionList) {
subscriptionListDTO.addListItem(fromSubscription(subscription));
}
// TODO need to change when pagination implementation goes on
subscriptionListDTO.count(subscriptionList.size());
return subscriptionListDTO;
}
Aggregations