static void processEntityView(JSONObject entity, DbContext ctx) { ViewEntityModel viewModel = ctx.currentVersion() .newViewModel( entity.getString("name"), !entity.has("render") || entity.getBoolean("render")); viewModel.setRootModel(ctx.getModel(entity.getString("rootModel"))); viewModel.setRootAlias(entity.getString("rootAlias")); if (entity.has("groupBy")) viewModel.setGroupBy(entity.getString("groupBy")); EntityModelVersion v = viewModel.currentVersion(); if (entity.has("models")) { JSONArray models = entity.getJSONArray("models"); // add the models for (int m = 0; m < models.length(); m++) { JSONObject child = models.getJSONObject(m); EntityModel childModel = ctx.getModel(child.getString("name")); ViewEntityModel.Relationship relationship = ViewEntityModel.Relationship.valueOf(child.getString("type")); String alias = child.has("alias") ? child.getString("alias") : child.getString("name"); viewModel.addModel(childModel, relationship, alias, child.getString("selection")); } } // process model properties processViewModel(ctx, entity, viewModel, v); }