/** * Gets the queriedComponentsDescriptor. * * @return the queriedComponentsDescriptor. */ @Override public IComponentDescriptor<? extends IComponent> getQueriedComponentsDescriptor() { return queryComponentsDescriptorProvider.getComponentDescriptor(); } }
queryComponentViewDescriptor.setLabelsPosition(ELabelPosition.NONE); List<IPropertyViewDescriptor> propertyViewDescriptors = new ArrayList<>(); for (String queriableProperty : componentDescriptorProvider.getQueryableProperties()) { IPropertyDescriptor actualPropertyDescriptor = queryComponentDescriptor.getPropertyDescriptor(queriableProperty); if (actualPropertyDescriptor instanceof ComparableQueryStructureDescriptor) {
resultViewDescriptor.setReadOnly(true); resultViewDescriptor.setRenderedProperties(entityRefDescriptor .getRenderedProperties()); if (getModel(lovContext) instanceof IQueryComponent) { resultViewDescriptor.setPermId("Lov." + entityRefDescriptor.getName()); return resultViewDescriptor;
/** * Overridden to deal with polymorphism. * <p> * {@inheritDoc} */ @Override public IComponentDescriptorProvider<?> getModelDescriptor() { IComponentDescriptorProvider<?> registeredModelDescriptor = (IComponentDescriptorProvider<?>) super .getModelDescriptor(); if (getModel() instanceof IEntity && !(getModel() instanceof IQueryComponent)) { Class<? extends IEntity> entityContract = ((IEntity) getModel()) .getComponentContract(); if (!entityContract.equals(registeredModelDescriptor.getModelType())) { // we must take care of subclasses (polymorphism) return modelConnectorFactory.getDescriptorRegistry() .getComponentDescriptor(entityContract); } } return registeredModelDescriptor; }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public BasicViewDescriptor createResultViewDescriptor( IComponentDescriptorProvider<IComponent> entityRefDescriptor, Map<String, Object> lovContext) { MobileListViewDescriptor resultViewDescriptor = new MobileListViewDescriptor(); resultViewDescriptor.setShowArrow(false); ICollectionPropertyDescriptor<IComponent> queriedEntitiesDescriptor; queriedEntitiesDescriptor = (ICollectionPropertyDescriptor<IComponent>) getQueryComponentDescriptorFactory() .createQueryComponentDescriptor(entityRefDescriptor) .getPropertyDescriptor(IQueryComponent.QUERIED_COMPONENTS); resultViewDescriptor.setModelDescriptor(queriedEntitiesDescriptor); resultViewDescriptor.setReadOnly(true); if (getModel(lovContext) instanceof IQueryComponent) { // We are on a filter view that supports multi selection resultViewDescriptor.setSelectionMode(ESelectionMode.MULTIPLE_INTERVAL_CUMULATIVE_SELECTION); } else { resultViewDescriptor.setSelectionMode(ESelectionMode.SINGLE_SELECTION); } resultViewDescriptor.setPermId("Lov." + entityRefDescriptor.getName()); return resultViewDescriptor; } }
/** * Performs delayed configuration. */ protected void finishConfiguration() { setDescription(getQueriedComponentsDescriptor().getDescription()); setIcon(getQueriedComponentsDescriptor().getIcon()); List<String> qProperties = new ArrayList<>(); for (String queryableProperty : queryComponentsDescriptorProvider.getQueryableProperties()) { IPropertyDescriptor propertyDescriptor = getPropertyDescriptor(queryableProperty); if (propertyDescriptor instanceof ComparableQueryStructureDescriptor) { for (String nestedRenderedProperty : ((ComparableQueryStructureDescriptor) propertyDescriptor) .getRenderedProperties()) { qProperties.add(propertyDescriptor.getName() + "." + nestedRenderedProperty); } } else { qProperties.add(propertyDescriptor.getName()); } } setRenderedProperties(qProperties); setQueryableProperties(queryComponentsDescriptorProvider.getQueryableProperties()); setToStringProperty(getQueriedComponentsDescriptor().getToStringProperty()); setToHtmlProperty(getQueriedComponentsDescriptor().getToHtmlProperty()); setAutoCompleteProperty(getQueriedComponentsDescriptor().getAutoCompleteProperty()); setUnclonedProperties(getQueriedComponentsDescriptor().getUnclonedProperties()); setPageSize(getQueriedComponentsDescriptor().getPageSize()); setOrderingProperties(getQueriedComponentsDescriptor().getOrderingProperties()); }
private void recomputeAccessor(Object newModel) { if (isValueAccessedAsProperty() && getModelProvider() != null && accessorFactory != null && (accessor == null || !accessor.appliesTo(newModel))) { Class<?> modelType = null; try { if (newModel != null) { if (newModel instanceof IComponent) { modelType = ((IComponent) newModel).getComponentContract(); } else { modelType = newModel.getClass(); } } else { modelType = getModelProvider().getModelDescriptor().getModelType(); } accessor = accessorFactory.createPropertyAccessor(getId(), modelType); } catch (Exception ex) { LOG.error( "An error occurred when creating the accessor for the {} property on {} class.", getId(), modelType, ex); } if (accessor instanceof IModelDescriptorAware) { ((IModelDescriptorAware) accessor) .setModelDescriptor(getModelDescriptor()); } } }
/** * Creates basic query component descriptors. * <p/> * {@inheritDoc} */ @Override public IComponentDescriptor<IQueryComponent> createQueryComponentDescriptor( IComponentDescriptorProvider<IComponent> componentDescriptorProvider) { IComponentDescriptorProvider<? extends IComponent> realComponentDescriptorProvider; if (componentDescriptorProvider.getComponentDescriptor() instanceof RefQueryComponentDescriptor<?>) { realComponentDescriptorProvider = ((RefQueryComponentDescriptor<?>) componentDescriptorProvider .getComponentDescriptor()).getQueriedComponentsDescriptor(); } else { realComponentDescriptorProvider = componentDescriptorProvider; } return createOrGetQueryComponentDescriptor(realComponentDescriptorProvider); }
BasicComponentViewDescriptor queryComponentViewDescriptor = new BasicComponentViewDescriptor(); List<IPropertyViewDescriptor> propertyViewDescriptors = new ArrayList<>(); for (String queriableProperty : componentDescriptorProvider.getQueryableProperties()) { IPropertyDescriptor actualPropertyDescriptor = queryComponentDescriptor.getPropertyDescriptor(queriableProperty); BasicPropertyViewDescriptor propertyView = null;
/** * Determines if a reference property descriptor references an inline * component. * * @param componentDescriptorProvider * the reference property descriptor to test. * @return {@code true} if the reference property descriptor references * an inline component. */ public static boolean isInlineComponentReference(IComponentDescriptorProvider<?> componentDescriptorProvider) { IComponentDescriptor<?> componentDescriptor = componentDescriptorProvider.getComponentDescriptor(); return componentDescriptor != null && !componentDescriptor.isEntity() && !componentDescriptor.isPurelyAbstract(); }
private SecurityContextBuilder append(IModelDescriptor modelDescriptor) { if (modelDescriptor != null) { if (modelDescriptor instanceof IPropertyDescriptor) { currentSecurityContext.put(SecurityContextConstants.PROPERTY, ((IPropertyDescriptor) modelDescriptor).getPermId()); } if (modelDescriptor instanceof IComponentDescriptorProvider<?> && ((IComponentDescriptorProvider<?>) modelDescriptor) .getComponentDescriptor() != null) { if (!(currentSecurityContext.get(LAST_PUSHED_VIEW) instanceof IPropertyViewDescriptor)) { // only dig the model if we are not on a reference property view (LOV // field). see bug #560. currentSecurityContext.put(SecurityContextConstants.MODEL, ((IComponentDescriptorProvider<?>) modelDescriptor) .getComponentDescriptor().getPermId()); } } else if (modelDescriptor instanceof ICollectionDescriptorProvider<?>) { currentSecurityContext.put(SecurityContextConstants.MODEL, ((ICollectionDescriptorProvider<?>) modelDescriptor) .getCollectionDescriptor().getElementDescriptor().getPermId()); } } return this; }
/** * {@inheritDoc} */ @Override public Collection<String> getGrantedRoles() { Collection<String> grantedRoles = super.getGrantedRoles(); if (grantedRoles == null && getModelDescriptor() != null) { IComponentDescriptor<?> componentDescriptor = ((IComponentDescriptorProvider<?>) getModelDescriptor()) .getComponentDescriptor(); grantedRoles = componentDescriptor.getGrantedRoles(); } return grantedRoles; } }
/** * Retrieves the bean component descriptor to create the child bean module. * * @param parentModule * the parent module to add the child bean module to. * @param context * the action context. * @return the bean module component descriptor. */ @SuppressWarnings("UnusedParameters") protected IComponentDescriptor<?> getBeanComponentDescriptor( Module parentModule, Map<String, Object> context) { IModelDescriptor modelDescriptor = getModelDescriptor(context); IComponentDescriptor<?> childComponentDescriptor; if (modelDescriptor instanceof ICollectionDescriptorProvider<?>) { childComponentDescriptor = ((ICollectionDescriptorProvider<?>) modelDescriptor) .getCollectionDescriptor().getElementDescriptor(); } else { childComponentDescriptor = ((IComponentDescriptorProvider<?>) modelDescriptor) .getComponentDescriptor(); } return childComponentDescriptor; }
/** * {@inheritDoc} */ @Override public String getIconImageURL() { String iconImageURL = super.getIconImageURL(); if (iconImageURL == null) { iconImageURL = ((IComponentDescriptorProvider<?>) getModelDescriptor()) .getComponentDescriptor().getIconImageURL(); setIconImageURL(iconImageURL); } return iconImageURL; }
if (rootProp instanceof IComponentDescriptorProvider<?>) { IComponentDescriptor<?> componentDescriptor = ((IComponentDescriptorProvider<?>) rootProp) .getComponentDescriptor(); if (componentDescriptor != null) { descriptor = componentDescriptor.getPropertyDescriptor(propertyName.substring(nestedDotIndex + 1));
/** * {@inheritDoc} */ public List<ISubViewDescriptor> getPropertyViewDescriptors() { if (propertyViewDescriptors == null) { IComponentDescriptor<?> componentDescriptor = ((IComponentDescriptorProvider<?>) getModelDescriptor()) .getComponentDescriptor(); List<String> modelRenderedProperties = componentDescriptor .getRenderedProperties(); List<ISubViewDescriptor> defaultPropertyViewDescriptors = new ArrayList<ISubViewDescriptor>(); for (String renderedProperty : modelRenderedProperties) { BasicSubviewDescriptor propertyDescriptor = new BasicSubviewDescriptor(); propertyDescriptor.setName(renderedProperty); propertyDescriptor.setGrantedRoles(componentDescriptor .getPropertyDescriptor(renderedProperty).getGrantedRoles()); defaultPropertyViewDescriptors.add(propertyDescriptor); } return defaultPropertyViewDescriptors; } return propertyViewDescriptors; }
/** * Gets the componentDescriptor. * * @return the componentDescriptor. */ @SuppressWarnings("unchecked") public IComponentDescriptor<?> getComponentDescriptor() { if (componentDescriptor == null) { if (getProjectedViewDescriptor() != null && getProjectedViewDescriptor().getModelDescriptor() instanceof IComponentDescriptorProvider<?>) { return ((IComponentDescriptorProvider<Object>) getProjectedViewDescriptor() .getModelDescriptor()).getComponentDescriptor(); } } return componentDescriptor; }
if (connector == null) { IComponentDescriptor<?> componentDescriptor = getModelDescriptor() .getComponentDescriptor(); if (componentDescriptor != null) { try {
/** * {@inheritDoc} */ public List<String> getRenderedChildProperties(String propertyName) { List<String> childProperties = null; if (renderedChildProperties != null) { childProperties = renderedChildProperties.get(propertyName); } if (childProperties == null) { IPropertyDescriptor childPropertyDescriptor = ((IComponentDescriptorProvider<?>) getModelDescriptor()) .getComponentDescriptor().getPropertyDescriptor(propertyName); if (childPropertyDescriptor instanceof ICollectionPropertyDescriptor) { return ((ICollectionDescriptor<?>) ((ICollectionPropertyDescriptor<?>) childPropertyDescriptor) .getCollectionDescriptor()).getElementDescriptor() .getRenderedProperties(); } else if (childPropertyDescriptor instanceof IReferencePropertyDescriptor) { return ((IReferencePropertyDescriptor<?>) childPropertyDescriptor) .getReferencedDescriptor().getRenderedProperties(); } } return childProperties; }
/** * Sets the propertyViewDescriptors. * * @param propertyViewDescriptors * the propertyViewDescriptors to set. */ public void setPropertyViewDescriptors( List<ISubViewDescriptor> propertyViewDescriptors) { this.propertyViewDescriptors = propertyViewDescriptors; if (propertyViewDescriptors != null && getModelDescriptor() != null) { IComponentDescriptor<?> componentDescriptor = ((IComponentDescriptorProvider<?>) getModelDescriptor()) .getComponentDescriptor(); for (ISubViewDescriptor propertyViewDescriptor : propertyViewDescriptors) { propertyViewDescriptor.setGrantedRoles(componentDescriptor .getPropertyDescriptor(propertyViewDescriptor.getName()) .getGrantedRoles()); } } }