protected boolean isPropertyIncluded(View view, MetaProperty metaProperty) { if (view == null) { return true; } ViewProperty viewProperty = view.getProperty(metaProperty.getName()); return (viewProperty != null); }
protected boolean isPropertyIncluded(View view, MetaProperty metaProperty, MetadataTools metadataTools) { if (view == null) { return true; } ViewProperty viewProperty = view.getProperty(metaProperty.getName()); return (viewProperty != null); }
protected boolean isPropertyIncluded(View view, MetaProperty metaProperty, MetadataTools metadataTools) { if (view == null) { return true; } ViewProperty viewProperty = view.getProperty(metaProperty.getName()); return (viewProperty != null); }
/** * Determine whether the view contains a property, traversing a view branch according to the given property path. * * @param view view instance. If null, return false immediately. * @param propertyPath property path defining the property */ public boolean viewContainsProperty(@Nullable View view, MetaPropertyPath propertyPath) { View currentView = view; for (MetaProperty metaProperty : propertyPath.getMetaProperties()) { if (currentView == null) return false; ViewProperty property = currentView.getProperty(metaProperty.getName()); if (property == null) return false; currentView = property.getView(); } return true; }
protected boolean viewContainsPropertyPath(View view, String property) { String[] properties = InstanceUtils.parseValuePath(property); View currentView = view; for (int i = 0; i < properties.length; i++) { if (currentView == null) { return false; } ViewProperty viewProperty = currentView.getProperty(properties[i]); if (viewProperty == null) { return false; } currentView = viewProperty.getView(); if (currentView == null && (i + 1 == properties.length)) { return true; } } return false; }
if (dataSet instanceof DataSet) { View entityView = getView(entity, (DataSet) dataSet); if (entityView != null && entityView.getProperty(nestedCollectionName) != null) { nestedCollectionView = entityView.getProperty(nestedCollectionName).getView();
@Override public View getView() { final ViewProperty property = masterDs.getView().getProperty(metaProperty.getName()); return property == null ? null : metadata.getViewRepository().getView(getMetaClass(), property.getView().getName()); }
protected void initRuntimePropertiesDatasources(View view) { rDS = new RuntimePropsDatasourceImpl(dsContext, dataSupplier, "rDS", datasource.getId(), null); MetaClass categoriesMeta = metadata.getSession().getClass(Category.class); categoriesDs = new CollectionDatasourceImpl(); ViewProperty categoryProperty = view.getProperty("category"); if (categoryProperty == null) { throw new IllegalArgumentException("Category property not found. Not a categorized entity?"); } categoriesDs.setup(dsContext, dataSupplier, "categoriesDs", categoriesMeta, categoryProperty.getView()); categoriesDs.setQuery(String.format("select c from sys$Category c where c.entityType='%s'", meta.getName())); categoriesDs.refresh(); dsContext.register(rDS); dsContext.register(categoriesDs); }
protected void loadAllProperties() { Metadata metadata = AppBeans.get(Metadata.class); if (!loaded) { MetaClass metaClass = instance.getMetaClass(); String pkName = metadata.getTools().getPrimaryKeyName(metaClass); for (MetaProperty property : metaClass.getProperties()) { if (view != null && view.getProperty(property.getName()) != null) { explicitData.put(property.getName(), getValue(instance, property.getName())); } else if (view != null && Objects.equals(pkName, property.getName())) { explicitData.put(property.getName(), getValue(instance, property.getName())); } else if (view == null) { explicitData.put(property.getName(), getValue(instance, property.getName())); } } if (instanceNameAvailable(metaClass)) explicitData.put(INSTANCE_NAME_KEY, metadata.getTools().getInstanceName(instance)); else explicitData.put(INSTANCE_NAME_KEY, null); loaded = true; } }
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; } }
refView = new View(refView, rangeClass, "", false); // system properties are already in the source view } else { ViewProperty existingProperty = view.getProperty(propertyName); if (existingProperty != null && existingProperty.getView() != null) { refView = new View(existingProperty.getView(), rangeClass, "", systemProperties);
if (!DynamicAttributesUtils.isDynamicAttribute(metaProperty)) { if (view != null) { viewProperty = view.getProperty(metaProperty.getName()); if (viewProperty == null) continue;
ViewProperty viewProperty = diffView.getProperty(metaProperty.getName());
View propertyView = (view == null ? null : view.getProperty(property.getName()).getView());
dstEntity.setValue(propertyName, srcEntity.getValue(propertyName)); } else if (metaProperty.getRange().isClass()) { View regularPropertyView = regularView.getProperty(propertyName) != null ? regularView.getProperty(propertyName).getView() : null; if (metadata.getTools().isEmbedded(metaProperty)) { if (importViewProperty.getView() != null) {
break; View propertyView = (view == null || view.getProperty(property.getName()) == null ? null : view.getProperty(property.getName()).getView());
ViewProperty vp = view.getProperty(property.getName()); if (vp != null) propertyView = vp.getView();
ViewProperty property = masterView.getProperty(metaProperty.getName()); if (property == null) { return null;
dstEmbeddedEntity.setValue(vp.getName(), srcEmbeddedEntity.getValue(vp.getName())); } else if (mp.getRange().isClass()) { View propertyRegularView = regularView.getProperty(propertyName) != null ? regularView.getProperty(propertyName).getView() : null; if (metaProperty.getRange().getCardinality() == Range.Cardinality.ONE_TO_MANY) { importOneToManyCollectionAttribute(srcEmbeddedEntity, dstEmbeddedEntity, srcSecurityState,