bool WSF_CALL AviaryCommon::ResourceLocation::deserialize(axiom_node_t** dp_parent,bool *dp_is_early_node_valid, bool dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; bool status = AXIS2_SUCCESS; const axis2_char_t* text_value = NULL; axutil_qname_t *mqname = NULL; int i = 0; int sequence_broken = 0; axiom_node_t *tmp_node = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; bool is_early_node_valid = true; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; while(parent && axiom_node_get_node_type(parent, Environment::getEnv()) != AXIOM_ELEMENT) { parent = axiom_node_get_next_sibling(parent, Environment::getEnv()); } if (NULL == parent) { return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, Environment::getEnv()); /* * building id element */ current_node = first_node; is_early_node_valid = false; while(current_node && axiom_node_get_node_type(current_node, Environment::getEnv()) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, Environment::getEnv()); } if(current_node != NULL) { current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, Environment::getEnv()); mqname = axiom_element_get_qname(current_element, Environment::getEnv(), current_node); } element_qname = axutil_qname_create(Environment::getEnv(), "id", NULL, NULL); if (isParticle() || (current_node && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname) || !axutil_strcmp("id", axiom_element_get_localname(current_element, Environment::getEnv()))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname) || !axutil_strcmp("id", axiom_element_get_localname(current_element, Environment::getEnv())))) { is_early_node_valid = true; } AviaryCommon::ResourceID* element = new AviaryCommon::ResourceID(); status = element->deserialize(¤t_node, &is_early_node_valid, false); if(AXIS2_FAILURE == status) { WSF_LOG_ERROR_MSG(Environment::getEnv()->log, WSF_LOG_SI, "failed in building adb object for element id"); } else { status = setId(element); } if(AXIS2_FAILURE == status) { WSF_LOG_ERROR_MSG( Environment::getEnv()->log,WSF_LOG_SI,"failed in setting the value for id "); if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); } /* this is not a nillable element*/ WSF_LOG_ERROR_MSG(Environment::getEnv()->log,WSF_LOG_SI, "non nillable or minOuccrs != 0 element id missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); element_qname = NULL; } { /* * building Location array */ std::vector<axutil_uri_t*>* arr_list =new std::vector<axutil_uri_t*>(); /* * building location element */ element_qname = axutil_qname_create(Environment::getEnv(), "location", NULL, NULL); for (i = 0, sequence_broken = 0, current_node = (is_early_node_valid?axiom_node_get_next_sibling(current_node, Environment::getEnv()):current_node); !sequence_broken && current_node != NULL;) { if(axiom_node_get_node_type(current_node, Environment::getEnv()) != AXIOM_ELEMENT) { current_node =axiom_node_get_next_sibling(current_node, Environment::getEnv()); is_early_node_valid = false; continue; } current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, Environment::getEnv()); mqname = axiom_element_get_qname(current_element, Environment::getEnv(), current_node); if (axutil_qname_equals(element_qname, Environment::getEnv(), mqname) || !axutil_strcmp("location", axiom_element_get_localname(current_element, Environment::getEnv()))) { is_early_node_valid = true; text_value = axiom_element_get_text(current_element, Environment::getEnv(), current_node); if(text_value != NULL) { arr_list->push_back(axutil_uri_parse_string(Environment::getEnv(), text_value)); } else { WSF_LOG_ERROR_MSG(Environment::getEnv()->log,WSF_LOG_SI, "NULL value is set to a non nillable element location"); status = AXIS2_FAILURE; } if(AXIS2_FAILURE == status) { WSF_LOG_ERROR_MSG(Environment::getEnv()->log, WSF_LOG_SI, "failed in setting the value for location "); if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); } if(arr_list) { delete arr_list; } return false; } i++; current_node = axiom_node_get_next_sibling(current_node, Environment::getEnv()); } else { is_early_node_valid = false; sequence_broken = 1; } } if (i < 0) { /* found element out of order */ WSF_LOG_ERROR_MSG( Environment::getEnv()->log,WSF_LOG_SI,"location (@minOccurs = '0') only have %d elements", i); if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); } if(arr_list) { delete arr_list; } return false; } if(0 == arr_list->size()) { delete arr_list; } else { status = setLocation(arr_list); } } if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); element_qname = NULL; } return status; }
bool WSF_CALL AviaryCommon::Scheduler::deserialize(axiom_node_t** dp_parent,bool *dp_is_early_node_valid, bool dont_care_minoccurs) { axiom_node_t *parent = *dp_parent; bool status = AXIS2_SUCCESS; const axis2_char_t* text_value = NULL; axutil_qname_t *mqname = NULL; axutil_qname_t *element_qname = NULL; axiom_node_t *first_node = NULL; bool is_early_node_valid = true; axiom_node_t *current_node = NULL; axiom_element_t *current_element = NULL; while(parent && axiom_node_get_node_type(parent, Environment::getEnv()) != AXIOM_ELEMENT) { parent = axiom_node_get_next_sibling(parent, Environment::getEnv()); } if (NULL == parent) { return AXIS2_FAILURE; } first_node = axiom_node_get_first_child(parent, Environment::getEnv()); /* * building id element */ current_node = first_node; is_early_node_valid = false; while(current_node && axiom_node_get_node_type(current_node, Environment::getEnv()) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, Environment::getEnv()); } if(current_node != NULL) { current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, Environment::getEnv()); mqname = axiom_element_get_qname(current_element, Environment::getEnv(), current_node); } element_qname = axutil_qname_create(Environment::getEnv(), "id", NULL, NULL); if (isParticle() || (current_node && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname) || !axutil_strcmp("id", axiom_element_get_localname(current_element, Environment::getEnv()))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname) || !axutil_strcmp("id", axiom_element_get_localname(current_element, Environment::getEnv())))) { is_early_node_valid = true; } AviaryCommon::ResourceID* element = new AviaryCommon::ResourceID(); status = element->deserialize(¤t_node, &is_early_node_valid, false); if(AXIS2_FAILURE == status) { WSF_LOG_ERROR_MSG(Environment::getEnv()->log, WSF_LOG_SI, "failed in building adb object for element id"); } else { status = setId(element); } if(AXIS2_FAILURE == status) { WSF_LOG_ERROR_MSG( Environment::getEnv()->log,WSF_LOG_SI,"failed in setting the value for id "); if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); } /* this is not a nillable element*/ WSF_LOG_ERROR_MSG(Environment::getEnv()->log,WSF_LOG_SI, "non nillable or minOuccrs != 0 element id missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); element_qname = NULL; } /* * building status element */ /* * because elements are ordered this works fine */ if(current_node != NULL && is_early_node_valid) { current_node = axiom_node_get_next_sibling(current_node, Environment::getEnv()); while(current_node && axiom_node_get_node_type(current_node, Environment::getEnv()) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, Environment::getEnv()); } if(current_node != NULL) { current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, Environment::getEnv()); mqname = axiom_element_get_qname(current_element, Environment::getEnv(), current_node); } } is_early_node_valid = false; element_qname = axutil_qname_create(Environment::getEnv(), "status", NULL, NULL); if (isParticle() || (current_node && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname) || !axutil_strcmp("status", axiom_element_get_localname(current_element, Environment::getEnv()))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname) || !axutil_strcmp("status", axiom_element_get_localname(current_element, Environment::getEnv())))) { is_early_node_valid = true; } AviaryCommon::Status* element = new AviaryCommon::Status(); status = element->deserialize(¤t_node, &is_early_node_valid, false); if(AXIS2_FAILURE == status) { WSF_LOG_ERROR_MSG(Environment::getEnv()->log, WSF_LOG_SI, "failed in building adb object for element status"); } else { status = setStatus(element); } if(AXIS2_FAILURE == status) { WSF_LOG_ERROR_MSG( Environment::getEnv()->log,WSF_LOG_SI,"failed in setting the value for status "); if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); } return AXIS2_FAILURE; } } else if(!dont_care_minoccurs) { if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); } /* this is not a nillable element*/ WSF_LOG_ERROR_MSG(Environment::getEnv()->log,WSF_LOG_SI, "non nillable or minOuccrs != 0 element status missing"); return AXIS2_FAILURE; } if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); element_qname = NULL; } /* * building summary element */ /* * because elements are ordered this works fine */ if(current_node != NULL && is_early_node_valid) { current_node = axiom_node_get_next_sibling(current_node, Environment::getEnv()); while(current_node && axiom_node_get_node_type(current_node, Environment::getEnv()) != AXIOM_ELEMENT) { current_node = axiom_node_get_next_sibling(current_node, Environment::getEnv()); } if(current_node != NULL) { current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, Environment::getEnv()); mqname = axiom_element_get_qname(current_element, Environment::getEnv(), current_node); } } is_early_node_valid = false; element_qname = axutil_qname_create(Environment::getEnv(), "summary", NULL, NULL); if (isParticle() || (current_node && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname) || !axutil_strcmp("summary", axiom_element_get_localname(current_element, Environment::getEnv()))))) { if( current_node && current_element && (axutil_qname_equals(element_qname, Environment::getEnv(), mqname) || !axutil_strcmp("summary", axiom_element_get_localname(current_element, Environment::getEnv())))) { is_early_node_valid = true; } AviaryCommon::SchedulerSummary* element = new AviaryCommon::SchedulerSummary(); status = element->deserialize(¤t_node, &is_early_node_valid, false); if(AXIS2_FAILURE == status) { WSF_LOG_ERROR_MSG(Environment::getEnv()->log, WSF_LOG_SI, "failed in building adb object for element summary"); } else { status = setSummary(element); } if(AXIS2_FAILURE == status) { WSF_LOG_ERROR_MSG( Environment::getEnv()->log,WSF_LOG_SI,"failed in setting the value for summary "); if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); } return AXIS2_FAILURE; } } if(element_qname) { axutil_qname_free(element_qname, Environment::getEnv()); element_qname = NULL; } return status; }