use of io.jmix.ui.screen.FrameOwner in project jmix by jmix-framework.
the class ScreensHelper method isEntityAvailable.
protected boolean isEntityAvailable(Element window, Class<? extends FrameOwner> controllerClass, Class entityClass, ScreenType filterScreenType, boolean useComplexSearch) {
Element dsContext = window.element("dsContext");
Element data = window.element("data");
if (dsContext == null && data == null) {
return false;
}
Element dataElement = data != null ? data : dsContext;
if (!useComplexSearch) {
String dataElementId = data != null ? getDataContainerId(window, controllerClass, filterScreenType) : getDatasourceId(window, filterScreenType);
if (StringUtils.isEmpty(dataElementId)) {
return false;
}
return isEntityAvailableInDataElement(entityClass, dataElement, dataElementId);
}
if (!checkWindowType(controllerClass, filterScreenType)) {
return false;
}
List<Element> dataElements = dataElement.elements();
List<String> dataElementIds = dataElements.stream().filter(de -> isEntityAvailableInDataElement(entityClass, de)).map(de -> de.attributeValue("id")).collect(Collectors.toList());
if (!ScreenType.BROWSER.equals(filterScreenType)) {
String editedEntityDataElementId = data != null ? resolveEditedEntityContainerId(controllerClass) : window.attributeValue("datasource");
dataElementIds.addAll(getDataElementsIdForComposition(dataElement, entityClass, editedEntityDataElementId));
}
return dataElementIds.size() > 0;
}
Aggregations