@Override public boolean isEntityAttrReadPermitted(MetaPropertyPath mpp) { MetaClass propertyMetaClass = metadata.getTools().getPropertyEnclosingMetaClass(mpp); return isEntityOpPermitted(propertyMetaClass, EntityOp.READ) && isEntityAttrPermitted(propertyMetaClass, mpp, EntityAttrAccess.VIEW); }
@Override public AbstractCondition createCondition() { OpManager opManager = AppBeans.get(OpManager.class); MetadataTools metadataTools = AppBeans.get(MetadataTools.class); PropertyCondition propertyCondition = new PropertyCondition(this, entityAlias); MetaPropertyPath propertyPath = datasourceMetaClass.getPropertyPath(name); if (propertyPath == null) { throw new IllegalStateException(String.format("Unable to find property '%s' in entity %s", name, datasourceMetaClass)); } MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(propertyPath); EnumSet<Op> ops = opManager.availableOps(propertyMetaClass, propertyPath.getMetaProperty()); propertyCondition.setOperator(ops.iterator().next()); return propertyCondition; }
MetaClass propertyMetaClass = metadata.getTools().getPropertyEnclosingMetaClass(propertyPath); String storeName = metadata.getTools().getStoreName(propertyMetaClass); if (!metadata.getTools().isLob(metaProperty) || supportsLobSortingAndFiltering(storeName)) {
@Override public boolean isEntityAttrUpdatePermitted(MetaPropertyPath mpp) { MetaClass propertyMetaClass = metadata.getTools().getPropertyEnclosingMetaClass(mpp); if (metadata.getTools().isEmbeddable(propertyMetaClass)) { return isEntityOpPermitted(propertyMetaClass, EntityOp.UPDATE) && isEntityAttrPermitted(propertyMetaClass, mpp, EntityAttrAccess.MODIFY); } return (isEntityOpPermitted(propertyMetaClass, EntityOp.CREATE) || isEntityOpPermitted(propertyMetaClass, EntityOp.UPDATE)) && isEntityAttrPermitted(propertyMetaClass, mpp, EntityAttrAccess.MODIFY); }
StringUtils.capitalize(categoryAttribute.getName()); } else { MetaClass propertyMetaClass = getMetadataTools().getPropertyEnclosingMetaClass(mpp); columnCaption = getMessageTools().getPropertyCaption(propertyMetaClass, propertyName);
StringUtils.capitalize(categoryAttribute.getName()); } else { MetaClass propertyMetaClass = getMetadataTools().getPropertyEnclosingMetaClass(column.getPropertyPath());
if (!range.isClass()) { MetaClass propertyMetaClass = metadata.getTools().getPropertyEnclosingMetaClass(propertyPath); String storeName = metadata.getTools().getStoreName(propertyMetaClass); if (!metadata.getTools().isLob(metaProperty)
MetaClass propertyEnclosingMetaClass = metadataTools.getPropertyEnclosingMetaClass(propertyPath);
protected void initBeanValidator(Field<?> component, MetaPropertyPath metaPropertyPath) { MetaProperty metaProperty = metaPropertyPath.getMetaProperty(); MetaClass propertyEnclosingMetaClass = metadataTools.getPropertyEnclosingMetaClass(metaPropertyPath); Class enclosingJavaClass = propertyEnclosingMetaClass.getJavaClass(); if (enclosingJavaClass != KeyValueEntity.class && !DynamicAttributesUtils.isDynamicAttribute(metaProperty)) { javax.validation.Validator validator = beanValidation.getValidator(); BeanDescriptor beanDescriptor = validator.getConstraintsForClass(enclosingJavaClass); if (beanDescriptor.isBeanConstrained()) { component.addValidator(beanLocator.getPrototype(BeanPropertyValidator.NAME, enclosingJavaClass, metaProperty.getName())); } } }
protected String getDefaultCaption(FieldGroup.FieldConfig fieldConfig, Datasource fieldDatasource) { String caption = fieldConfig.getCaption(); if (caption == null) { String propertyId = fieldConfig.getProperty(); MetaPropertyPath propertyPath = fieldDatasource != null ? fieldDatasource.getMetaClass().getPropertyPath(propertyId) : null; if (propertyPath != null) { MetaClass propertyMetaClass = getMetadataTools().getPropertyEnclosingMetaClass(propertyPath); String propertyName = propertyPath.getMetaProperty().getName(); caption = getMessageTools().getPropertyCaption(propertyMetaClass, propertyName); } } return caption; }
protected void addColumnInternal(ColumnImpl<E> column, int index) { Grid.Column<E, ?> gridColumn = component.addColumn( new EntityValueProvider<>(column.getPropertyPath())); columns.put(column.getId(), column); columnsOrder.add(index, column); final String caption = StringUtils.capitalize(column.getCaption() != null ? column.getCaption() : generateColumnCaption(column)); column.setCaption(caption); if (column.getOwner() == null) { column.setOwner(this); } MetaPropertyPath propertyPath = column.getPropertyPath(); if (propertyPath != null) { MetaProperty metaProperty = propertyPath.getMetaProperty(); MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(propertyPath); String storeName = metadataTools.getStoreName(propertyMetaClass); if (metadataTools.isLob(metaProperty) && !persistenceManagerClient.supportsLobSortingAndFiltering(storeName)) { column.setSortable(false); } } setupGridColumnProperties(gridColumn, column); component.setColumnOrder(getColumnOrder()); }
@Override protected Component createComponent() { OpManager opManager = AppBeans.get(OpManager.class); MetadataTools metadataTools = AppBeans.get(MetadataTools.class); componentsFactory = AppBeans.get(ComponentsFactory.class); popupButton = componentsFactory.createComponent(PopupButton.class); MetaClass metaClass = condition.getEntityMetaClass(); MetaPropertyPath propertyPath = metaClass.getPropertyPath(condition.getName()); if (propertyPath == null) { throw new IllegalStateException(String.format("Unable to find property '%s' in entity %s", condition.getName(), metaClass)); } MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(propertyPath); for (Op op : opManager.availableOps(propertyMetaClass, propertyPath.getMetaProperty())) { OperatorChangeAction operatorChangeAction = new OperatorChangeAction(op); popupButton.addAction(operatorChangeAction); } popupButton.setCaption(condition.getOperator().getLocCaption()); popupButton.setStyleName("condition-operation-button"); return popupButton; }
protected void setupAutowiredColumns(EntityDataGridItems<E> entityDataGridSource) { Collection<MetaPropertyPath> paths = getAutowiredProperties(entityDataGridSource); for (MetaPropertyPath metaPropertyPath : paths) { MetaProperty property = metaPropertyPath.getMetaProperty(); if (!property.getRange().getCardinality().isMany() && !metadataTools.isSystem(property)) { String propertyName = property.getName(); ColumnImpl<E> column = new ColumnImpl<>(propertyName, metaPropertyPath, this); MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(metaPropertyPath); column.setCaption(messageTools.getPropertyCaption(propertyMetaClass, propertyName)); addColumn(column); } } }
protected void setupAutowiredColumns(EntityTableItems<E> entityTableSource) { Collection<MetaPropertyPath> paths = getAutowiredProperties(entityTableSource); for (MetaPropertyPath metaPropertyPath : paths) { MetaProperty property = metaPropertyPath.getMetaProperty(); if (!property.getRange().getCardinality().isMany() && !metadataTools.isSystem(property)) { Table.Column<E> column = new Table.Column<>(metaPropertyPath); String propertyName = property.getName(); MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(metaPropertyPath); column.setCaption(messageTools.getPropertyCaption(propertyMetaClass, propertyName)); column.setType(metaPropertyPath.getRangeJavaClass()); addColumn(column); } } }
: propertyName); } else { MetaClass propertyMetaClass = getMetadataTools().getPropertyEnclosingMetaClass(metaPropertyPath); String propertyCaption = getMessageTools().getPropertyCaption(propertyMetaClass, propertyName); ((Component.HasCaption) component).setCaption(propertyCaption);
protected void createColumns(GroupDatasource dataSource, Table table) { Collection<MetaPropertyPath> paths = metadataTools.getPropertyPaths(dataSource.getMetaClass()); for (MetaPropertyPath metaPropertyPath : paths) { MetaProperty property = metaPropertyPath.getMetaProperty(); if (!property.getRange().getCardinality().isMany() && !metadataTools.isSystem(property)) { Table.Column column = new Table.Column(metaPropertyPath); String propertyName = property.getName(); MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(metaPropertyPath); column.setCaption(messageTools.getPropertyCaption(propertyMetaClass, propertyName)); column.setType(metaPropertyPath.getRangeJavaClass()); Element element = DocumentHelper.createElement("column"); column.setXmlDescriptor(element); table.addColumn(column); } } } }
if (propertyPath != null) { MetaProperty metaProperty = propertyPath.getMetaProperty(); MetaClass propertyMetaClass = metadataTools.getPropertyEnclosingMetaClass(propertyPath); String storeName = metadataTools.getStoreName(propertyMetaClass); if (metadataTools.isLob(metaProperty)