private long getLastUpdated(IComponentDescriptor<?> componentDescriptor) { long lastUpdated = componentDescriptor.getLastUpdated(); for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { long propertyLastUpdated = propertyDescriptor.getLastUpdated(); if (propertyLastUpdated > lastUpdated) { lastUpdated = propertyLastUpdated; } } return lastUpdated; }
/** * Gets page size. * * @return the page size */ protected Integer getPageSize(IReferencePropertyDescriptor<IComponent> erqDescriptor) { if (pageSize != null) { return pageSize; } if (erqDescriptor.getReferencedDescriptor().getPageSize() != null) { return erqDescriptor.getReferencedDescriptor().getPageSize(); } return null; }
/** * {@inheritDoc} */ @Override public IComponentDescriptor<?> getComponentDescriptor(Class<?> componentContract) { return componentDescriptorRegistry.getComponentDescriptor(componentContract); }
private IValueConnector createColumnConnector(String columnId, IComponentDescriptor<?> descriptor) { IPropertyDescriptor propertyDescriptor = descriptor .getPropertyDescriptor(columnId); if (propertyDescriptor == null) { throw new ViewException("No property " + columnId + " defined for " + descriptor.getComponentContract()); } if (propertyDescriptor instanceof IReferencePropertyDescriptor) { return connectorFactory.createCompositeValueConnector(columnId, ((IReferencePropertyDescriptor<?>) propertyDescriptor) .getReferencedDescriptor().getToStringProperty()); } return connectorFactory.createValueConnector(propertyDescriptor.getName()); }
/** * {@inheritDoc} */ public String getRenderedProperty() { if (renderedProperty == null) { return ((ICollectionDescriptorProvider<?>) getModelDescriptor()) .getCollectionDescriptor().getElementDescriptor() .getToStringProperty(); } return renderedProperty; }
/** * {@inheritDoc} */ @Override public String getIconImageURL() { String iconImageURL = super.getIconImageURL(); if (iconImageURL == null) { iconImageURL = ((ICollectionDescriptorProvider<?>) getModelDescriptor()) .getCollectionDescriptor().getElementDescriptor().getIconImageURL(); setIconImageURL(iconImageURL); } return iconImageURL; } }
private void checkIntegrity(Object proxy) { checkMandatoryProperties(proxy); if (propertyProcessorsEnabled) { for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { if (!propertyDescriptor.isComputed()) { propertyDescriptor.preprocessSetter(proxy, straightGetProperty(proxy, propertyDescriptor.getName())); } } } }
/** * 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(); }
/** * {@inheritDoc} * * @return the query contract */ @Override @SuppressWarnings("unchecked") public <T> Class<T> getQueryContract() { if (componentDescriptor instanceof IQueryComponentDescriptor) { return (Class<T>) ((IQueryComponentDescriptor) componentDescriptor).getQueriedComponentsDescriptor() .getComponentContract(); } return (Class<T>) componentDescriptor.getComponentContract(); }
/** * Gets the queriedComponentsDescriptor. * * @return the queriedComponentsDescriptor. */ @Override public IComponentDescriptor<? extends IComponent> getQueriedComponentsDescriptor() { return queryComponentsDescriptorProvider.getComponentDescriptor(); } }
/** * Gets the interface class being the contract of this component. * * @return the component interface contract. */ public Class<?> getComponentContract() { return componentDescriptor.getComponentContract(); }
/** * Constructs a new {@code MandatoryPropertyException} instance. * * @param descriptor * the violated property descriptor. * @param targetComponent * the target component. */ public MandatoryPropertyException(IPropertyDescriptor descriptor, Object targetComponent) { super("Mandatory property [" + descriptor.getName() + "] on component [" + targetComponent + "]."); this.descriptor = descriptor; this.targetComponent = targetComponent; }
private boolean isSortable(IPropertyDescriptor propertyDescriptor) { return propertyDescriptor != null && (!propertyDescriptor.isComputed() || propertyDescriptor.getPersistenceFormula() != null); }
/** * {@inheritDoc} * * @return the page size */ @Override public Integer getPageSize() { if (pageSize == null) { return componentDescriptor.getPageSize(); } return pageSize; }
/** * Gets the orderingProperties. * * @return the orderingProperties. */ public Map<String, ESort> getOrderingProperties() { if (orderingProperties == null) { return getElementComponentDescriptor().getOrderingProperties(); } return orderingProperties; }
/** * Whether we need to create a comparable query structure for this property. * * @param propertyDescriptor * the property descriptor to test. * @return true if we need to create a comparable query structure for this * property. */ protected boolean isPropertyFilterComparable(IPropertyDescriptor propertyDescriptor) { return propertyDescriptor.isFilterComparable(); }
/** * {@inheritDoc} */ @Override public Collection<IComponentDescriptor<?>> getComponentDescriptors() { return componentDescriptorRegistry.getComponentDescriptors(); }
private void rollbackProperty(Object proxy, IPropertyDescriptor propertyDescriptor, Object oldProperty) { // boolean wasPropertyProcessorsEnabled = propertyProcessorsEnabled; // try { // propertyProcessorsEnabled = false; // setProperty(proxy, propertyDescriptor, oldProperty); // } finally { // propertyProcessorsEnabled = wasPropertyProcessorsEnabled; // } straightSetProperty(proxy, propertyDescriptor.getName(), oldProperty); }
private boolean isSortable(IPropertyDescriptor propertyDescriptor) { return propertyDescriptor != null && (!propertyDescriptor.isComputed() || propertyDescriptor.getPersistenceFormula() != null); }
/** * {@inheritDoc} */ @Override public IValueConnector createModelConnector(String id, Class<?> componentContract, ISecurityHandler securityHandler) { return createModelConnector(id, getDescriptorRegistry() .getComponentDescriptor(componentContract), securityHandler); }