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; }
/** * 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; }
if (ancestorDescs != null) { for (IComponentDescriptor<?> ancestorDescriptor : ancestorDescs) { for (IPropertyDescriptor propertyDescriptor : ancestorDescriptor.getPropertyDescriptors()) { allDescriptors.put(propertyDescriptor.getName(), propertyDescriptor);
String fixedPropertyName = propertyName; if (propertyDescriptor == null) { for (IPropertyDescriptor pd : baseComponentDescriptor.getPropertyDescriptors()) { if (propertyName.equals(pd.getPersistenceFormula())) { fixedPropertyName = pd.getName();
for (IPropertyDescriptor propertyDescriptor : getQueriedComponentsDescriptor().getPropertyDescriptors()) { propertyDescriptors.add(propertyDescriptor.createQueryDescriptor());
private void checkIntegrity(Object proxy) { checkMandatoryProperties(proxy); if (propertyProcessorsEnabled) { for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { if (!propertyDescriptor.isComputed()) { propertyDescriptor.preprocessSetter(proxy, straightGetProperty(proxy, propertyDescriptor.getName())); } } } }
/** * Process. * * @param componentDescriptor * the component descriptor */ protected void process(IComponentDescriptor<?> componentDescriptor) { String compPermId = componentDescriptor.getPermId(); if (compPermId != null) { if (isPermIdExcluded(compPermId) || modelPermIds.contains(compPermId)) { return; } modelPermIds.add(compPermId); } for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { process(propertyDescriptor, compPermId, modelPermIds); if (propertyDescriptor instanceof IRelationshipEndPropertyDescriptor) { if (propertyDescriptor instanceof IReferencePropertyDescriptor<?>) { process(((IReferencePropertyDescriptor<?>) propertyDescriptor).getReferencedDescriptor()); } else if (propertyDescriptor instanceof ICollectionPropertyDescriptor<?>) { process( ((ICollectionPropertyDescriptor<?>) propertyDescriptor).getReferencedDescriptor().getElementDescriptor()); } } } }
for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { if (propertyDescriptor instanceof IReferencePropertyDescriptor<?> && EntityHelper.isInlineComponentReference( (IReferencePropertyDescriptor<IComponent>) propertyDescriptor) && !propertyDescriptor.isComputed()) {
Map<String, Object> newMap = new ObjectEqualityMap<>(); for (IPropertyDescriptor propertyDescriptor : componentDescriptor .getPropertyDescriptors()) { if (propertyDescriptor instanceof IScalarPropertyDescriptor && ((IScalarPropertyDescriptor) propertyDescriptor).getDefaultValue() != null) {
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); } } } } } } } }
/** * 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))); } } } }
for (IPropertyDescriptor propertyDescriptor : componentDescriptor.getPropertyDescriptors()) { String propertyName = propertyDescriptor.getName(); if (propertyDescriptor instanceof ICollectionPropertyDescriptor<?>) {
for (IPropertyDescriptor propertyDescriptor : getComponentDescriptor().getPropertyDescriptors()) { if (propertyDescriptor instanceof EnumQueryStructureDescriptor) { EnumQueryStructure enumQueryStructure = new EnumQueryStructure(
if (modelDescriptor instanceof IComponentDescriptor<?>) { for (IPropertyDescriptor propertyDescriptor : ((IComponentDescriptor<?>) modelDescriptor) .getPropertyDescriptors()) { if (propertyDescriptor instanceof IScalarPropertyDescriptor && ((IScalarPropertyDescriptor) propertyDescriptor)
IComponent component, IEntityRegistry readerRegistry) { Class<? extends IComponent> componentContract = component.getComponentContract(); for (IPropertyDescriptor propertyDescriptor : entityDescriptor.getPropertyDescriptors()) { if (propertyDescriptor != null && !propertyDescriptor.isComputed()) { String propertyName = propertyDescriptor.getName();