public String getView(String entityName, String viewName) { MetaClass metaClass = restControllersUtils.getMetaClass(entityName); View view = viewRepository.findView(metaClass, viewName); if (view == null) { throw new RestAPIException("View not found", String.format("View %s for metaClass %s not found", viewName, entityName), HttpStatus.NOT_FOUND); } return viewSerializationAPI.toJson(view); }
protected Entity loadEntityInstance(EntityLoadInfo info) { if (info.isNewEntity()) { return metadata.create(info.getMetaClass()); } //noinspection unchecked LoadContext<Entity> ctx = new LoadContext(info.getMetaClass()).setId(info.getId()); if (info.getViewName() != null) { View view = viewRepository.findView(info.getMetaClass(), info.getViewName()); if (view != null) { ctx.setView(view); } else { log.warn("Unable to find view \"{}\" for entity \"{}\"", info.getViewName(), info.getMetaClass()); } } Entity entity; try { entity = dataService.load(ctx); } catch (Exception e) { log.warn("Unable to load item: {}", info, e); return null; } return entity; }
); view = metadata.getViewRepository().findView(getMetaClass(), property.getView().getName());
View reportEditView = viewRepository.findView(savedReport.getMetaClass(), "report.edit"); return dataManager.reload(savedReport, reportEditView, savedReport.getMetaClass(), true);