Search in sources :

Example 1 with ApiPlanSummaryBean

use of io.apiman.manager.api.beans.summary.ApiPlanSummaryBean in project apiman by apiman.

the class JpaStorage method getApiVersionPlans.

/**
 * {@inheritDoc}
 */
@Override
public // TODO(msavy): rewrite using projection
List<ApiPlanSummaryBean> getApiVersionPlans(String organizationId, String apiId, String version) throws StorageException {
    List<ApiPlanSummaryBean> plans = new ArrayList<>();
    ApiVersionBean versionBean = getApiVersion(organizationId, apiId, version);
    Set<ApiPlanBean> apiPlans = versionBean.getPlans();
    if (apiPlans != null) {
        for (ApiPlanBean spb : apiPlans) {
            PlanVersionBean planVersion = getPlanVersion(organizationId, spb.getPlanId(), spb.getVersion());
            ApiPlanSummaryBean summary = new ApiPlanSummaryBean();
            summary.setPlanId(planVersion.getPlan().getId());
            summary.setPlanName(planVersion.getPlan().getName());
            summary.setPlanDescription(planVersion.getPlan().getDescription());
            summary.setVersion(spb.getVersion());
            summary.setRequiresApproval(spb.getRequiresApproval());
            summary.setDiscoverability(spb.getDiscoverability());
            plans.add(summary);
        }
    }
    return plans;
}
Also used : ApiPlanSummaryBean(io.apiman.manager.api.beans.summary.ApiPlanSummaryBean) ApiPlanBean(io.apiman.manager.api.beans.apis.ApiPlanBean) ArrayList(java.util.ArrayList) ApiVersionBean(io.apiman.manager.api.beans.apis.ApiVersionBean) PlanVersionBean(io.apiman.manager.api.beans.plans.PlanVersionBean)

Example 2 with ApiPlanSummaryBean

use of io.apiman.manager.api.beans.summary.ApiPlanSummaryBean in project apiman by apiman.

the class EsStorage method getApiVersionPlans.

/**
 * @see io.apiman.manager.api.core.IStorageQuery#getApiVersionPlans(java.lang.String, java.lang.String, java.lang.String)
 */
@Override
public List<ApiPlanSummaryBean> getApiVersionPlans(String organizationId, String apiId, String version) throws StorageException {
    List<ApiPlanSummaryBean> rval = new ArrayList<>();
    ApiVersionBean versionBean = getApiVersion(organizationId, apiId, version);
    if (versionBean != null) {
        Set<ApiPlanBean> plans = versionBean.getPlans();
        if (plans != null) {
            for (ApiPlanBean spb : plans) {
                PlanBean planBean = getPlan(organizationId, spb.getPlanId());
                ApiPlanSummaryBean plan = new ApiPlanSummaryBean();
                plan.setPlanId(spb.getPlanId());
                plan.setVersion(spb.getVersion());
                plan.setPlanName(planBean.getName());
                plan.setPlanDescription(planBean.getDescription());
                rval.add(plan);
            }
        }
    }
    return rval;
}
Also used : ApiPlanSummaryBean(io.apiman.manager.api.beans.summary.ApiPlanSummaryBean) ApiPlanBean(io.apiman.manager.api.beans.apis.ApiPlanBean) ArrayList(java.util.ArrayList) PlanBean(io.apiman.manager.api.beans.plans.PlanBean) ApiPlanBean(io.apiman.manager.api.beans.apis.ApiPlanBean) ApiVersionBean(io.apiman.manager.api.beans.apis.ApiVersionBean)

Aggregations

ApiPlanBean (io.apiman.manager.api.beans.apis.ApiPlanBean)2 ApiVersionBean (io.apiman.manager.api.beans.apis.ApiVersionBean)2 ApiPlanSummaryBean (io.apiman.manager.api.beans.summary.ApiPlanSummaryBean)2 ArrayList (java.util.ArrayList)2 PlanBean (io.apiman.manager.api.beans.plans.PlanBean)1 PlanVersionBean (io.apiman.manager.api.beans.plans.PlanVersionBean)1