use of io.gravitee.management.model.PlanEntity in project gravitee-management-rest-api by gravitee-io.
the class SubscriptionsResource method convert.
private Subscription convert(SubscriptionEntity subscriptionEntity) {
Subscription subscription = new Subscription();
subscription.setId(subscriptionEntity.getId());
subscription.setCreatedAt(subscriptionEntity.getCreatedAt());
subscription.setUpdatedAt(subscriptionEntity.getUpdatedAt());
subscription.setStartingAt(subscriptionEntity.getStartingAt());
subscription.setEndingAt(subscriptionEntity.getEndingAt());
subscription.setProcessedAt(subscriptionEntity.getProcessedAt());
subscription.setProcessedBy(subscriptionEntity.getProcessedBy());
subscription.setReason(subscriptionEntity.getReason());
subscription.setStatus(subscriptionEntity.getStatus());
ApplicationEntity application = applicationService.findById(subscriptionEntity.getApplication());
subscription.setApplication(new Subscription.Application(application.getId(), application.getName(), application.getType(), new Subscription.User(application.getPrimaryOwner().getId(), application.getPrimaryOwner().getDisplayName())));
PlanEntity plan = planService.findById(subscriptionEntity.getPlan());
subscription.setPlan(new Subscription.Plan(plan.getId(), plan.getName()));
subscription.setClosedAt(subscriptionEntity.getClosedAt());
return subscription;
}
use of io.gravitee.management.model.PlanEntity in project gravitee-management-rest-api by gravitee-io.
the class AnalyticsServiceImpl method getPlanMetadata.
private Map<String, String> getPlanMetadata(String plan) {
Map<String, String> metadata = new HashMap<>();
try {
PlanEntity planEntity = planService.findById(plan);
metadata.put("name", planEntity.getName());
} catch (PlanNotFoundException anfe) {
metadata.put("deleted", "true");
}
return metadata;
}
use of io.gravitee.management.model.PlanEntity in project gravitee-management-rest-api by gravitee-io.
the class PlanService_FindByIdTest method shouldFindById.
@Test
public void shouldFindById() throws TechnicalException {
when(plan.getType()).thenReturn(Plan.PlanType.API);
when(plan.getValidation()).thenReturn(Plan.PlanValidationType.AUTO);
when(planRepository.findById(PLAN_ID)).thenReturn(Optional.of(plan));
final PlanEntity planEntity = planService.findById(PLAN_ID);
assertNotNull(planEntity);
}
Aggregations