use of com.haulmont.cuba.core.global.ViewProperty in project cuba by cuba-platform.
the class ViewHelper method intersectViews.
public static View intersectViews(View first, View second) {
if (first == null)
throw new IllegalArgumentException("View is null");
if (second == null)
throw new IllegalArgumentException("View is null");
View resultView = new View(first.getEntityClass());
Collection<ViewProperty> firstProps = first.getProperties();
for (ViewProperty firstProperty : firstProps) {
if (second.containsProperty(firstProperty.getName())) {
View resultPropView = null;
ViewProperty secondProperty = second.getProperty(firstProperty.getName());
if ((firstProperty.getView() != null) && (secondProperty.getView() != null)) {
resultPropView = intersectViews(firstProperty.getView(), secondProperty.getView());
}
resultView.addProperty(firstProperty.getName(), resultPropView);
}
}
return resultView;
}
use of com.haulmont.cuba.core.global.ViewProperty in project cuba by cuba-platform.
the class AbstractViewRepositoryTest method intersectPropertiesExtendedViewsTwoLevel.
@Test
public void intersectPropertiesExtendedViewsTwoLevel() {
View view = metadata.getViewRepository().getView(testMasterEntity, "intersectViewTwo");
assertTrue(view.containsProperty("detail"));
ViewProperty detail = view.getProperty("detail");
assertTrue(detail.getView().containsProperty("embeddable"));
assertTrue(detail.getView().containsProperty("parts"));
}
Aggregations