use of models.datatable.ApprovalsDataTable.ApprovalRequestInfo in project coprhd-controller by CoprHD.
the class Approvals method approvalsJson.
public static void approvalsJson() {
ViPRCatalogClient2 catalog = getCatalogClient();
Map<URI, OrderRestRep> orders = Maps.newHashMap();
Map<URI, CatalogServiceRestRep> catalogServices = Maps.newHashMap();
List<ApprovalRequestInfo> approvalRequestInfos = Lists.newArrayList();
List<ApprovalRestRep> approvals = catalog.approvals().getByUserTenant();
for (ApprovalRestRep approval : approvals) {
OrderRestRep order = null;
if (approval.getOrder() != null) {
if (!orders.keySet().contains(approval.getOrder().getId())) {
order = getOrder(approval.getOrder());
if (order != null) {
orders.put(order.getId(), order);
}
} else {
order = orders.get(approval.getOrder().getId());
}
}
CatalogServiceRestRep catalogService = null;
if (order != null && order.getCatalogService() != null) {
if (!catalogServices.keySet().contains(order.getCatalogService().getId())) {
catalogService = getCatalogService(order.getCatalogService());
if (catalogService != null) {
catalogServices.put(catalogService.getId(), catalogService);
}
} else {
catalogService = catalogServices.get(order.getCatalogService().getId());
}
}
approvalRequestInfos.add(new ApprovalRequestInfo(approval, order, catalogService));
}
renderJSON(DataTablesSupport.createJSON(approvalRequestInfos, params));
}
Aggregations