19 impl_value_set_property = {
36 #define XX(id, _) &afw_s_ ## id,
45 #define XX(id, has) has,
54 #define XX(id, _) { &afw_value_evaluated_string_inf, \
55 { #id, sizeof(#id) - 1 } },
80 *property_name = &first_property_name_entry->property_name;
81 for (entry = first_property_name_entry; entry->next; entry = entry->next)
83 *property_name = &entry->next->property_name;
85 &entry->property_name, xctx);
87 if (create_if_necessary) {
89 &entry->property_name, xctx);
114 obj = impl_find_object(&property_name,
true,
object,
115 first_property_name_entry, xctx);
132 return (entry_type[i]) ? i : afw_adaptor_modify_entry_type_invalid;
142 return (type < 0 || type >= afw_adaptor_modify_entry_type_invalid)
154 return (type < 0 || type >= afw_adaptor_modify_entry_type_invalid)
166 apr_array_header_t *ary;
198 if (entry->
type == afw_adaptor_modify_entry_type_invalid) {
211 property_name_entry->property_name.s = s->s;
212 property_name_entry->property_name.len = s->len;
215 for (names_i = NULL, prev_property_name_list = NULL;;) {
220 if (!prev_property_name_list) {
225 if (!prev_property_name_list) {
232 property_name_entry->property_name.s = s->s;
233 property_name_entry->property_name.len = s->len;
234 if (prev_property_name_list) {
235 prev_property_name_list->next = property_name_entry;
240 prev_property_name_list = property_name_entry;
246 if ((entry->
value && !entry_type_has_value[entry->
type]) ||
247 (!entry->
value && entry_type_has_value[entry->
type]))
269 "Modify entry tuple number %d is invalid",
292 for (e = entries; *e; e++) {
305 if ((*e)->first_property_name_entry->next) {
307 for (property_name_entry = (*e)->first_property_name_entry;
309 property_name_entry = property_name_entry->next)
312 &property_name_entry->property_name,
320 &(*e)->first_property_name_entry->property_name,
363 for (entry = entries; *entry; entry++)
365 first_property_name_entry = ((*entry)->first_property_name_entry);
366 value = (*entry)->value;
369 switch ((*entry)->type) {
373 case afw_adaptor_modify_entry_type_add_value:
378 " must be a defined and evaluated value",
380 &first_property_name_entry->property_name));
385 first_property_name_entry, xctx);
409 impl_set_property(
object, first_property_name_entry, value,
416 impl_set_property(
object, first_property_name_entry, value,
424 case afw_adaptor_modify_entry_type_remove_property:
426 obj = impl_find_object(&property_name,
false,
object,
427 first_property_name_entry, xctx);
429 impl_set_property(
object, first_property_name_entry, NULL,
437 case afw_adaptor_modify_entry_type_remove_value:
439 first_property_name_entry, xctx);
448 impl_set_property(
object, first_property_name_entry,
455 first_property_name_entry, p, xctx);
457 "Error: Value does not exist for property %"
462 impl_set_property(
object, first_property_name_entry,
471 first_property_name_entry, p, xctx);
473 "Error: Value does not exist for property %" AFW_UTF8_FMT,
481 case afw_adaptor_modify_entry_type_set_property:
483 obj = impl_find_object(&property_name,
true,
object,
484 first_property_name_entry, xctx);
503 impl_add_reconcile_property(
516 if (embedding_pt && !embedding_pt->allow_write) {
524 if (pt && !pt->allow_write) {
536 ? &entry_type_value[afw_adaptor_modify_entry_type_set_property]
537 : &entry_type_value[afw_adaptor_modify_entry_type_remove_property]);
541 if (property_names) {
569 impl_reconcile_object(
591 for (iterator = NULL;;) {
595 &iterator, &property_name, wa->xctx);
596 if (!modified_value)
break;
600 property_name, wa->xctx);
609 modified_value, wa->p, wa->xctx);
616 property_name, wa->xctx);
617 if (!original_value ||
621 impl_add_reconcile_property(wa,
622 embedding_pt, embedding_property_name,
624 property_names, modified_value);
641 object_type_id = pt->data_type_parameter;
647 if (!object_type_id) {
649 modified_value)->internal;
661 if (!object_type_id) {
663 original_value)->internal;
672 property_object_type = NULL;
673 if (object_type_id) {
675 object_type->adaptor_id, object_type_id,
679 if (!property_object_type) {
681 "object type needed to reconcile embedded object",
686 impl_reconcile_object(wa,
688 property_object_type,
699 original_value, wa->p, wa->xctx);
702 impl_add_reconcile_property(wa,
703 embedding_pt, embedding_property_name,
705 property_names, modified_value);
712 for (iterator = NULL;;) {
714 &iterator, &property_name, wa->xctx);
715 if (!original_value)
break;
720 property_name, wa->xctx);
721 impl_add_reconcile_property(wa,
722 embedding_pt, embedding_property_name,
724 property_names, NULL);
751 if (!original_path || !path || !
afw_utf8_equal(original_path, path))
754 "reconcile expects original and modified "
761 if (!parsed_path || parsed_path->first_property_name) {
763 "reconcile_object() expects path to be an entity",
766 *adaptor_id = &parsed_path->adaptor_id;
767 *object_type_id = &parsed_path->object_type_id;
768 *object_id = &parsed_path->entity_object_id;
771 journal_entry, xctx);
784 impl_reconcile_object(&wa, NULL, NULL, object_type, NULL,
785 original, modified, journal_entry);
787 *entries = wa.entries;
811 journal_entry, &afw_s_request, xctx);
812 impl_request.
p = request->p;
823 &afw_s_resourceId, impl_request.
resource_id, xctx);
825 &afw_s_function, &afw_s_modify_object, xctx);
827 &afw_s_adaptorId, adaptor_id, xctx);
829 &afw_s_objectType, object_type_id, xctx);
831 &afw_s_objectId, object_id, xctx);
833 &afw_s_entries, entries, xctx);
842 afw_adaptor_internal_journal_prologue(session, journal_entry, xctx);
853 "modify_object() is not supported for "
861 object_type_id, object_id, entry,
862 adaptor_type_specific, xctx);
907 &iterator, &property_name, xctx)))
915 property_name, xctx->p, xctx);
924 adaptor_id, object_type_id, object_id,
925 entries, journal_entry, adaptor_type_specific, xctx);
AFW_DEFINE(const afw_object_t *)
Adaptive Framework Core Internal.
void afw_adaptor_internal_journal_epilogue(const afw_adaptor_session_t *session, const afw_object_t *journal_entry, afw_boolean_t modification, afw_xctx_t *xctx)
#define afw_adaptor_session_modify_object(instance, impl_request, object_type_id, object_id, entry, adaptor_type_specific, xctx)
Call method modify_object of interface afw_adaptor_session.
afw_adaptor_modify_using_update_object(const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, const afw_object_t *update_object, const afw_object_t *journal_entry, const afw_object_t *adaptor_type_specific, afw_xctx_t *xctx)
Modify using update object and remove from cache.
afw_adaptor_modify_entries_apply_to_unnormalized_object(const afw_adaptor_modify_entry_t *const *entries, const afw_object_t *object, afw_xctx_t *xctx)
Apply modify entries to an unnormalized object.
afw_adaptor_modify_entry_type_value(afw_adaptor_modify_entry_type_t type)
Convert entry type enum to value.
afw_adaptor_modify_entries_from_list(const afw_list_t *list, const afw_pool_t *p, afw_xctx_t *xctx)
Create modify entries from list of tuple lists in specified pool.
afw_adaptor_modify_entry_type_mnemonic(afw_adaptor_modify_entry_type_t type)
Convert entry type enum to mnemonic.
afw_adaptor_modify_needed_to_reconcile(const afw_utf8_t **adaptor_id, const afw_utf8_t **object_type_id, const afw_utf8_t **object_id, const afw_list_t **entries, const afw_object_t *original, const afw_object_t *modified, const afw_object_t *journal_entry, const afw_pool_t *p, afw_xctx_t *xctx)
Produce modify needed to reconcile two objects.
afw_adaptor_session_get_cached(const afw_utf8_t *adaptor_id, afw_boolean_t begin_transaction, afw_xctx_t *xctx)
Get/create an active cached session for adaptor_id.
afw_adaptor_get_object_type(const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_object_t *journal_entry, afw_xctx_t *xctx)
Get and cache AdaptiveObjectType object.
afw_adaptor_modify_entry_type(const afw_utf8_t *mnemonic)
Convert entry type mnemonic to enum.
afw_adaptor_modify_object(const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, const afw_list_t *entries, const afw_object_t *journal_entry, const afw_object_t *adaptor_type_specific, afw_xctx_t *xctx)
Modify object and remove from cache.
#define AFW_ADAPTOR_MODIFY_ENTRY_TYPE_MAP(XX)
Adaptor session modify type map.
enum afw_adaptor_modify_entry_type_e afw_adaptor_modify_entry_type_t
Adaptor session modify type enum.
afw_adaptor_modify_entries_to_list(const afw_adaptor_modify_entry_t *const *entries, const afw_pool_t *p, afw_xctx_t *xctx)
Create a list from modify entries in specified pool.
afw_value_create_list(const afw_list_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type list value.
#define afw_value_is_list(A_VALUE)
Macro to determine if value is evaluated list.
afw_data_type_list
Data type struct for list.
#define afw_list_of_list_get_next(list, iterator, xctx)
Get next value from list of list.
afw_value_as_list(const afw_value_t *value, afw_xctx_t *xctx)
Typesafe cast of data type list.
afw_object_set_property_as_list(const afw_object_t *object, const afw_utf8_t *property_name, const afw_list_t *internal, afw_xctx_t *xctx)
Set property function for data type list values.
#define afw_value_is_object(A_VALUE)
Macro to determine if value is evaluated object.
#define afw_object_old_get_property_as_object(object, property_name, xctx)
Get property function for data type object value.
afw_value_create_string(const afw_utf8_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type string value.
afw_data_type_string
Data type struct for string.
#define afw_list_of_string_get_next(list, iterator, xctx)
Get next value from list of string.
afw_value_evaluated_string_inf
Unmanaged evaluated value inf for data type string.
#define afw_value_is_string(A_VALUE)
Macro to determine if value is evaluated string.
afw_object_set_property_as_string(const afw_object_t *object, const afw_utf8_t *property_name, const afw_utf8_t *internal, afw_xctx_t *xctx)
Set property function for data type string values.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
#define AFW_UTF8_LITERAL(A_STRING)
String literal initializer.
struct afw_iterator_s afw_iterator_t
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
#define AFW_THROW_ERROR_FZ(code, xctx, format_z,...)
Macro used to set error and 0 rv in xctx and throw it.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
#define afw_list_get_next_value(instance, iterator, p, xctx)
Call method get_next_value of interface afw_list.
afw_list_remove_value(const afw_list_t *instance, const afw_value_t *value, afw_xctx_t *xctx)
Call method remove_value of interface afw_list_setter.
const afw_list_t * afw_list_create_or_clone(const afw_list_t *list, const afw_data_type_t *data_type, afw_boolean_t clone_values, const afw_pool_t *p, afw_xctx_t *xctx)
Create a clone of a list in memory.
#define afw_list_create_generic(p, xctx)
Create an value list in memory.
afw_list_add_value(const afw_list_t *instance, const afw_value_t *value, afw_xctx_t *xctx)
Call method add_value of interface afw_list_setter.
#define afw_list_of_create(data_type, p, xctx)
Create an list of a specific data type in memory.
#define afw_memory_clear(to)
Clear preallocated memory for sizeof(*(to)).
#define afw_object_get_property(instance, property_name, xctx)
Call method get_property of interface afw_object.
#define afw_object_get_next_property(instance, iterator, property_name, xctx)
Call method get_next_property of interface afw_object.
#define afw_object_has_property(instance, property_name, xctx)
Call method has_property of interface afw_object.
afw_object_path_property_name_list_get_property(const afw_object_t *object, const afw_object_path_property_name_entry_t *first_property_name, afw_xctx_t *xctx)
Get object property value using property names.
afw_object_path_parse(const afw_utf8_t *path, const afw_utf8_t *current_path, const afw_object_options_t *default_options, const afw_pool_t *p, afw_xctx_t *xctx)
Parse an object value path in specific pool.
afw_object_path_make_property_name_expression(const afw_object_path_property_name_entry_t *first, const afw_pool_t *p, afw_xctx_t *xctx)
Construct a property name expression from property name list.
afw_object_type_property_type_get(const afw_object_type_t *object_type, const afw_utf8_t *property_name, afw_xctx_t *xctx)
Get property type object for property.
afw_object_type_property_type_normalize(const afw_object_type_property_type_t *pt, const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Normalize a value based on property type.
#define AFW_OBJECT_S_CORE_ID_PREFIX
String prefix for all core adaptive object types.
#define AFW_OBJECT_Q_OBJECT_TYPE_ID_JOURNAL_ENTRY
Quoted object type id for Journal Entry object.
afw_object_set_property(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_value_t *value, afw_xctx_t *xctx)
Set the value of an object's property.
#define AFW_OBJECT_S_OBJECT_TYPE_ID_JOURNAL_ENTRY
String object type id for Journal Entry object.
const afw_object_t * afw_object_create_embedded(const afw_object_t *embedding_object, const afw_utf8_t *property_name, afw_xctx_t *xctx)
Create an empty embedded object in a memory object.
#define afw_pool_get_apr_pool(instance)
Call method get_apr_pool of interface afw_pool.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
afw_boolean_t afw_utf8_equal(const afw_utf8_t *s1, const afw_utf8_t *s2)
Check to see if a string equals another string.
afw_utf8_printf(const afw_pool_t *p, afw_xctx_t *xctx, const afw_utf8_z_t *format,...)
Create a utf-8 string using a c format string in specified pool.
afw_boolean_t afw_utf8_starts_with(const afw_utf8_t *string, const afw_utf8_t *starts_with)
Check to see if a string starts with another string.
afw_value_equal(const afw_value_t *value1, const afw_value_t *value2, afw_xctx_t *xctx)
Test whether two values are equal.
#define afw_value_is_defined_and_evaluated(A_VALUE)
Macro to determine if value is defined and evaluated.
Internal request info used by afw_adaptor_impl*() functions.
const afw_utf8_t * resource_id
resource id
const afw_object_t * journal_entry
Journal entry.
const afw_object_t * request
Request object.
const afw_pool_t * p
Pool used.
afw_adaptor_modify_entry_type_t type
Modify type.
const afw_value_t * value
Associated value.
const afw_object_path_property_name_entry_t * first_property_name_entry
First entry in property name list.
Interface afw_adaptor_session public struct.
Interface afw_list public struct.
Typedef for parsed object path.
Property name path struct.
Interface afw_object public struct.
Struct for afw_object_type_property_type_t.
Struct for afw_object_type_t.
Interface afw_pool public struct.
NFC normalized UTF-8 string.
struct for data type list values.
struct for data type object values.
Interface afw_value public struct.
struct for data type string values.
Interface afw_xctx public struct.