$PBExportHeader$eaf_n_cst_argumentservice.sru forward global type eaf_n_cst_argumentservice from n_cst_baseservice end type end forward global type eaf_n_cst_argumentservice from n_cst_baseservice long il_languageid = 0 string is_crlf = "" event activate pbm_component_activate event deactivate pbm_component_deactivate end type global eaf_n_cst_argumentservice eaf_n_cst_argumentservice type variables Public: constant string STRINGNAME = "string" constant string DATENAME = "date" constant string TIMENAME = "time" constant string DATETIMENAME = "datetime" constant string NUMBERNAME = "number" constant string STRINGARRAYNAME = "string array" constant string DATEARRAYNAME = "date array" constant string TIMEARRAYNAME = "time array" constant string DATETIMEARRAYNAME = "datetime array" constant string NUMBERARRAYNAME = "number array" constant string STRINGLISTNAME = "stringlist" constant string DATELISTNAME = "datelist" constant string TIMELISTNAME = "timelist" constant string DATETIMELISTNAME = "datetimelist" constant string NUMBERLISTNAME = "numberlist" constant string LONGNAME = "long" constant string INTEGERNAME = "integer" constant string DECIMALNAME = "decimal" constant string DOUBLENAME = "double" constant string REALNAME = "real" constant string UNSIGNEDINTEGERNAME = "unsignedinteger" constant string UNSIGNEDLONGNAME = "unsignedlong" //Temporarily public n_cst_argumentattrib inv_childargumentattrib[] Protected: constant string PAIR_SEPARATOR = "," constant string ARRAY_SEPARATOR = "^" constant string ARGUMENT_SEPARATOR = "|" constant string ESCAPE_CHAR = "%" constant string ARGUMENTS_ELEMENT_NAME = "EAFArguments" constant string ARGUMENT_ELEMENT_NAME = "EAFArgument" constant string ARGUMENT_NAME_ELEMENT_NAME = "EAFArgumentName" constant string ARGUMENT_VALUE_ELEMENT_NAME = "EAFArgumentValue" constant string ARGUMENT_ISNULL_ELEMENT_NAME = "EAFArgumentIsNull" constant string CHILD_ARGUMENTS_ELEMENT_NAME = "EAFChildArguments"; constant string CHILD_ARGUMENT_ELEMENT_NAME = "EAFChildArgument"; constant string CHILD_ARGUMENT_CHILD_NAME_ELEMENT_NAME = "EAFChildArgumentChildName"; constant string CHILD_ARGUMENT_NAME_ELEMENT_NAME = "EAFChildArgumentName"; constant string CHILD_ARGUMENT_VALUE_ELEMENT_NAME = "EAFChildArgumentValue"; constant string CHILD_ARGUMENT_ISNULL_ELEMENT_NAME = "EAFChildArgumentIsNull"; string is_datemask = "mm/dd/yyyy" string is_timemask = "hh:mm:ss.ffffff" string is_specialchars[] string is_specialchars_escaped[] //DataSet arguments n_cst_argumentattrib inv_argumentattrib[] end variables forward prototypes protected function string unescape (string as_string) public function long anytoarginfo (any aa_args[], ref s_arginfo astr_arginfo) protected function long buildescape () protected function string escape (string as_string) public function long arginfotostring (s_arginfo astr_arginfos[], ref string as_result) public function long stringtoarginfo (string as_argstring, ref s_arginfo astr_arginfos[]) public function long arginfotoany (s_arginfo astr_arginfos[], ref any aa_args[]) public function long arginfotoany (s_arginfo astr_arginfo, ref any aa_args[]) public function long preparearguments (string as_argumentnames[], string as_argumenttypes[]) public function long getboundarguments (ref any aa_arguments[]) public function long getargument (string as_argumentname, ref string as_argumentvalues[]) public function long anytoarginfo (any aa_arg, boolean ab_array, ref s_arginfo astr_arginfo) public function long getargument (string as_argumentname, ref string as_argumentvalue) public function long stringtoany (string as_value, string as_classname, boolean ab_isnull, ref any aa_value) public function long addargument (string as_name, any aa_values[]) public function long prepareattrib (string as_name, any aa_values[], ref n_cst_argumentattrib anv_attrib) public function long addargument (string as_name, any aa_value) public function long addchildargument (string as_childcolumnname, string as_name, any aa_values[]) public function long addchlidargument (string as_childcolumnname, string as_name, any aa_value) public function long reset () public function long addargument (string as_name, blob ab_value) public function long getargument (string as_argumentname, ref blob ab_argumentvalue) public function long initialize (string axml_document, blob ab_argumentvalue) public function long initialize (string axml_document) public function long toxml (ref string as_document, ref blob ab_data) public function long toxml (ref string as_document) end prototypes protected function string unescape (string as_string);/////////////////////////////////////////////////////////////////////////////////// // Description: // Performs an Un-Escape operation on the passed in string // Revisions // 1.0 - Initial version // Arguments: // as_string - The string on which to perform the Un-Escape operation // Returns: // The result of the Un-Escape operation /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "unescape " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "(as_string) " + "as_string='"+as_string+"'") End If // Declare local variables long ll_idx long ll_upper n_cst_helperservice lnv_helper // Validate arguments If IsNull(as_string) Or Len(Trim(as_string)) = 0 Then Return as_string End If lnv_helper = create n_cst_helperservice inv_log.propagateSettings( lnv_helper ) // Loop around replacing all SpecialChars from // EscapedChars to NotEscapedChars ll_upper = UpperBound (is_specialchars) For ll_idx = 1 To ll_upper as_string = lnv_helper.globalReplace(as_string, is_specialchars_escaped[ll_idx], is_specialchars[ll_idx], true) Next destroy lnv_helper Return as_string end function public function long anytoarginfo (any aa_args[], ref s_arginfo astr_arginfo);/////////////////////////////////////////////////////////////////////////////////// // Description: // Converts the passed in Any array argument into an // argInfo Structure // Revisions // 1.0 - Initial version // Arguments: // aa_args[] - The argument array to convert into an argInfo Structure // astr_arginfo - The created argInfo structure // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "anyToArgInfo " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "(aa_args[], astr_arginfo)") End If // Declare local variables long ll_upper long ll_idx long ll_method_rc = 1 string ls_classname string ls_value boolean lb_null s_arginfo lstr_arginfo // Perform cleanup astr_arginfo = lstr_arginfo // Validate arguments ll_upper = upperBound(aa_args) If ll_upper <= 0 Then addError(METHOD_NAME, "Invalid aa_arg argument via upperBound check") Return -1 End If // Loop around all entries For ll_idx = 1 To ll_upper If IsNull(aa_args[ll_idx]) Then ls_value = '' ls_classname = '' lb_null = true else lb_null = false // Translate the information ls_classname = classname(aa_args[ll_idx]) Choose Case ls_classname Case STRINGNAME ls_value = aa_args[ll_idx] Case LONGNAME, INTEGERNAME, DECIMALNAME, DOUBLENAME, & REALNAME, UNSIGNEDINTEGERNAME, UNSIGNEDLONGNAME // Store all numbers as double ls_value = string(aa_args[ll_idx]) ls_classname = NUMBERNAME Case DATENAME ls_value = string(aa_args[ll_idx], is_datemask) Case TIMENAME ls_value = string(aa_args[ll_idx], is_timemask) Case DATETIMENAME ls_value = string(aa_args[ll_idx], is_datemask+' '+is_timemask) Case Else // Error was encountered, continue building argInfo // and store error condition for method return ls_value = '' ls_classname += '-Unknown' ll_method_rc = -1 addError(METHOD_NAME, "Encountered Unknown data type") End Choose end if // Put the new entry into the argInfo structure astr_arginfo.s_data[ll_idx] = ls_value astr_arginfo.s_type[ll_idx] = ls_classname astr_arginfo.b_null = lb_null Next Return ll_method_rc end function protected function long buildescape ();/////////////////////////////////////////////////////////////////////////////////// // Description: // Creates the Escape and unEscape information // Revisions // 1.0 - Initial version // Arguments: // None // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "buildEscape " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "") End If // Declare local variables long ll_idx long ll_upper string ls_empty[] string ls_seq[] = {ESCAPE_CHAR, PAIR_SEPARATOR, ARRAY_SEPARATOR, ARGUMENT_SEPARATOR} // Perform cleanup is_specialchars_escaped = ls_empty // Build the Escape sequence is_specialchars = ls_seq // Build the unEscape sequence to match the Escape sequence ll_upper = UpperBound (is_specialchars) For ll_idx = 1 To ll_upper is_specialchars_escaped[ll_idx] = escape_char + string(asc(is_specialchars[ll_idx]),'000') Next Return 1 end function protected function string escape (string as_string);/////////////////////////////////////////////////////////////////////////////////// // Description: // Performs an Escape operation on the passed in string // Revisions // 1.0 - Initial version // Arguments: // as_string - The string on which to perform the Escape operation // Returns: // The result of the Escape operation /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "escape " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "(as_string) " + "as_string='"+as_string+"'") End If // Declare local variables long ll_idx long ll_upper n_cst_helperservice lnv_helper // Validate arguments If IsNull(as_string) Or Len(Trim(as_string)) = 0 Then Return as_string End If lnv_helper = create n_cst_helperservice inv_log.propagateSettings( lnv_helper ) // Loop around replacing all SpecialChars from // EscapedChars to NotEscapedChars ll_upper = UpperBound (is_specialchars) For ll_idx = 1 To ll_upper as_string = lnv_helper.globalReplace(as_string, is_specialchars[ll_idx], is_specialchars_escaped[ll_idx], true) Next destroy lnv_helper Return as_string end function public function long arginfotostring (s_arginfo astr_arginfos[], ref string as_result);/////////////////////////////////////////////////////////////////////////////////// // Description: // Converts the passed in argIfno Structure and // converts it into a single string // Revisions // 1.0 - Initial version // Arguments: // astr_arginfos[] - The argInfo Structure to convert to a string // as_result - The string created from the argInfo Structure // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "argInfoToString " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "(astr_arginfos[], as_result)") End If // Declare local variables long ll_upper long ll_upper2 long ll_idx long ll_idx2 s_arginfo lstr_arginfo_single // Perform cleanup as_result = "" // Validate arguments If IsNull(astr_arginfos) Then addError(METHOD_NAME, "Invalid astr_arginfos argument") Return -1 End If // Loop around all entries passed in ll_upper = upperBound(astr_arginfos) For ll_idx = 1 To ll_upper // Get a single argument at a time lstr_arginfo_single = astr_arginfos[ll_idx] // Loop around all entries in the single argument ll_upper2 = upperBound(lstr_arginfo_single.s_data) For ll_idx2 = 1 To ll_upper2 // For string entries, Handle with special characters If lstr_arginfo_single.s_type[ll_idx2] = STRINGNAME Then lstr_arginfo_single.s_data[ll_idx2] = & escape(lstr_arginfo_single.s_data[ll_idx2]) End If // Build the Type/Data/Null portion as_result += lstr_arginfo_single.s_type[ll_idx2] + & PAIR_SEPARATOR + & lstr_arginfo_single.s_data[ll_idx2] + & PAIR_SEPARATOR If lstr_arginfo_single.b_null Then as_result += 'T' Else as_result += 'F' End If // Add the Array Separator If ll_idx2 < ll_upper2 Then as_result += ARRAY_SEPARATOR End If Next // Add the Argument Separator If ll_idx < ll_upper Then as_result += ARGUMENT_SEPARATOR End If Next Return 1 end function public function long stringtoarginfo (string as_argstring, ref s_arginfo astr_arginfos[]);/////////////////////////////////////////////////////////////////////////////////// // Description: // Converts the passed in String and converts it into a // an array of argInfo structures // Revisions // 1.0 - Initial version // Arguments: // as_argstring - The string to convert into an array of // argInfo structures // astr_arginfo[] - The array of argInfo Structure created from // the string // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "stringToArgInfo " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "(as_argstring, astr_arginfos[])~r~n" + & " as_argstring="+as_argstring) End If // Declare local variables long ll_upper long ll_idx long ll_array_cnt long ll_array_idx long ll_rc string ls_args[] string ls_data[] string ls_type[] string ls_entry[] string ls_array[] string ls_empty[] s_arginfo lstr_empty[] n_cst_helperservice lnv_helper // Perform cleanup astr_arginfos = lstr_empty // Validate arguments If IsNull(as_argstring) Or Len(Trim(as_argstring)) = 0 Then addError(METHOD_NAME, "Invalid as_argstring argument") Return -1 End If try lnv_helper = create n_cst_helperservice inv_log.propagateSettings( lnv_helper ) // Parse the string into an array lnv_helper.parseStringToArray(as_argstring, ARGUMENT_SEPARATOR, ls_args) // Loop around the newly created array ll_upper = upperBound(ls_args) For ll_idx = 1 To ll_upper lnv_helper.parseStringToArray(ls_args[ll_idx], ARRAY_SEPARATOR, ls_array) // Determine if there are arrays in the arguments ll_array_cnt = upperbound(ls_array) ls_type = ls_empty // initialize the temporary arrays ls_entry = ls_empty ls_data = ls_empty For ll_array_idx = 1 To ll_array_cnt // Yes an argument holding an array has been found, convert it into an array ll_rc = lnv_helper.parseStringToArray(ls_array[ll_array_idx],PAIR_SEPARATOR, ls_entry) If isNull(ll_rc) Or ll_rc <= 0 Then addError(METHOD_NAME, "Invalid parseStringToArray() operation") Return -1 End If // Confirm the created array is valid If upperBound(ls_entry) <> 3 Then addError(METHOD_NAME, "Invalid upperBound() <> 3 check") Return -1 End If // Process the converted entry ls_type[ll_array_idx] = ls_entry[1] ls_entry[2] = unescape(ls_entry[2]) ls_data[ll_array_idx] = ls_entry[2] astr_arginfos[ll_idx].b_null = (ls_entry[3] = 'T') Next astr_arginfos[ll_idx].s_type = ls_type astr_arginfos[ll_idx].s_data = ls_data Next finally destroy lnv_helper end try Return 1 end function public function long arginfotoany (s_arginfo astr_arginfos[], ref any aa_args[]);/////////////////////////////////////////////////////////////////////////////////// // Description: // Converts the passed in array of argInfo into an array of any // Revisions // 1.0 - Initial version // Arguments: // astr_arginfos[] - The array argInfo structure to convert into an any array // aa_args[] - The created array of anys // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "argInfoToAny " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "(astr_arginfos[], aa_args[])") End If // Declare local variables long ll_upper long ll_idx long ll_numargs long ll_rc any la_array[] any la_empty[] s_arginfo lstr_arginfo_single // Perform cleanup aa_args = la_empty // Validate arguments If IsNull(astr_arginfos) Then addError(METHOD_NAME, "Invalid astr_arginfos argument") Return -1 End If ll_upper = upperBound(astr_arginfos) If ll_upper <= 0 Then addError(METHOD_NAME, "Invalid astr_arginfos argument via upperBound check") Return -1 End If // Loop around each argInfo For ll_idx = 1 To ll_upper // Clear out la_array = la_empty // Get one instance lstr_arginfo_single = astr_arginfos[ll_idx] // Convert the argInfo into an array of Any ll_rc = argInfoToAny(lstr_arginfo_single, la_array) // As appropriate move into a single variable or an array If upperBound(la_array) = 1 Then aa_args[ll_idx] = la_array[1] Else aa_args[ll_idx] = la_array End If Next Return 1 end function public function long arginfotoany (s_arginfo astr_arginfo, ref any aa_args[]);/////////////////////////////////////////////////////////////////////////////////// // Description: // Converts the passed in argInfo into an array of any // Revisions // 1.0 - Initial version // Arguments: // astr_arginfo - The argInfo structure to convert into an any array // aa_args[] - The created array of anys // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "argInfoToAny " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "(astr_arginfo, aa_args[])") End If // Declare local variables long ll_upper long ll_idx long ll_posi double ldbl_null string ls_classname string ls_temp string ls_null any la_empty[] date ld_date date ld_null time ltm_time time ltm_null datetime ldt_null // Perform cleanup aa_args = la_empty // Validate arguments If IsNull(astr_arginfo) Then addError(METHOD_NAME, "Invalid astr_arginfo argument") Return -1 End If ll_upper = upperBound(astr_arginfo.s_data) If ll_upper <= 0 Then addError(METHOD_NAME, "Invalid astr_arginfo argument via upperBound check") Return -1 End If // Loop around all entries creating a new Any entry for ll_idx = 1 to ll_upper ls_classname = astr_arginfo.s_type[ll_idx] Choose Case ls_classname Case STRINGNAME if astr_arginfo.b_null then setnull(ls_null) aa_args[ll_idx] = ls_null else aa_args[ll_idx] = astr_arginfo.s_data[ll_idx] end if Case NUMBERNAME // do all numbers as double if astr_arginfo.b_null then setnull(ldbl_null) aa_args[ll_idx] = ldbl_null else aa_args[ll_idx] = double(astr_arginfo.s_data[ll_idx]) end if Case DATENAME if astr_arginfo.b_null then setnull(ld_null) aa_args[ll_idx] = ld_null else aa_args[ll_idx] = date(astr_arginfo.s_data[ll_idx]) end if Case TIMENAME if astr_arginfo.b_null then setnull(ltm_null) aa_args[ll_idx] = ltm_null else aa_args[ll_idx] = time(astr_arginfo.s_data[ll_idx]) end if Case DATETIMENAME // Since there is no intrinsic function to convert // a datetime string format back into a datetime variable if astr_arginfo.b_null then setnull(ldt_null) aa_args[ll_idx] = ldt_null else ls_temp = astr_arginfo.s_data[ll_idx] ll_posi = pos(ls_temp,' ') ls_temp = left(ls_temp,ll_posi - 1) ld_date = date(ls_temp) ls_temp = astr_arginfo.s_data[ll_idx] ll_posi = len(ls_temp) - ll_posi ls_temp = right(ls_temp,ll_posi) ltm_time = time(ls_temp) aa_args[ll_idx] = datetime(ld_date,ltm_time) end if Case Else addError(METHOD_NAME, "Encountered Unknown type") Return -1 End Choose Next Return 1 end function public function long preparearguments (string as_argumentnames[], string as_argumenttypes[]);/////////////////////////////////////////////////////////////////////////////////// // Description: // Prepare arguments with type information, order and bound properties // // // Revisions // 2.1 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "prepareArguments " long ll_argumentcount long ll_argumentindex long ll_argumentattribcount long ll_argumentattribindex long ll_idx long ll_upper long ll_suppliedargumentcount double ldbl_null string ls_classname string ls_temp string ls_null string ls_holder any la_empty[] date ld_date date ld_null time ltm_time time ltm_null datetime ldt_null long ll_pos boolean lb_matchfound boolean lb_retrievebyorder inv_log.traceLog (METHOD_NAME, "" ) ll_argumentcount = upperBound( as_argumentnames ) ll_argumentattribcount = upperBound( inv_argumentattrib ) //Determine if retrieval arguments have been specified in order if getArgument ( inv_constants.EAF_RETRIEVAL_ARGUMENT_STYLE_ARGUMENT_NAME, ls_holder ) = 1 then if ls_holder = inv_constants.EAF_RETRIEVAL_ARGUMENTS_BY_ORDER then lb_retrievebyorder = true end if end if if lb_retrievebyorder then // Arguments have been passed in by order //Get the supplied argument count if getArgument ( inv_constants.EAF_RETRIEVAL_ARGUMENT_COUNT_ARGUMENT_NAME, ls_holder ) = 1 then ll_suppliedargumentcount = long( ls_holder ) else //Argument count not passed in addError(METHOD_NAME, "prepareArguments() failed. Argument '" + inv_constants.EAF_RETRIEVAL_ARGUMENT_COUNT_ARGUMENT_NAME + "' not supplied.") return -1 end if //Check to make sure the correct number of arguments was passed in if ll_suppliedargumentcount < ll_argumentcount then addError( METHOD_NAME, "Incorrect number of retrieval arguments passed. Required: " + string(ll_argumentcount) + ". Passed: " + string( ll_suppliedargumentcount ) ) return -1 end if //Loop through the superset of arguments establishing the retrieval arguments for ll_argumentattribindex = 1 to ll_argumentattribcount if left( inv_argumentattrib[ll_argumentattribindex].is_name, len( inv_constants.EAF_RETRIEVAL_ARGUMENT_BY_ORDER_ARGUMENT_NAME_PREFIX ) ) = inv_constants.EAF_RETRIEVAL_ARGUMENT_BY_ORDER_ARGUMENT_NAME_PREFIX then ll_argumentindex = long(right(inv_argumentattrib[ll_argumentattribindex].is_name,1) ) inv_argumentattrib[ll_argumentattribindex].is_type = as_argumenttypes[ll_argumentindex] inv_argumentattrib[ll_argumentattribindex].ib_bound = true inv_argumentattrib[ll_argumentattribindex].il_order = ll_argumentindex //Convert to Any equivalents // Loop around all entries creating a new Any entry ll_upper = upperBound( inv_argumentattrib[ll_argumentattribindex].is_values ) for ll_idx = 1 to ll_upper if stringToAny( inv_argumentattrib[ll_argumentattribindex].is_values[ll_idx], inv_argumentattrib[ll_argumentattribindex].is_type, inv_argumentattrib[ll_argumentattribindex].ib_isNull[ll_idx], inv_argumentattrib[ll_argumentattribindex].ia_values[ll_idx] ) = -1 then addError(METHOD_NAME, "prepareArguments() failed due to failure in stringToAny() method.") return -1 end if next end if next else // Arguments have been passed in by name for ll_argumentindex = 1 to ll_argumentcount lb_matchfound = false // Loop through argument attrib objects looking for a match on argument name // Search is not case sensitive for ll_argumentattribindex = 1 to ll_argumentattribcount if ( Lower( as_argumentnames[ll_argumentindex] ) = Lower( inv_argumentattrib[ll_argumentattribindex].is_name ) ) then lb_matchfound = true // Set the argument type inv_argumentattrib[ll_argumentattribindex].is_type = as_argumenttypes[ll_argumentindex] //Convert to Any equivalents // Loop around all entries creating a new Any entry ll_upper = upperBound( inv_argumentattrib[ll_argumentattribindex].is_values ) for ll_idx = 1 to ll_upper if stringToAny( inv_argumentattrib[ll_argumentattribindex].is_values[ll_idx], inv_argumentattrib[ll_argumentattribindex].is_type, inv_argumentattrib[ll_argumentattribindex].ib_isNull[ll_idx], inv_argumentattrib[ll_argumentattribindex].ia_values[ll_idx] ) = -1 then addError(METHOD_NAME, "prepareArguments() failed due to failure in stringToAny() method.") return -1 end if next // Set the argument bound property inv_argumentattrib[ll_argumentattribindex].ib_bound = true // Set the argument's retrieval order inv_argumentattrib[ll_argumentattribindex].il_order = ll_argumentindex exit end if next // Test to see if match was found if not lb_matchfound then addError( METHOD_NAME, "Missing required argument '" + as_argumentnames[ll_argumentindex] + "'." ) return -1 end if next end if return 1 end function public function long getboundarguments (ref any aa_arguments[]);/////////////////////////////////////////////////////////////////////////////////// // Description: // Return the bound arguments in required order // // // Revisions // 2.1 - Initial version // Arguments: // REF aa_arguments[] - Reference argument for bound arguments // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "getBoundArguments " long ll_argumentcount long ll_argumentindex long ll_boundargumentcount ll_argumentcount = upperBound( inv_argumentattrib ) // Get the number of bound arguments for ll_argumentindex = 1 to ll_argumentcount if ( inv_argumentattrib[ll_argumentindex].ib_bound ) then ll_boundargumentcount++ end if next Do While ( upperBound( aa_arguments ) < ll_boundargumentcount ) for ll_argumentindex = 1 to ll_argumentcount if ( inv_argumentattrib[ll_argumentindex].il_order = upperBound( aa_arguments ) + 1 ) then //Determine if argument is an array if ( Pos( inv_argumentattrib[ll_argumentindex].is_type, "list" ) > 0 ) then aa_arguments[ upperBound( aa_arguments ) + 1 ] = inv_argumentattrib[ll_argumentindex].ia_values else aa_arguments[ upperBound( aa_arguments ) + 1 ] = inv_argumentattrib[ll_argumentindex].ia_values[1] end if end if next Loop return 1 end function public function long getargument (string as_argumentname, ref string as_argumentvalues[]);/////////////////////////////////////////////////////////////////////////////////// // Description: // Returns the values passed in as arguments for argument name as_argumentname // // // Revisions // 2.1 - Initial version // Arguments: // as_argumentname - Property name requested // REF as_argumentvalues[] - Values for the property // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "getArgument (Strin, REF String[])" long ll_argumentcount long ll_argumentidx string ls_empty[] as_argumentvalues = ls_empty If ib_trace Then inv_log.traceLog (METHOD_NAME, "" ) End If ll_argumentcount = UpperBound( inv_argumentattrib ) for ll_argumentidx = 1 to ll_argumentcount if ( Lower( inv_argumentattrib[ll_argumentidx].is_name ) = Lower( as_argumentname ) ) then as_argumentvalues = inv_argumentattrib[ll_argumentidx].is_values inv_log.detailedLog( METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "Found argument '" + as_argumentname + "' - " + inv_argumentattrib[ll_argumentidx].is_values[1] ) return 1 end if next return -1 end function public function long anytoarginfo (any aa_arg, boolean ab_array, ref s_arginfo astr_arginfo);/////////////////////////////////////////////////////////////////////////////////// // Description: // Converts the passed in Any argument(s) into an // argInfo Structure // Revisions // 1.0 - Initial version // Arguments: // aa_arg - The argument(s) to convert into a argInfo Structure // ab_array - Switch indicating if aa_arg is an array or not // astr_arginfo - The created s_arginfo structure // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "anyToArgInfo " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "(aa_arg, ab_array, astr_arginfo") End If // Declare local variables any la_array[] long ll_newupper s_arginfo lstr_arginfo // Perform cleanup astr_arginfo = lstr_arginfo // Validate arguments // A null condition for argument "aa_arg" is acceptable // Insure that the value that came in is in an array If Not ab_array Then la_array[1] = aa_arg Else la_array = aa_arg End If // Check for a good array If upperBound(la_array) <= 0 Then addError(METHOD_NAME, "Invalid aa_arg argument via la_array check") Return -1 End If // Convert the Any Array into an argInfo Structure If anyToArgInfo(la_array, lstr_arginfo) < 0 Then Return -1 End If // Move the results into the reference variable astr_arginfo = lstr_arginfo Return 1 end function public function long getargument (string as_argumentname, ref string as_argumentvalue);/////////////////////////////////////////////////////////////////////////////////// // Description: // Returns the value passed in as arguments for argument name as_argumentname // // // Revisions // 2.1 - Initial version // Arguments: // as_argumentname - Property name requested // REF as_argumentvalue - Values for the property // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "getArgument ( String, REF String )" inv_log.traceLog( METHOD_NAME, "" ) string ls_values[] long ll_rc ll_rc = getArgument( as_argumentname, ls_values ) if ll_rc = 1 then as_argumentvalue = ls_values[1] return 1 else return -1 end if end function public function long stringtoany (string as_value, string as_classname, boolean ab_isnull, ref any aa_value);/////////////////////////////////////////////////////////////////////////////////// // Description: // Prepare arguments with type information, order and bound properties // // Revisions // 3.0 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "stringToAny " double ldbl_null string ls_classname string ls_temp string ls_null any la_empty[] date ld_date date ld_null time ltm_time time ltm_null datetime ldt_null long ll_pos Choose Case Lower(as_classname) Case STRINGNAME, STRINGARRAYNAME, STRINGLISTNAME if ab_isnull then setnull(ls_null) aa_value = ls_null else aa_value = as_value end if Case NUMBERNAME, NUMBERARRAYNAME, NUMBERLISTNAME // do all numbers as double if ab_isnull then setnull(ldbl_null) aa_value = ldbl_null else aa_value = double(as_value) end if Case DATENAME, DATEARRAYNAME, DATELISTNAME if ab_isnull then setnull(ld_null) aa_value = ld_null else aa_value = date(as_value) end if Case TIMENAME, TIMEARRAYNAME, TIMELISTNAME if ab_isnull then setnull(ltm_null) aa_value = ltm_null else aa_value = time(as_value) end if Case DATETIMENAME, DATETIMEARRAYNAME, DATETIMELISTNAME // Since there is no intrinsic function to convert // a datetime string format back into a datetime variable if ab_isnull then setnull(ldt_null) aa_value = ldt_null else ls_temp = as_value ll_pos = pos(ls_temp,' ') ls_temp = left(ls_temp,ll_pos - 1) ld_date = date(ls_temp) ls_temp = as_value ll_pos = len(ls_temp) - ll_pos ls_temp = right(ls_temp,ll_pos) ltm_time = time(ls_temp) aa_value = datetime(ld_date,ltm_time) end if Case Else addError(METHOD_NAME, "Encountered unknown type " + as_classname) Return -1 End Choose return 1 end function public function long addargument (string as_name, any aa_values[]);/////////////////////////////////////////////////////////////////////////////////// // Description: // Adds an argument for the DataSet // // // Revisions // 3.0 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "addArgument( String, Any[] ) " long ll_argcount long ll_argindex n_cst_argumentattrib lnv_attrib lnv_attrib = create n_cst_argumentattrib if prepareAttrib( as_name, aa_values, lnv_attrib ) = -1 then return -1 end if //check to make sure argument doesn't already exist ll_argcount = upperBound( inv_argumentattrib ) for ll_argindex = 1 to ll_argcount if inv_argumentattrib[ll_argindex].is_name = as_name then destroy inv_argumentattrib[ll_argindex] inv_argumentattrib[ll_argindex] = lnv_attrib return 1 end if next inv_argumentattrib[upperBound(inv_argumentattrib)+1] = lnv_attrib return 1 end function public function long prepareattrib (string as_name, any aa_values[], ref n_cst_argumentattrib anv_attrib);/////////////////////////////////////////////////////////////////////////////////// // Description: // Prepares an argument attrib object // // // Revisions // 3.0 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "prepareAttrib( String, Any[], REF n_cst_argumentattrib ) " long ll_valuecount long ll_valueindex anv_attrib.is_name = as_name ll_valuecount = upperBound( aa_values ) for ll_valueindex = 1 to ll_valuecount if isNull( aa_values[ll_valueindex] ) then anv_attrib.ib_isnull[ll_valueindex] = true else anv_attrib.ib_isnull[ll_valueindex] = false end if anv_attrib.is_values[ll_valueindex] = string( aa_values[ll_valueindex] ) next return 1 end function public function long addargument (string as_name, any aa_value);/////////////////////////////////////////////////////////////////////////////////// // Description: // Adds an child argument for the DataSet // // // Revisions // 3.0 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "addArgument( String, Any ) " any la_values[] la_values[1] = aa_value return addArgument( as_name, la_values ) end function public function long addchildargument (string as_childcolumnname, string as_name, any aa_values[]);/////////////////////////////////////////////////////////////////////////////////// // Description: // Adds an child argument for the DataSet // // // Revisions // 3.0 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "addArgument( String, Any[] ) " n_cst_argumentattrib lnv_attrib lnv_attrib = create n_cst_argumentattrib if prepareAttrib( as_name, aa_values, lnv_attrib ) = -1 then return -1 end if lnv_attrib.is_childcolumnname = as_childcolumnname inv_childargumentattrib[upperBound(inv_childargumentattrib)+1] = lnv_attrib return 1 end function public function long addchlidargument (string as_childcolumnname, string as_name, any aa_value);/////////////////////////////////////////////////////////////////////////////////// // Description: // Adds an child argument for the DataSet // // // Revisions // 3.0 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "addArgument( String, Any ) " any la_values[] la_values[1] = aa_value return addChildArgument( as_childcolumnname, as_name, la_values ) end function public function long reset ();/////////////////////////////////////////////////////////////////////////////////// // Description: // Resets the arguments to empty // // // Revisions // 3.0 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "reset() " n_cst_argumentattrib lnv_empty[] try inv_argumentattrib[] = lnv_empty inv_childargumentattrib[] = lnv_empty finally end try return 1 end function public function long addargument (string as_name, blob ab_value);/////////////////////////////////////////////////////////////////////////////////// // Description: // Adds an blob argument for the DataSet // Revisions // 3.0 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "addArgument( String, Blob ) " any la_values[] la_values[1] = "Blobdata" if addArgument( as_name, la_values ) = 1 then inv_argumentattrib[upperBound(inv_argumentattrib)].ib_value = ab_value else return -1 end if return 1 end function public function long getargument (string as_argumentname, ref blob ab_argumentvalue);/////////////////////////////////////////////////////////////////////////////////// // Description: // Returns the values passed in as arguments for argument name as_argumentname // Revisions // 2.1 - Initial version // Arguments: // as_argumentname - Property name requested // REF ab_argumentvalue - Values for the property // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "getArgument (Strin, REF Blob)" long ll_argumentcount long ll_argumentidx If ib_trace Then inv_log.traceLog (METHOD_NAME, "" ) End If ll_argumentcount = UpperBound( inv_argumentattrib ) for ll_argumentidx = 1 to ll_argumentcount if ( Lower( inv_argumentattrib[ll_argumentidx].is_name ) = Lower( as_argumentname ) ) then ab_argumentvalue = inv_argumentattrib[ll_argumentidx].ib_value inv_log.detailedLog( METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "Found argument '" + as_argumentname + "' - " + inv_argumentattrib[ll_argumentidx].is_values[1] ) return 1 end if next return -1 end function public function long initialize (string axml_document, blob ab_argumentvalue);/////////////////////////////////////////////////////////////////////////////////// // Description: // Initialize the service object with the XML argument data // // // Revisions // 2.1 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "initialize( string )" long ll_argumentcount long ll_argumentindex long ll_rc long ll_currentargumentindex long ll_argumentvalueindex string ls_argumentname string ls_previousargumentname string ls_beginsign[] string ls_chiarg[] long ll_p1, ll_p2, ll_find, ll_row boolean lb_blobflag datastore lds_arguments inv_log.traceLog ( METHOD_NAME, "" ) if IsNull(ab_argumentvalue) or String(ab_argumentvalue) = "" then lb_blobflag = false else lb_blobflag = true end if lds_arguments = create datastore lds_arguments.dataobject = "d_arguments" //PB11 Bug: importstring faild if axml_document contain chinese characters //Workaround: replace chinese char in context argument, after importstring, setitem if Len(axml_document) <> LenA(axml_document) then ls_beginsign[1] = "<EAFArgumentName>EAFContext</EAFArgumentName><EAFArgumentValue>" ls_beginsign[2] = "<EAFArgumentName>EAFSelfLink</EAFArgumentName><EAFArgumentValue>" for ll_row = 1 to UpperBound(ls_beginsign) ll_p1 = 0 ll_p2 = 0 ll_p1 = Pos(axml_document, ls_beginsign[ll_row]) if ll_p1 > 0 then ll_p2 = Pos(axml_document, "</EAFArgumentValue>", ll_p1) ls_chiarg[ll_row] = Mid(axml_document, ll_p1 + Len(ls_beginsign[ll_row]), ll_p2 - (ll_p1 + Len(ls_beginsign[ll_row]))) axml_document = Replace(axml_document, ll_p1 + Len(ls_beginsign[ll_row]), ll_p2 - (ll_p1 + Len(ls_beginsign[ll_row])), "") else ls_chiarg[ll_row] = "" end if next end if ll_rc = lds_arguments.importString( XML!, axml_document ) if ll_rc < 0 then addError( METHOD_NAME, "Failed to parse XML arguments. lds_arguments.importString() returned " + string( ll_rc ) + "~r~n XML arguments is " + axml_document) return -1 end if ll_argumentcount = lds_arguments.rowCount() //Replace with chinese characters argument if UpperBound(ls_chiarg) > 0 then for ll_row = 1 to UpperBound(ls_chiarg) if ls_chiarg[ll_row] = "" then continue ll_find = lds_arguments.Find("name='" + ls_beginsign[ll_row] + "'", 1, ll_argumentcount) lds_arguments.SetItem(ll_find, "value", ls_chiarg[ll_row]) next end if //DataSet Arguments for ll_argumentindex = 1 to ll_argumentcount ls_argumentname = lds_arguments.getItemString( ll_argumentindex, "name" ) if ls_argumentname <> ls_previousargumentname and not isNull( ls_argumentname ) then //new argument ll_currentargumentindex = upperBound( inv_argumentattrib ) + 1 inv_argumentattrib[ll_currentargumentindex] = create n_cst_argumentattrib inv_argumentattrib[ll_currentargumentindex].is_name = ls_argumentname if lb_blobflag then if Lower(lds_arguments.getItemString( ll_argumentindex, "value" )) = "blobdata" then inv_argumentattrib[ll_currentargumentindex].ib_value = ab_argumentvalue lb_blobflag = false end if end if end if ll_argumentvalueindex = upperBound( inv_argumentattrib[ll_currentargumentindex].ib_isnull ) + 1 if lower( lds_arguments.getItemString( ll_argumentindex, "isnull" ) ) = "true" then inv_argumentattrib[ll_currentargumentindex].ib_isnull[ll_argumentvalueindex] = true setNull( inv_argumentattrib[ll_currentargumentindex].is_values[ll_argumentvalueindex] ) else inv_argumentattrib[ll_currentargumentindex].ib_isnull[ll_argumentvalueindex] = false inv_argumentattrib[ll_currentargumentindex].is_values[ll_argumentvalueindex] = lds_arguments.getItemString( ll_argumentindex, "value" ) //Deal with XML template changing emptry string to null if isNull( inv_argumentattrib[ll_currentargumentindex].is_values[ll_argumentvalueindex] ) then inv_argumentattrib[ll_currentargumentindex].is_values[ll_argumentvalueindex] = "" end if end if ls_previousargumentname = inv_argumentattrib[ll_currentargumentindex].is_name next ls_argumentname = "" ls_previousargumentname = "" //Child Arguments lds_arguments.dataobject = "d_childarguments" ll_rc = lds_arguments.importString( XML!, axml_document ) //Check for return code < -1 as -1 indicates no rows which is an acceptable outcome given that child arguments are not a requirement if ll_rc < -1 then addError( METHOD_NAME, "Failed to parse child XML arguments. lds_arguments.importString() returned " + string( ll_rc ) ) return -1 else ll_argumentcount = lds_arguments.rowCount() //Child DataSet Arguments for ll_argumentindex = 1 to ll_argumentcount ls_argumentname = lds_arguments.getItemString( ll_argumentindex, "name" ) if ls_argumentname <> ls_previousargumentname and not isNull( ls_argumentname ) then //new argument ll_currentargumentindex = upperBound( inv_childargumentattrib ) + 1 inv_childargumentattrib[ll_currentargumentindex] = create n_cst_argumentattrib inv_childargumentattrib[ll_currentargumentindex].is_name = ls_argumentname inv_childargumentattrib[ll_currentargumentindex].is_childcolumnname = lds_arguments.getItemString( ll_argumentindex, "column_name" ) end if ll_argumentvalueindex = upperBound( inv_childargumentattrib[ll_currentargumentindex].ib_isnull ) + 1 if lower( lds_arguments.getItemString( ll_argumentindex, "isnull" ) ) = "true" then inv_childargumentattrib[ll_currentargumentindex].ib_isnull[ll_argumentvalueindex] = true setNull( inv_childargumentattrib[ll_currentargumentindex].is_values[ll_argumentvalueindex] ) else inv_childargumentattrib[ll_currentargumentindex].ib_isnull[ll_argumentvalueindex] = false inv_childargumentattrib[ll_currentargumentindex].is_values[ll_argumentvalueindex] = lds_arguments.getItemString( ll_argumentindex, "value" ) //Deal with XML template changing emptry string to null if isNull( inv_childargumentattrib[ll_currentargumentindex].is_values[ll_argumentvalueindex] ) then inv_childargumentattrib[ll_currentargumentindex].is_values[ll_argumentvalueindex] = "" end if end if ls_previousargumentname = inv_childargumentattrib[ll_currentargumentindex].is_name next end if if isValid( lds_arguments ) then destroy lds_arguments end if return 1 end function public function long initialize (string axml_document);Blob lb_null SetNull(lb_null) return initialize(axml_document, lb_null) end function public function long toxml (ref string as_document, ref blob ab_data);/////////////////////////////////////////////////////////////////////////////////// // Description: // Creates an XML document from the arguments // // // Revisions // 3.0 - Initial version // Arguments: // None. // Returns: // 1 - Success // -1 - Failure /////////////////////////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "toXML( REF String ) " long ll_argcount long ll_argindex long ll_valuecount long ll_valueindex boolean lb_noblobflag = false n_cst_xmlparser lnv_parser try if String(ab_data) = "None" then lb_noblobflag = true lnv_parser = create n_cst_xmlparser //Add the main dataset arguments lnv_parser.addElement( ARGUMENTS_ELEMENT_NAME ) ll_argcount = upperBound( inv_argumentattrib ) for ll_argindex = 1 to ll_argcount lnv_parser.addElement( ARGUMENT_ELEMENT_NAME ) lnv_parser.addElement( ARGUMENT_NAME_ELEMENT_NAME, inv_argumentattrib[ll_argindex].is_name ) ll_valuecount = upperBound( inv_argumentattrib[ll_argindex].is_values ) for ll_valueindex = 1 to ll_valuecount //In cases of null values, place an empty string in the value element if inv_argumentattrib[ll_argindex].ib_isnull[ll_valueindex] then lnv_parser.addElement( ARGUMENT_VALUE_ELEMENT_NAME, "" ) else lnv_parser.addElement( ARGUMENT_VALUE_ELEMENT_NAME, inv_argumentattrib[ll_argindex].is_values[ll_valueindex], false, true ) end if lnv_parser.addElement( ARGUMENT_ISNULL_ELEMENT_NAME, upper(string(inv_argumentattrib[ll_argindex].ib_isnull[ll_valueindex])) ) if not lb_noblobflag then if inv_argumentattrib[ll_argindex].is_values[ll_valueindex] = "Blobdata" then ab_data = inv_argumentattrib[ll_argindex].ib_value lb_noblobflag = true end if end if next lnv_parser.closeElement( ARGUMENT_ELEMENT_NAME ) next //Add the child arguments lnv_parser.addElement( CHILD_ARGUMENTS_ELEMENT_NAME ) ll_argcount = upperBound( inv_childargumentattrib ) for ll_argindex = 1 to ll_argcount lnv_parser.addElement( CHILD_ARGUMENT_ELEMENT_NAME ) lnv_parser.addElement( CHILD_ARGUMENT_NAME_ELEMENT_NAME, inv_childargumentattrib[ll_argindex].is_name ) lnv_parser.addElement( CHILD_ARGUMENT_CHILD_NAME_ELEMENT_NAME, inv_childargumentattrib[ll_argindex].is_childcolumnname ) ll_valuecount = upperBound( inv_childargumentattrib[ll_argindex].is_values ) for ll_valueindex = 1 to ll_valuecount //In cases of null values, place an empty string in the value element if inv_childargumentattrib[ll_argindex].ib_isnull[ll_valueindex] then lnv_parser.addElement( CHILD_ARGUMENT_VALUE_ELEMENT_NAME, "" ) else lnv_parser.addElement( CHILD_ARGUMENT_VALUE_ELEMENT_NAME, inv_childargumentattrib[ll_argindex].is_values[ll_valueindex] ) end if lnv_parser.addElement( CHILD_ARGUMENT_ISNULL_ELEMENT_NAME, upper(string(inv_childargumentattrib[ll_argindex].ib_isnull[ll_valueindex])) ) next lnv_parser.closeElement( CHILD_ARGUMENT_ELEMENT_NAME ) next lnv_parser.closeElement( CHILD_ARGUMENTS_ELEMENT_NAME ) lnv_parser.closeElement( ARGUMENTS_ELEMENT_NAME ) if lnv_parser.getDocument( as_document ) = -1 then return -1 end if finally if ( isValid( lnv_parser ) ) then destroy lnv_parser end if end try return 1 end function public function long toxml (ref string as_document);blob lb_data lb_data = Blob("None") return toxml(as_document, lb_data) end function on eaf_n_cst_argumentservice.create call super::create end on on eaf_n_cst_argumentservice.destroy call super::destroy end on event constructor;call super::constructor;/////////////////////////////////////////////////////////////////////////////////// // Description: // Constructor // Revisions // 1.0 - Initial version // Arguments: // None // Returns: // None /////////////////////////////////////////////////////////////////////////////////// // Copyright © Youngsoft, Inc. Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. /////////////////////////////////////////////////////////////////////////////////// constant string METHOD_NAME = "constructor " // Build the Escape and UnEscape information buildEscape() end event
- Sources
- EAF.NET
- eaf_shared
- eaf_n_cst_argumentservice.sru
File: eaf_n_cst_argumentservice.sru
Size: 59078
Date: Tue, 22 Jan 2008 23:39:20 +0100
Size: 59078
Date: Tue, 22 Jan 2008 23:39:20 +0100
- n_cst_baseservice eaf_n_cst_argumentservice(sru)
- addargument (string as_name, any aa_value) returns long
- addargument (string as_name, any aa_values[]) returns long
- addargument (string as_name, blob ab_value) returns long
- addchildargument (string as_childcolumnname, string as_name, any aa_values[]) returns long
- addchlidargument (string as_childcolumnname, string as_name, any aa_value) returns long
- anytoarginfo (any aa_arg, boolean ab_array, ref s_arginfo astr_arginfo) returns long
- anytoarginfo (any aa_args[], ref s_arginfo astr_arginfo) returns long
- arginfotoany (s_arginfo astr_arginfo, ref any aa_args[]) returns long
- arginfotoany (s_arginfo astr_arginfos[], ref any aa_args[]) returns long
- arginfotostring (s_arginfo astr_arginfos[], ref string as_result) returns long
- buildescape () returns long
- escape (string as_string) returns string
- getargument (string as_argumentname, ref blob ab_argumentvalue) returns long
- getargument (string as_argumentname, ref string as_argumentvalue) returns long
- getargument (string as_argumentname, ref string as_argumentvalues[]) returns long
- getboundarguments (ref any aa_arguments[]) returns long
- initialize (string axml_document) returns long
- initialize (string axml_document, blob ab_argumentvalue) returns long
- preparearguments (string as_argumentnames[], string as_argumenttypes[]) returns long
- prepareattrib (string as_name, any aa_values[], ref n_cst_argumentattrib anv_attrib) returns long
- reset () returns long
- stringtoany (string as_value, string as_classname, boolean ab_isnull, ref any aa_value) returns long
- stringtoarginfo (string as_argstring, ref s_arginfo astr_arginfos[]) returns long
- toxml (ref string as_document) returns long
- toxml (ref string as_document, ref blob ab_data) returns long
- unescape (string as_string) returns string