private boolean isSortable(IPropertyDescriptor propertyDescriptor) { return propertyDescriptor != null && (!propertyDescriptor.isComputed() || propertyDescriptor.getPersistenceFormula() != null); }
private boolean isSortable(IPropertyDescriptor propertyDescriptor) { return propertyDescriptor != null && (!propertyDescriptor.isComputed() || propertyDescriptor.getPersistenceFormula() != null); }
@Override public void propertyChange(PropertyChangeEvent evt) { Object source = evt.getSource(); if (source instanceof IEntity) { IComponentDescriptor<?> componentDescriptor = getBackendController().getEntityFactory() .getComponentDescriptor(((IEntity) source) .getComponentContract()); IPropertyDescriptor propertyDescriptor = componentDescriptor.getPropertyDescriptor(evt.getPropertyName()); if (propertyDescriptor != null && !propertyDescriptor.isComputed()) { lifecycledEntities.remove(source); } } } };
/** * Directly gets all property values out of the property store without any * other operation. * * @param proxy * the proxy to straight get the properties from. * @return The map of properties. */ protected Map<String, Object> straightGetProperties(Object proxy) { Map<String, Object> allProperties = new HashMap<>(); for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { String propertyName = propertyDescriptor.getName(); if (!(propertyDescriptor.isComputed() && propertyDescriptor.getPersistenceFormula() == null)) { allProperties.put(propertyName, straightGetProperty(proxy, propertyName)); } } return allProperties; }
/** * Directly get a property value out of the property store without any other * operation. * * @param proxy * the proxy to straight get the property from. * @param propertyName * the name of the property. * @return the property value or null. */ protected Object straightGetProperty(Object proxy, String propertyName) { IPropertyDescriptor propertyDescriptor = componentDescriptor.getPropertyDescriptor(propertyName); if (propertyDescriptor == null || (propertyDescriptor.isComputed() && propertyDescriptor.getPersistenceFormula() == null)) { return null; } Object propertyValue = retrievePropertyValue(propertyName); if (propertyValue == null && propertyDescriptor instanceof IBooleanPropertyDescriptor) { return Boolean.FALSE; } return propertyValue; }
getComponentContract(entity)); IPropertyDescriptor propertyDescriptor = entityDescriptor.getPropertyDescriptor(property.getKey()); include = (propertyDescriptor != null && !propertyDescriptor.isComputed());
private void checkIntegrity(Object proxy) { checkMandatoryProperties(proxy); if (propertyProcessorsEnabled) { for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { if (!propertyDescriptor.isComputed()) { propertyDescriptor.preprocessSetter(proxy, straightGetProperty(proxy, propertyDescriptor.getName())); } } } }
/** * Gets whether the entity property is dirty (has changes that need to be * updated to the persistent store). * * @param entity * the entity to test. * @param propertyName * the entity property to test. * @return true if the entity is dirty. */ @Override public boolean isDirty(IEntity entity, String propertyName) { if (entity == null) { return false; } Map<String, Object> entityDirtyProperties = getDirtyProperties(entity); if (entityDirtyProperties != null && entityDirtyProperties.containsKey(propertyName)) { IPropertyDescriptor propertyDescriptor = getEntityFactory().getComponentDescriptor(getComponentContract(entity)) .getPropertyDescriptor(propertyName); return propertyDescriptor != null && !propertyDescriptor.isComputed(); } return false; }
@Override public void doWithPersistentProperty(PersistentProperty<?> parentPersistentProperty) { String propertyName = parentPersistentProperty.getName(); IPropertyDescriptor propertyDescriptor = parentDescriptor.getPropertyDescriptor(propertyName); MongoPersistentProperty declaredPersistentProperty = entity.getPersistentProperty( PropertyHelper.toJavaBeanPropertyName(propertyName)); if (declaredPersistentProperty != null && declaredPersistentProperty.getSetter() == null && parentPersistentProperty.getSetter() != null) { try { // Some properties will be writable in parent but not locally, so we must fix their descriptor. PropertyDescriptor localDescriptor = (PropertyDescriptor) ReflectHelper.getPrivateFieldValue( AbstractPersistentProperty.class, "propertyDescriptor", declaredPersistentProperty); localDescriptor.setWriteMethod(parentPersistentProperty.getSetter()); } catch (IllegalAccessException | NoSuchFieldException | IntrospectionException e) { LOG.error("Could not extract propertyDescriptor {} from persistent class {}", propertyName, entityType.getName()); } } if (parentPersistentProperty instanceof MongoPersistentProperty && declaredPersistentProperty == null && !entityDeclaredPropertyNames.contains(propertyName) && propertyDescriptor != null && !propertyDescriptor.isComputed()) { entity.addPersistentProperty((MongoPersistentProperty) parentPersistentProperty); } } });
String propertyName = propertyEntry.getKey(); IPropertyDescriptor propertyDescriptor = entityDescriptor.getPropertyDescriptor(propertyName); if (propertyDescriptor != null && !propertyDescriptor.isComputed() && !IEntity.ID.equals(propertyName)) { String convertedPropertyName = getConverter().getMappingContext().getPersistentEntity(componentContract) .getPersistentProperty(PropertyHelper.toJavaBeanPropertyName(propertyName))
String tempAutoCompleteProperty = null; IPropertyDescriptor lpd = getPropertyDescriptor(getToStringProperty()); if (lpd != null && !lpd.isComputed()) { tempAutoCompleteProperty = lpd.getName(); } else {
(IReferencePropertyDescriptor<IComponent>) propertyDescriptor) && !propertyDescriptor.isComputed()) { Object inlineComponent = getProperty(proxy, propertyDescriptor); if (inlineComponent instanceof ILifecycleCapable) {
if (propertyDescriptor == null || (propertyDescriptor.isComputed() && propertyDescriptor.getPersistenceFormula() == null)) { return;
if (propertyDescriptor.isComputed()) {
if (propertyDescriptor == null || !propertyDescriptor.isComputed()) { Collection<Object> snapshotCollection = null; Object originalProperty = dirtyProperties.get(propertyName);
/** * Carbon copies all scalar properties. * * @param componentToClone * the source. * @param clonedComponent * the copy. * @param entityFactory * the entity factory to use. */ public static void carbonCopyComponent(IComponent componentToClone, IComponent clonedComponent, IEntityFactory entityFactory) { if (componentToClone == clonedComponent) { return; } IComponentDescriptor<?> componentDescriptor = entityFactory.getComponentDescriptor(componentToClone .getComponentContract()); for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { if (!(propertyDescriptor instanceof IRelationshipEndPropertyDescriptor) && /* propertyDescriptor.isModifiable() */!(propertyDescriptor.isComputed() && propertyDescriptor .getPersistenceFormula() == null)) { String propertyName = propertyDescriptor.getName(); clonedComponent.straightSetProperty(propertyName, ObjectUtils.cloneIfPossible(componentToClone.straightGetProperty(propertyName))); } } } }
private void checkMandatoryProperties(Object proxy) { if (propertyProcessorsEnabled) { for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { if (!propertyDescriptor.isComputed()) { if (propertyDescriptor.isMandatory()) { Object newValue = straightGetProperty(proxy, propertyDescriptor.getName()); if (newValue == null || (isInitialized(newValue) && newValue instanceof Collection<?> && ((Collection<?>) newValue).isEmpty())) { throw new MandatoryPropertyException(propertyDescriptor, proxy); } } if (propertyDescriptor instanceof ICollectionPropertyDescriptor<?> && !((ICollectionPropertyDescriptor<?>) propertyDescriptor).getReferencedDescriptor() .isNullElementAllowed()) { Object newValue = straightGetProperty(proxy, propertyDescriptor.getName()); if (isInitialized(newValue) && newValue instanceof Collection<?>) { for (Object element : ((Collection<?>) newValue)) { if (element == null) { throw new MandatoryPropertyException(propertyDescriptor, proxy); } } } } } } } }
.getColumnViewDescriptors()) { IPropertyDescriptor columnPropertyDescriptor = (IPropertyDescriptor) columnDescriptor.getModelDescriptor(); if (columnPropertyDescriptor != null && columnPropertyDescriptor.isComputed() || columnPropertyDescriptor instanceof IRelationshipEndPropertyDescriptor) { prefetchProperties.add(columnPropertyDescriptor.getName());
if (extensionClass != null) { return accessComputedProperty(propertyDescriptor, accessorInfo, extensionClass, proxy, method, args); } else if (!propertyDescriptor.isComputed()) { if (accessorInfo.isModifier()) { if (modifierMonitors != null && modifierMonitors.contains(methodName)) {
Class<? extends IComponent> componentContract = component.getComponentContract(); for (IPropertyDescriptor propertyDescriptor : entityDescriptor.getPropertyDescriptors()) { if (propertyDescriptor != null && !propertyDescriptor.isComputed()) { String propertyName = propertyDescriptor.getName(); Class<?> propertyType = propertyDescriptor.getModelType();