/** * {@inheritDoc} */ public String getRenderedProperty() { if (renderedProperty == null) { return ((ICollectionDescriptorProvider<?>) getModelDescriptor()) .getCollectionDescriptor().getElementDescriptor() .getToStringProperty(); } return renderedProperty; }
propertyDescriptor.getCollectionDescriptor().getCollectionInterface())) { List<IAccessor> orderingAccessors = new ArrayList<>(); List<ESort> orderingDirections = new ArrayList<>(); Class<?> collectionElementContract = propertyDescriptor.getCollectionDescriptor().getElementDescriptor() .getComponentContract(); for (Map.Entry<String, ESort> orderingProperty : orderingProperties.entrySet()) {
/** * {@inheritDoc} */ @Override public String getModelTypeName() { return getReferencedDescriptor().getModelTypeName(); }
/** * {@inheritDoc} */ @Override public Class<?> getModelType() { return getReferencedDescriptor().getCollectionInterface(); }
/** * {@inheritDoc} */ @Override public Map<String, ESort> getOrderingProperties() { if (orderingProperties != null) { return orderingProperties; } if (getReferencedDescriptor() != null) { return getReferencedDescriptor().getOrderingProperties(); } return null; }
.getCollectionDescriptor().getCollectionInterface())) { return false;
/** * Gets the entity descriptor to execute the LOV action for from the context. * It allows sub classes to override in order to define the descriptor at * runtime. * * @param context * the action context. * @return the entity descriptor to execute the LOV action for. */ @SuppressWarnings("UnusedParameters") protected IComponentDescriptor<? extends IComponent> getEntityDescriptor(Map<String, Object> context) { if (entityDescriptor == null) { IModelDescriptor modelDescriptor = getModelDescriptor(context); if (modelDescriptor instanceof ICollectionDescriptorProvider<?>) { ICollectionDescriptor<?> collectionDescriptor = ((ICollectionDescriptorProvider<?>) modelDescriptor) .getCollectionDescriptor(); if (collectionDescriptor != null) { return (IComponentDescriptor<? extends IComponent>) collectionDescriptor.getElementDescriptor(); } } } return entityDescriptor; }
&& !propertyValue.isEmpty() && !List.class.isAssignableFrom(propertyDescriptor .getCollectionDescriptor().getCollectionInterface())) { List<String> orderingProperties = propertyDescriptor .getOrderingProperties(); List<IAccessor> orderingAccessors = new ArrayList<IAccessor>(); Class collectionElementContract = propertyDescriptor .getCollectionDescriptor().getElementDescriptor() .getComponentContract(); for (String orderingProperty : orderingProperties) {
.getCollectionDescriptor().getCollectionInterface())) { return false;
/** * This implementation returns a {@code ModelConnector} instance. * <p> * {@inheritDoc} */ @Override public IValueConnector createChildConnector(String connectorId) { if (connectorTank != null && !connectorTank.isEmpty()) { return connectorTank.remove(0); } IComponentDescriptor<?> componentDescriptor; componentDescriptor = ((ICollectionDescriptorProvider<?>) getModelDescriptor()) .getCollectionDescriptor().getElementDescriptor(); IValueConnector elementConnector = modelConnectorFactory .createModelConnector(connectorId, componentDescriptor, getSecurityHandler()); return elementConnector; }
if (property == null) { property = collectionFactory.createComponentCollection( propertyDescriptor.getReferencedDescriptor().getCollectionInterface()); storeProperty(propertyName, property); IComponent referent = propertyAsList.get(i); IComponent decorated = decorateReferent(referent, propertyDescriptor.getReferencedDescriptor().getElementDescriptor().getComponentDescriptor()); if (decorated != referent) { propertyAsList.set(i, decorated); propertyDescriptor.getReferencedDescriptor().getElementDescriptor())) { if (decorated != null) { decorated.setOwningComponent((IComponent) proxy, propertyDescriptor); for (IComponent referent : new THashSet<>(propertyAsSet)) { IComponent decorated = decorateReferent(referent, propertyDescriptor.getReferencedDescriptor().getElementDescriptor().getComponentDescriptor()); if (decorated != referent) { propertyAsSet.add(decorated); propertyDescriptor.getReferencedDescriptor().getElementDescriptor())) { if (decorated != null) { decorated.setOwningComponent((IComponent) proxy, propertyDescriptor); implementedInterfaces.toArray(new Class[implementedInterfaces.size()]), new PersistentCollectionWrapper<>((Collection<IComponent>) property, (IComponent) proxy, propertyName, propertyDescriptor.getCollectionDescriptor().getElementDescriptor().getComponentContract(), accessorFactory));
currentPropertyValue = Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[]{ ((ICollectionPropertyDescriptor<?>) propertyDescriptor).getReferencedDescriptor() .getCollectionInterface()}, new NeverEqualsInvocationHandler(CollectionHelper.cloneCollection((Collection<?>) currentPropertyValue)));
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; }
} else if (propertyDescriptor instanceof ICollectionPropertyDescriptor<?>) { componentRefType = ((ICollectionPropertyDescriptor<?>) propertyDescriptor).getCollectionDescriptor() .getElementDescriptor() .getModelType(); Class<? extends Collection<?>> collectionInterface = ((ICollectionPropertyDescriptor) propertyDescriptor) .getCollectionDescriptor().getCollectionInterface(); if (IComponent.class.isAssignableFrom(componentRefType)) { if (IEntity.class.isAssignableFrom(componentRefType)) {
/** * 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; }
@SuppressWarnings("rawtypes") private Map<String, IComponentDescriptor<?>> buildContractNameIdMap() { Map<String, IComponentDescriptor<?>> map = new HashMap<>(); Map<String, IComponentDescriptor> idToComponentDescriptors = componentApplicationContext.getBeansOfType( IComponentDescriptor.class, false, false); for (Map.Entry<String, IComponentDescriptor> descriptorEntry : idToComponentDescriptors.entrySet()) { IComponentDescriptor componentDescriptor = descriptorEntry.getValue(); if (componentDescriptor.getComponentContract() != null) { map.put(componentDescriptor.getComponentContract().getName(), componentDescriptor); if (componentDescriptor.isTranslatable()) { ICollectionPropertyDescriptor<?> collectionPropertyDescriptor = (ICollectionPropertyDescriptor<?>) componentDescriptor .getPropertyDescriptor(AbstractComponentDescriptor.getComponentTranslationsDescriptorTemplate().getName()); if (collectionPropertyDescriptor != null) { IComponentDescriptor<?> translationComponentDescriptor = collectionPropertyDescriptor .getReferencedDescriptor().getElementDescriptor(); if (translationComponentDescriptor.getComponentContract() != null) { map.put(translationComponentDescriptor.getComponentContract().getName(), translationComponentDescriptor); } } } } } map.put(BasicDescriptorDescriptor.INSTANCE.getName(), BasicDescriptorDescriptor.INSTANCE); return map; } }
/** * Gets the elementComponentDescriptor. * * @return the elementComponentDescriptor. */ public IComponentDescriptor<?> getElementComponentDescriptor() { if (elementComponentDescriptor == null) { IViewDescriptor projectedViewDescriptor = getProjectedViewDescriptor(); if (projectedViewDescriptor instanceof ICollectionViewDescriptor && projectedViewDescriptor.getModelDescriptor() != null) { return ((ICollectionDescriptorProvider<?>) projectedViewDescriptor.getModelDescriptor()) .getCollectionDescriptor().getElementDescriptor(); } } return elementComponentDescriptor; }
/** * Gets the new entity to add. It is created using the informations contained * in the context. * * @param context * the action context. * @return the entity to add to the collection. */ @Override @SuppressWarnings("unchecked") protected List<?> getAddedComponents(Map<String, Object> context) { IComponentDescriptor elementDescriptor = (IComponentDescriptor) context .get(ActionContextConstants.ELEMENT_DESCRIPTOR); if (elementDescriptor == null) { elementDescriptor = ((ICollectionPropertyDescriptor) getModelDescriptor(context)) .getReferencedDescriptor().getElementDescriptor(); } IEntity newEntity = getEntityFactory(context).createEntityInstance( (Class<? extends IEntity>) elementDescriptor.getComponentContract()); return Collections.singletonList(newEntity); } }
/** * {@inheritDoc} */ @Override public String getIconImageURL() { String iconImageURL = super.getIconImageURL(); if (iconImageURL == null) { iconImageURL = ((ICollectionDescriptorProvider<?>) getModelDescriptor()) .getCollectionDescriptor().getElementDescriptor().getIconImageURL(); setIconImageURL(iconImageURL); } return iconImageURL; } }
translationRestriction.add(createStringRestriction( ((ICollectionPropertyDescriptor<IPropertyTranslation>) componentDescriptor.getPropertyDescriptor( translationsPath)).getCollectionDescriptor().getElementDescriptor() .getPropertyDescriptor(IPropertyTranslation.TRANSLATED_VALUE), translationsAlias + "." + IPropertyTranslation.TRANSLATED_VALUE, propertyValue, componentDescriptor,