@Override public MetaClass getEntityMetaClass() { return container.getEntityMetaClass(); }
@Override public MetaClass getEntityMetaClass() { return container.getEntityMetaClass(); }
@Override public MetaClass getMetaClass() { return dataContainer.getEntityMetaClass(); }
@Override public MetaClass getEntityMetaClass() { return container.getEntityMetaClass(); }
@Override public MetaClass getEntityMetaClass() { return container.getEntityMetaClass(); }
@Override public MetaClass getMetaClass() { return loader.getContainer().getEntityMetaClass(); }
/** * Returns the entity meta-class. */ protected Class<T> getEntityClass() { return getBrowseContainer().getEntityMetaClass().getJavaClass(); }
@SuppressWarnings("unchecked") protected void sortInMemory(Sort sort) { if (sort.getOrders().isEmpty()) { return; } List list = new ArrayList(container.getItems()); list.sort(createComparator(sort, container.getEntityMetaClass())); setItemsToContainer(list); }
protected View resolveView() { View view = this.view; if (view == null && viewName != null) { view = getViewRepository().getView(container.getEntityMetaClass(), viewName); } if (view == null) { view = container.getView(); } return view; }
protected void doGroupSort(Sort sort) { if (hasGroups()) { Sort.Order order = sort.getOrders().get(0); MetaPropertyPath propertyPath = container.getEntityMetaClass().getPropertyPath(order.getProperty()); if (propertyPath == null) throw new IllegalStateException("Cannot create property path from " + order.getProperty());
protected MetaClass getFilterMetaClass(Filter filter) { if (filter.getDataLoader() != null && filter.getDataLoader().getContainer() != null) { return filter.getDataLoader().getContainer().getEntityMetaClass(); } if (filter.getDatasource() != null) { return filter.getDatasource().getMetaClass(); } throw new IllegalStateException("No MetaClass related to a filter"); }
protected Collection<MetaPropertyPath> getAutowiredProperties(EntityTableItems<E> entityTableSource) { if (entityTableSource instanceof ContainerDataUnit) { CollectionContainer container = ((ContainerDataUnit) entityTableSource).getContainer(); return container.getView() != null ? // if a view is specified - use view properties metadataTools.getViewPropertyPaths(container.getView(), container.getEntityMetaClass()) : // otherwise use all properties from meta-class metadataTools.getPropertyPaths(container.getEntityMetaClass()); } if (entityTableSource instanceof DatasourceDataUnit) { CollectionDatasource datasource = ((DatasourceDataUnit) entityTableSource).getDatasource(); return datasource.getView() != null ? // if a view is specified - use view properties metadataTools.getViewPropertyPaths(datasource.getView(), datasource.getMetaClass()) : // otherwise use all properties from meta-class metadataTools.getPropertyPaths(datasource.getMetaClass()); } return Collections.emptyList(); }
protected Collection<MetaPropertyPath> getAutowiredProperties(EntityDataGridItems<E> entityTableSource) { if (entityTableSource instanceof ContainerDataUnit) { CollectionContainer container = ((ContainerDataUnit) entityTableSource).getContainer(); return container.getView() != null ? // if a view is specified - use view properties metadataTools.getViewPropertyPaths(container.getView(), container.getEntityMetaClass()) : // otherwise use all properties from meta-class metadataTools.getPropertyPaths(container.getEntityMetaClass()); } if (entityTableSource instanceof DatasourceDataUnit) { CollectionDatasource datasource = ((DatasourceDataUnit) entityTableSource).getDatasource(); return datasource.getView() != null ? // if a view is specified - use view properties metadataTools.getViewPropertyPaths(datasource.getView(), datasource.getMetaClass()) : // otherwise use all properties from meta-class metadataTools.getPropertyPaths(datasource.getMetaClass()); } return Collections.emptyList(); }
protected <E extends Entity> void initializeNestedEntity(E entity, Nested container) { InstanceContainer masterContainer = container.getMaster(); String property = container.getProperty(); MetaClass masterMetaClass = masterContainer.getEntityMetaClass(); MetaProperty metaProperty = masterMetaClass.getPropertyNN(property); MetaProperty inverseProp = metaProperty.getInverse(); if (inverseProp != null) { Class<?> inversePropClass = extendedEntities.getEffectiveClass(inverseProp.getDomain()); Class<?> containerEntityClass = extendedEntities.getEffectiveClass(((CollectionContainer) container).getEntityMetaClass()); if (inversePropClass.isAssignableFrom(containerEntityClass)) { entity.setValue(inverseProp.getName(), masterContainer.getItem()); } } }
@SuppressWarnings("unchecked") protected <E extends Entity> void excludeItems(RemoveBuilder<E> builder, List<E> selectedItems) { CollectionContainer<E> container = getCollectionContainer(builder); if (!(container instanceof Nested)) { throw new IllegalArgumentException("Exclude action supports only Nested containers"); } InstanceContainer masterDc = ((Nested) container).getMaster(); String property = ((Nested) container).getProperty(); Entity masterItem = masterDc.getItem(); MetaProperty metaProperty = masterItem.getMetaClass().getPropertyNN(property); MetaProperty inverseMetaProperty = metaProperty.getInverse(); if (inverseMetaProperty != null && !inverseMetaProperty.getRange().getCardinality().isMany()) { Class inversePropClass = extendedEntities.getEffectiveClass(inverseMetaProperty.getDomain()); Class dcClass = extendedEntities.getEffectiveClass(container.getEntityMetaClass()); if (inversePropClass.isAssignableFrom(dcClass)) { // update reference for One-To-Many for (Entity item : selectedItems) { item.setValue(inverseMetaProperty.getName(), null); } } } container.getMutableItems().removeAll(selectedItems); focusListComponent(builder); }
Class<?> dcClass = extendedEntities.getEffectiveClass(collectionDc.getEntityMetaClass());
throw new GuiDevelopmentException("Not a CollectionContainer: " + containerId, context.getCurrentFrameId()); metaClass = collectionContainer.getEntityMetaClass(); if (collectionContainer instanceof HasLoader) { dataLoader = ((HasLoader) collectionContainer).getLoader();
@Override public LoadContext<E> createLoadContext() { LoadContext<E> loadContext = LoadContext.create(container.getEntityMetaClass().getJavaClass()); LoadContext.Query query = loadContext.setQueryString(this.query); query.setCondition(condition); query.setSort(sort); query.setParameters(parameters); query.setCacheable(cacheable); if (firstResult > 0) query.setFirstResult(firstResult); if (maxResults < Integer.MAX_VALUE) query.setMaxResults(maxResults); loadContext.setView(resolveView()); loadContext.setSoftDeletion(softDeletion); loadContext.setLoadDynamicAttributes(loadDynamicAttributes); return loadContext; }
throw new GuiDevelopmentException("Not a CollectionContainer: " + containerId, context.getCurrentFrameId()); metaClass = collectionContainer.getEntityMetaClass(); if (collectionContainer instanceof HasLoader) { dataLoader = ((HasLoader) collectionContainer).getLoader();
protected void printAll() { MetaClass metaClass; LoadContext loadContext; if (listComponent.getItems() instanceof ContainerDataUnit) { ContainerDataUnit unit = (ContainerDataUnit) listComponent.getItems(); CollectionContainer container = unit.getContainer(); CollectionLoader loader = (CollectionLoader) ((HasLoader) unit.getContainer()).getLoader(); metaClass = container.getEntityMetaClass(); loadContext = loader.createLoadContext(); } else { CollectionDatasource ds = listComponent.getDatasource(); metaClass = ds.getMetaClass(); loadContext = ds.getCompiledLoadContext(); } ParameterPrototype parameterPrototype = new ParameterPrototype(metaClass.getName()); parameterPrototype.setMetaClassName(metaClass.getName()); LoadContext.Query query = loadContext.getQuery(); parameterPrototype.setQueryString(query.getQueryString()); parameterPrototype.setQueryParams(query.getParameters()); parameterPrototype.setViewName(loadContext.getView().getName()); Window window = ComponentsHelper.getWindowNN(listComponent); openRunReportScreen(window.getFrameOwner(), parameterPrototype, metaClass); } }