private void storeSimpleField(Object object, Node objectNode, ValueFactory valueFactory, FieldDescriptor fieldDescriptor, String fieldName, String jcrName) throws RepositoryException, PathNotFoundException, ValueFormatException, VersionException, LockException, ConstraintViolationException { boolean protectedProperty = isProtectedProperty(objectNode, fieldDescriptor, jcrName); if (!protectedProperty) { // DO NOT TRY TO WRITE PROTECTED PROPERTIES Object fieldValue = ReflectionUtils.getNestedProperty(object, fieldName); // if the value and if there is a default value for this field => set this default value String defaultValue = fieldDescriptor.getJcrDefaultValue(); if ((fieldValue == null) && (defaultValue != null)) { //Not sure that we have the attribute with the default value in all use cases ReflectionUtils.setNestedProperty(object, fieldName, defaultValue); fieldValue = ReflectionUtils.getNestedProperty(object, fieldName); } AtomicTypeConverter converter = getAtomicTypeConverter(fieldDescriptor, object, fieldName); Value value = converter.getValue(valueFactory, fieldValue); checkProperty(objectNode, fieldDescriptor, value); objectNode.setProperty(jcrName, value); } }
private void storeSimpleField(Object object, Node objectNode, ValueFactory valueFactory, FieldDescriptor fieldDescriptor, String fieldName, String jcrName) throws RepositoryException, PathNotFoundException, ValueFormatException, VersionException, LockException, ConstraintViolationException { boolean protectedProperty = isProtectedProperty(objectNode, fieldDescriptor, jcrName); if (!protectedProperty) { // DO NOT TRY TO WRITE PROTECTED PROPERTIES Object fieldValue = ReflectionUtils.getNestedProperty(object, fieldName); // if the value and if there is a default value for this field => set this default value String defaultValue = fieldDescriptor.getJcrDefaultValue(); if ((fieldValue == null) && (defaultValue != null)) { //Not sure that we have the attribute with the default value in all use cases ReflectionUtils.setNestedProperty(object, fieldName, defaultValue); fieldValue = ReflectionUtils.getNestedProperty(object, fieldName); } AtomicTypeConverter converter = getAtomicTypeConverter(fieldDescriptor, object, fieldName); Value value = converter.getValue(valueFactory, fieldValue); checkProperty(objectNode, fieldDescriptor, value); objectNode.setProperty(jcrName, value); } }
AtomicTypeConverter converter = getAtomicTypeConverter(fieldDescriptor, initializedBean, fieldName); Object fieldValue = (propValue != null) ? converter.getObject(propValue) : null; ReflectionUtils.setNestedProperty(initializedBean, fieldName, fieldValue);
AtomicTypeConverter converter = getAtomicTypeConverter(fieldDescriptor, initializedBean, fieldName); Object fieldValue = (propValue != null) ? converter.getObject(propValue) : null; ReflectionUtils.setNestedProperty(initializedBean, fieldName, fieldValue);