public Collection<MetaProperty> getPropertiesFilteredByCategory(final Category category) { return Collections2.filter(getProperties(), new Predicate<MetaProperty>() { @Override public boolean apply(@Nullable MetaProperty input) { if (input != null && category != null) { CategoryAttribute categoryAttribute = attributes.get(input.getName()); return category.equals(categoryAttribute.getCategory()); } else { return false; } } }); } }
@Override public MetaProperty getPropertyNN(String name) { MetaProperty property = getProperty(name); if (property == null) throw new IllegalArgumentException("Property '" + name + "' not found in " + getName()); return property; }
@Override @SuppressWarnings("unchecked") public Collection<DynamicAttributesMetaProperty> getPropertiesFilteredByCategory() { Collection propertiesFilteredByCategory = metaClass.getPropertiesFilteredByCategory(category); return (Collection<DynamicAttributesMetaProperty>) propertiesFilteredByCategory; }
public RuntimePropsDatasourceImpl(DsContext dsContext, DataSupplier dataSupplier, String id, String mainDsId, @Nullable MetaClass categorizedEntityClass) { this.categorizedEntityClass = categorizedEntityClass; this.id = id; this.dsContext = dsContext; this.dataSupplier = dataSupplier; this.dynamicAttributesGuiTools = AppBeans.get(DynamicAttributesGuiTools.NAME); this.metaClass = new DynamicAttributesMetaClass(); this.setMainDs(mainDsId); this.setCommitMode(CommitMode.DATASTORE); this.attributes = AppBeans.get(DynamicAttributes.NAME, DynamicAttributes.class).getAttributesForMetaClass(resolveCategorizedEntityClass()); for (CategoryAttribute attribute : attributes) { MetaProperty metaProperty = DynamicAttributesUtils.getMetaPropertyPath(mainDs.getMetaClass(), attribute).getMetaProperty(); this.metaClass.addProperty(metaProperty, attribute); } }
@Override public MetaPropertyPath getPropertyPath(String propertyPath) { MetaProperty currentProperty; currentProperty = this.getProperty(propertyPath); if (currentProperty == null) return null; return new MetaPropertyPath(this, currentProperty); }
Collection<MetaProperty> properties = metaClass.getProperties(); for (MetaProperty property : properties) { view.addProperty(property.getName());