@Override public boolean isEntityAttrReadPermitted(MetaClass metaClass, String propertyPath) { MetaPropertyPath mpp = metadataTools.resolveMetaPropertyPath(metaClass, propertyPath); return mpp != null && isEntityAttrReadPermitted(mpp); }
/** * Returns a {@link MetaPropertyPath} which can include the special MetaProperty for a dynamic attribute. * Throws an IllegalArgumentException if MetaPropertyPath can't be resolved. * * @param metaClass originating meta-class * @param propertyPath path to the attribute * @return MetaPropertyPath instance */ public MetaPropertyPath resolveMetaPropertyPathNN(MetaClass metaClass, String propertyPath) { MetaPropertyPath metaPropertyPath = resolveMetaPropertyPath(metaClass, propertyPath); checkNotNullArgument(metaPropertyPath, "Could not resolve property path '%s' in '%s'", propertyPath, metaClass); return metaPropertyPath; }
@Override public boolean isEntityAttrUpdatePermitted(MetaClass metaClass, String propertyPath) { MetaPropertyPath mpp = metadataTools.resolveMetaPropertyPath(metaClass, propertyPath); return mpp != null && isEntityAttrUpdatePermitted(mpp); }
@Override public boolean isEntityAttrPermitted(MetaClass metaClass, String property, EntityAttrAccess access) { MetaPropertyPath mpp = metadataTools.resolveMetaPropertyPath(metaClass, property); return mpp != null && isEntityAttrPermitted(metaClass, mpp, access); }
@SuppressWarnings("unchecked") @Nullable @Override protected Options getOptions(EntityValueSource valueSource, String property) { MetaClass metaClass = valueSource.getEntityMetaClass(); MetaPropertyPath metaPropertyPath = metadataTools.resolveMetaPropertyPath(metaClass, property); Table.Column columnConf = webTable.getColumnsInternal().get(metaPropertyPath); CollectionContainer collectionContainer = findOptionsContainer(columnConf); if (collectionContainer != null) { return new ContainerOptions(collectionContainer); } CollectionDatasource ds = findOptionsDatasource(columnConf, property); if (ds != null) { return new DatasourceOptions(ds); } return null; }
@Override public void setBeanLocator(BeanLocator beanLocator) { metadata = beanLocator.get(Metadata.NAME); if (datasource instanceof NestedDatasource) { NestedDatasource nestedDs = (NestedDatasource) this.datasource; MetaProperty nestedDsProperty = nestedDs.getProperty(); MetadataTools metadataTools = beanLocator.get(MetadataTools.NAME); MetaClass masterDsEntityClass = nestedDs.getMaster().getMetaClass(); MetaPropertyPath masterDsMpp = metadataTools.resolveMetaPropertyPath(masterDsEntityClass, nestedDsProperty.getName()); if (masterDsMpp != null) { if (masterDsMpp.getMetaProperty() != nestedDsProperty) { log.debug("Master Datasource property doesn't match with specified nested datasource property"); } else { metaPropertyPath = masterDsMpp; } } else { log.debug("Unable to resolve '{}' for '{}' entity", nestedDsProperty.getName(), masterDsEntityClass); } } datasource.addCollectionChangeListener(this::collectionChanged); }
protected void loadVisible(FieldGroup resultComponent, FieldGroup.FieldConfig field) { Element element = field.getXmlDescriptor(); if (element != null) { String visible = element.attributeValue("visible"); if (StringUtils.isNotEmpty(visible)) { field.setVisible(Boolean.parseBoolean(visible)); } } if (!field.isCustom() && BooleanUtils.isNotFalse(field.isVisible())) { MetaClass metaClass = getMetaClass(resultComponent, field); MetaPropertyPath propertyPath = getMetadataTools().resolveMetaPropertyPath(metaClass, field.getProperty()); checkNotNullArgument(propertyPath, "Could not resolve property path '%s' in '%s'", field.getId(), metaClass); if (!getSecurity().isEntityAttrReadPermitted(metaClass, propertyPath.toString())) { field.setVisible(false); } } }
protected void loadEditable(FieldGroup resultComponent, FieldGroup.FieldConfig field) { Element element = field.getXmlDescriptor(); if (element != null) { String editable = element.attributeValue("editable"); if (StringUtils.isNotEmpty(editable)) { field.setEditable(Boolean.parseBoolean(editable)); } } if (!field.isCustom() && BooleanUtils.isNotFalse(field.isEditable())) { MetaClass metaClass = getMetaClass(resultComponent, field); MetaPropertyPath propertyPath = getMetadataTools().resolveMetaPropertyPath(metaClass, field.getProperty()); checkNotNullArgument(propertyPath, "Could not resolve property path '%s' in '%s'", field.getId(), metaClass); if (!getSecurity().isEntityAttrUpdatePermitted(metaClass, propertyPath.toString())) { field.setEditable(false); } } }
if (!propertyReadRequired(propertyName)) continue; JsonElement propertyValue = entry.getValue(); MetaPropertyPath metaPropertyPath = metadataTools.resolveMetaPropertyPath(entity.getMetaClass(), propertyName); MetaProperty metaProperty = metaPropertyPath != null ? metaPropertyPath.getMetaProperty() : null; if (metaProperty != null) {
protected Table.Column loadColumn(Element element, MetaClass metaClass) { String id = element.attributeValue("id"); MetaPropertyPath metaPropertyPath = getMetadataTools().resolveMetaPropertyPath(metaClass, id);
@Override public void setBeanLocator(BeanLocator beanLocator) { MetaClass metaClass = datasource.getMetaClass(); MetadataTools metadataTools = beanLocator.get(MetadataTools.NAME); MetaPropertyPath metaPropertyPath = metadataTools.resolveMetaPropertyPath(metaClass, property); checkNotNullArgument(metaPropertyPath, "Could not resolve property path '%s' in '%s'", property, metaClass); this.metaPropertyPath = metaPropertyPath; this.datasource.addStateChangeListener(this::datasourceStateChanged); this.datasource.addItemChangeListener(this::datasourceItemChanged); this.datasource.addItemPropertyChangeListener(this::datasourceItemPropertyChanged); if (datasource.getState() == Datasource.State.VALID) { setState(BindingState.ACTIVE); } }
MetaPropertyPath metaPropertyPath = getMetadataTools().resolveMetaPropertyPath(metaClass, property); column = component.addColumn(id, metaPropertyPath); } else {
if (targetDs != null && property != null) { MetaClass metaClass = targetDs.getMetaClass(); metaPropertyPath = getMetadataTools().resolveMetaPropertyPath(targetDs.getMetaClass(), property); if (metaPropertyPath == null) { if (!customField) {
MetaPropertyPath metaPropertyPath = metadata.getTools().resolveMetaPropertyPath(metaClass, propertyName); Preconditions.checkNotNullArgument(metaPropertyPath, "Could not resolve property '%s' in '%s'", propertyName, metaClass); MetaProperty property = metaPropertyPath.getMetaProperty();
MetaPropertyPath metaPropertyPath = metadata.getTools().resolveMetaPropertyPath(metaClass, propertyName); checkNotNullArgument(metaPropertyPath, "Could not resolve property '%s' in '%s'", propertyName, metaClass); MetaProperty property = metaPropertyPath.getMetaProperty();
MetaPropertyPath metaPropertyPath = metadataTools.resolveMetaPropertyPath(metaClass, property); if (metaPropertyPath == null) { throw new IllegalArgumentException(String.format(