$PBExportHeader$eaf_n_cst_interfacemanager.sru forward global type eaf_n_cst_interfacemanager from n_cst_component end type end forward global type eaf_n_cst_interfacemanager from n_cst_component end type global eaf_n_cst_interfacemanager eaf_n_cst_interfacemanager type variables Protected: constant string DATASET_BASE = "n_cst_dataset" constant string DATASTORE_BASE = "n_datastore" constant long LUWNONE = 0 constant long LUWRETRIEVE = 1 constant long LUWUPDATE = 2 constant long LUWALL = 3 string is_dataset = "n_cst_dataset" string is_datastore = "n_datastore" n_cst_interfacemanagerregattrib inv_registerattrib[] n_cst_argumentservice inv_argument long il_LUWProcessing = LUWALL long il_datasettype = 0 String is_resourcesearchpath[] end variables forward prototypes protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, boolean ab_allowdirectupdates) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname, string as_updateboname) protected function long setdataset (string as_dataset) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname, string as_updatebonames[]) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[]) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], boolean ab_allowdirectupdates) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], string as_updateboname) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], string as_updatebonames[]) protected function long registerdataset (string as_datasetid, string as_dataobject) protected function long registerdataset (string as_datasetid, string as_dataobject, boolean ab_allowdirectupdates) protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname) protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname, string as_updatebonames[]) protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[]) protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], string as_updateboname) protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], string as_updatebonames[]) protected function long setluwprocessing (long al_type) protected function long setdatastore (string as_datastore) protected function long getdatasetidx (string as_datasetid) public function long getregistered (ref string as_datasetids[]) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname, boolean ab_allowdirectupdates) protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname, string as_updateboname) protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], string as_updatebonames[], boolean ab_allowdirectupdate) protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], boolean ab_allowdirectupdates) protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname, boolean ab_allowdirectupdates) protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], string as_updatebonames[], boolean ab_allowdirectupdate) protected function long retrievestart_luw (ref n_cst_datasetattrib anv_datasetattribs[]) public function long retrieve (ref s_mimerequest astr_mimerequest) public function long update (ref s_mimerequest astr_mimerequest) protected function long updatestart_luw (ref n_cst_datasetattrib anv_datasetattrib[]) protected function long updatebetween_luw (ref n_cst_datasetattrib anv_datasetattrib[], long al_datasetidx) protected function long retrievebetween_luw (long al_justretrieved, ref n_cst_datasetattrib anv_datasetattribs[]) public function long defineloggingservice () protected function long preparedatasets (ref n_cst_datasetattrib anv_datasetattribs[]) protected function long retrieveend_luw (ref n_cst_datasetattrib anv_datasetattribs[]) protected function long updateend_luw (ref n_cst_datasetattrib anv_datasetattrib[]) public function long getdefaultretrievebonames (string as_datasetid, datastore ads_working, ref string as_retrieveboname[]) protected function long initialize (ref s_mimerequest astr_mimerequest) public function long executeservice (ref s_mimerequest astr_mimerequest) protected function long setinterfacelogicbonames (string as_datasetid, string as_itemchangedbonames[], string as_lookupbonames[]) public function long itemchanged (ref s_mimerequest astr_mimerequest) public function long masterconfirm (ref s_mimerequest astr_mimerequest) protected function long applydataobjectrules (string as_datasetid, ref datastore ads_working, string as_businessobjects[], boolean ab_retrievebefore, string as_retrieveaction, ref n_cst_messageservice anv_messaging) end prototypes protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, boolean ab_allowdirectupdates);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, and // if Direct Updates (ones not going through an Update Business // Object) are supported. // Retrieval/Update Business Objects will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // ab_allowdirectupdates - Determines if Direct Updates are supported // 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 = "registerDataset ( string, n_cst_dataset, boolean )" // Declare local variables string ls_empty_bonames[] long ll_method_rc inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset, ab_allowdirectupdates)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className() + "~r~n" + & " ab_allowdirectupdates ="+string(ab_allowdirectupdates)) ll_method_rc = registerDataset (as_datasetid, anv_dataset, ls_empty_bonames, ls_empty_bonames, ab_allowdirectupdates) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname, string as_updateboname);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, One // Retrieve Business Object, and One Update Business Object. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // as_retrieveboname - One BusinessObject associated with the dataset retrieves // as_updateboname - One BusinessObject associated with the dataset updates // 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 = "registerDataset ( string, n_cst_dataset, string, string )" inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset, as_retrieveboname, as_updateboname)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className() + "~r~n" + & " as_retrieveboname="+as_retrieveboname+ "~r~n" + & " as_updateboname ="+as_updateboname) // Declare local variables string ls_update_bonames[] string ls_retrieve_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_retrieveboname)) > 0 Then ls_retrieve_bonames[1] = as_retrieveboname End If If len(trim(as_updateboname)) > 0 Then ls_update_bonames[1] = as_updateboname End If ll_method_rc = registerDataset (as_datasetid, anv_dataset, ls_retrieve_bonames, ls_update_bonames, false) Return ll_method_rc end function protected function long setdataset (string as_dataset);//////////////////////////////////////////////////////////////// // Description: // Set a Dataset class which services registered without // an specific dataset class instance // Revisions // 1.0 - Initial version // Arguments: // as_dataset - The dataset classname // Must be a descendant of the base dataset class // 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 = "setDataset( string ) " inv_log.traceLog (METHOD_NAME, "as_dataset="+as_dataset) // Declare local variables n_cst_classdefinitionservice lnv_classdefinition // Perform clenaup as_dataset = trim(lower(as_dataset)) // Validate arguments If IsNull(as_dataset) Or len(as_dataset) = 0 Then addError(METHOD_NAME, "Invalid as_dataset argument") Return -1 End If try //create class definition service lnv_classdefinition = create n_cst_classdefinitionservice inv_log.propagateSettings( lnv_classdefinition ) // If not the base dataset object, confirm the object is class is // valid prior to creating it If as_dataset <> DATASET_BASE Then // Confirm the object is a descendant of the DataSet If Not lnv_classdefinition.isDescendant(as_dataset, DATASET_BASE) Then addError(METHOD_NAME, "Dataset object ("+as_dataset+") is not a descendant of " + DATASET_BASE) Return -1 End If End If finally destroy lnv_classdefinition end try is_dataset = as_dataset Return 1 end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, and its supporting dataset object. // Retrieval/Update Business Objects will not be supported. // Updates of any kind will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // 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 = "registerDataset ( string, n_cst_dataset )" // Declare local variables string ls_empty_bonames[] long ll_method_rc inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className()) ll_method_rc = registerDataset (as_datasetid, anv_dataset, ls_empty_bonames, ls_empty_bonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname, string as_updatebonames[]);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, One Retrieve Business // Object, and Zero-to-Many Update Business Objects. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // as_retrieveboname - One BusinessObject associated with the dataset retrieves // as_updatebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Update time // 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 = "registerDataset (string, n_cst_dataset, string, string[] )" inv_log.traceLog ( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset, as_retrieveboname, as_updatebonames[])~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className() + "~r~n" + & " as_retrieveboname="+as_retrieveboname) // Declare local variables string ls_retrieve_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_retrieveboname)) > 0 Then ls_retrieve_bonames[1] = as_retrieveboname End If ll_method_rc = registerDataset (as_datasetid, anv_dataset, & ls_retrieve_bonames, as_updatebonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[]);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, and // Zero-to-Many Retrieve Business Objects. // Update Business Objects will not be supported. // Updates of any kind will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Retrival time // 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 = "registerDataset ( string, n_cst_dataset, string[] )" inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset, " + & "as_retrievebonames[])~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className()) // Declare local variables string ls_empty_bonames[] long ll_method_rc ll_method_rc = registerDataset (as_datasetid, anv_dataset, as_retrievebonames, ls_empty_bonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], boolean ab_allowdirectupdates);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, and // Zero-to-Many Retrieve Business Objects, and if Direct // Updates (ones not going through an Update Business Object) // are supported. // Update Business Objects will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Retrival time // ab_allowdirectupdates - Determines if Direct Updates are supported // 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 = "registerDataset ( string, n_cst_dataset, string, boolean )" inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset, " + & "as_retrievebonames[])~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className()+ "~r~n"+ & " ab_allowdirectupdates ="+string(ab_allowdirectupdates)) // Declare local variables string ls_empty_bonames[] long ll_method_rc ll_method_rc = registerDataset (as_datasetid, anv_dataset, as_retrievebonames, & ls_empty_bonames, ab_allowdirectupdates) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], string as_updateboname);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, // Zero-to-Many Retrieve Business Objects, and // One Update Business Object // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at retrieval time // as_updateboname - One BusinessObject associated with the dataset updates // 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 = "registerDataset (string, n_cst_dataset, string[], string )" inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset, as_retrievebonames[], as_updateboname)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className() + "~r~n" + & " as_updateboname="+as_updateboname) // Declare local variables string ls_update_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_updateboname)) > 0 Then ls_update_bonames[1] = as_updateboname End If ll_method_rc = registerDataset (as_datasetid, anv_dataset, & as_retrievebonames, ls_update_bonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], string as_updatebonames[]);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, // Zero-to-Many Retrieve Business Objects, and // Zero-to-Many Update Business Objects. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Retrieval time // as_updatebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Update time // 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 = "registerDataset ( string, n_cst_dataset, string[], string[] )" inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset, as_retrievebonames[], as_updatebonames[])~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className()) // Declare local variables long ll_method_rc ll_method_rc = registerDataset (as_datasetid, anv_dataset, & as_retrievebonames, as_updatebonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, and its dataobject. // Retrieval/Update Business Objects will not be supported. // Updates of any kind will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // 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 = "registerDataset ( string, string )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject) // Declare local variables string ls_empty_bonames[] long ll_method_rc ll_method_rc = registerDataset (as_datasetid, as_dataobject, ls_empty_bonames, ls_empty_bonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, boolean ab_allowdirectupdates);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, and if Direct Updates // (ones not going through an Update Business Object) are // supported. // Retrieval/Update Business Objects will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // ab_allowdirectupdates - Determines if Direct Updates are supported // 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 = "registerDataset ( string, string, boolean )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, ab_allowdirectupdates)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject + "~r~n" + & " ab_allowdirectupdates ="+string(ab_allowdirectupdates)) // Declare local variables string ls_empty_bonames[] long ll_method_rc ll_method_rc = registerDataset (as_datasetid, as_dataobject, & ls_empty_bonames, ls_empty_bonames, ab_allowdirectupdates) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, and One Retrieval // Business Object. // Update Business Objects will not be supported. // Updates of any kind will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // as_retrieveboname - One BusinessObject associated with the dataset retrieves // 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 = "registerDataset ( string, string, string )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, as_retrieveboname)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject + "~r~n" + & " as_retrieveboname="+as_retrieveboname) // Declare local variables string ls_empty_bonames[] string ls_retrieve_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_retrieveboname)) > 0 Then ls_retrieve_bonames[1] = as_retrieveboname End If ll_method_rc = registerDataset (as_datasetid, as_dataobject, ls_retrieve_bonames, ls_empty_bonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname, string as_updatebonames[]);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, One Retrieve Business // Object, and Zero-to-Many Update Business Objects. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // as_retrieveboname - One BusinessObject associated with the dataset retrieves // as_updatebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Update time // 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 = "registerDataset ( string, string, string, string[] )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, as_retrieveboname, as_updatebonames[])~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject + "~r~n" + & " as_retrieveboname="+as_retrieveboname) // Declare local variables string ls_retrieve_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_retrieveboname)) > 0 Then ls_retrieve_bonames[1] = as_retrieveboname End If ll_method_rc = registerDataset (as_datasetid, as_dataobject, & ls_retrieve_bonames, as_updatebonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[]);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, and Zero-to-Many // Retrieve Business Objects. // Update Business Objects will not be supported. // Updates of any kind will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Retrival time // 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 = "registerDataset ( string, string, string[] )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, " + & "as_retrievebonames[])~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject) // Declare local variables string ls_empty_bonames[] long ll_method_rc ll_method_rc = registerDataset (as_datasetid, as_dataobject, as_retrievebonames, ls_empty_bonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], string as_updateboname);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, Zero-to-Many Retrieve // Business Objects, and One Update Business Objects // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at retrieval time // as_updateboname - One BusinessObject associated with the dataset updates // 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 = "registerDataset ( string, string, string[], string )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, as_retrievebonames[], as_updateboname)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject + "~r~n" + & " as_updateboname="+as_updateboname) // Declare local variables string ls_update_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_updateboname)) > 0 Then ls_update_bonames[1] = as_updateboname End If ll_method_rc = registerDataset (as_datasetid, as_dataobject, & as_retrievebonames, ls_update_bonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], string as_updatebonames[]);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, Zero-to-Many Retrieve // Business Objects, and Zero-to-Many Update Business Objects. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Retrieval time // as_updatebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Update time // 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 = "registerDataset ( string, string, string[], string[] )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, as_retrievebonames[], as_updatebonames[])~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject) // Declare local variables long ll_method_rc ll_method_rc = registerDataset (as_datasetid, as_dataobject, & as_retrievebonames, as_updatebonames, false) Return ll_method_rc end function protected function long setluwprocessing (long al_type);//////////////////////////////////////////////////////////////// // Description: // Set the LUW processing options // LUWNONE = No LUW processing performed (Default) // LUWRETRIEVE = process just retrieves // LUWUPDATE = process just updates // LUWALL = process all LUW's // Revisions // 2.0 - Initial version // Arguments: // al_type // // 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 = "setLUWProcessing " inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "LUW Processing enabled for type " +string(al_type) ) // validate parameter choose case al_type case LUWNONE, LUWRETRIEVE, LUWUPDATE, LUWALL il_LUWprocessing = al_type case else addError(METHOD_NAME, "Invalid value for al_type = "+string(al_type)) return -1 end choose return 1 end function protected function long setdatastore (string as_datastore);//////////////////////////////////////////////////////////////// // Description: // Set a Datastore object for the object to use // Revisions // 1.0 - Initial version // Arguments: // as_datastore - The datastore to be used // 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 = "setDatastore( string )" inv_log.traceLog (METHOD_NAME, "as_datastore="+as_datastore) // Declare local variables n_cst_classdefinitionservice lnv_classdefinition // Perform cleanup as_datastore = trim(lower(as_datastore)) // Validate arguments If IsNull(as_datastore) Or len(as_datastore) = 0 Then addError(METHOD_NAME, "Invalid as_datastore argument") Return -1 End If try //create class definition service lnv_classdefinition = create n_cst_classdefinitionservice inv_log.propagateSettings( lnv_classdefinition ) // If not the base datastore object, confirm the object class is // valid prior to creating it If as_datastore <> DATASTORE_BASE Then // Confirm the object is a descendant of the base datastore If Not lnv_classdefinition.isDescendant & (as_datastore, DATASTORE_BASE) Then addError(METHOD_NAME, "Datastore object " + & "("+as_datastore+") is Not a descendant of " + DATASTORE_BASE) Return -1 End If End If finally destroy lnv_classdefinition end try // Store the new Datastore object is_datastore = as_datastore Return 1 end function protected function long getdatasetidx (string as_datasetid);//////////////////////////////////////////////////////////////// // Description: // If found, it reports on the Index of a dataset. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // Returns: // >0 - The index - success // 0 - Not found // -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 = "getDatasetIdx ( String ) " If ib_trace And ib_detailed Then inv_log.traceLog (METHOD_NAME, "") End If // Declare local variables long ll_idx long ll_datasetsupper // Perform cleanup as_datasetid = Lower(Trim(as_datasetid)) // Validate arguments If IsNull(as_datasetid) Or Len(as_datasetid) = 0 Then addError(METHOD_NAME, "Invalid as_datasetid argument") Return -1 End If // Loop around all searching the matching ID ll_datasetsupper = UpperBound(inv_registerattrib) For ll_idx = 1 To ll_datasetsupper If inv_registerattrib[ll_idx].is_id = as_datasetid Then // Found a matching ID, return the Index Return ll_idx End If Next // Entry not found If ib_debug And ib_detailed Then inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "Not Previously registered ("+as_datasetid+")") End If Return 0 end function public function long getregistered (ref string as_datasetids[]);//////////////////////////////////////////////////////////////// // Description: // Gets the IDs of the Registered datasets // Revisions // 1.0 - Initial version // Arguments: // as_datasetids[] - Returns the IDs of the datasets // Returns: // 1 - Success - There are registered entries // 0 - Success - No registered entries // -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 = "getRegistered ( REF as_datasetsids[])" inv_log.traceLog (METHOD_NAME, "") // Declare local variables long ll_upper long ll_idx string ls_empty[] // Perform cleanup as_datasetids = ls_empty // Loop around all registered entries ll_upper = UpperBound(inv_registerattrib) For ll_idx = 1 to ll_upper as_datasetids[ll_idx] = inv_registerattrib[ll_idx].is_id Next // Return the appropriate code If ll_upper = 0 Then Return 0 End If Return 1 end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, and // One Retrieval Business Object. // Update Business Objects will not be supported. // Updates of any kind will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // as_retrieveboname - One BusinessObject associated with the dataset retrieves // 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 = "registerDataset ( string, n_cst_dataset, string )" inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset, as_retrieveboname)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className() + "~r~n" + & " as_retrieveboname="+as_retrieveboname) // Declare local variables string ls_empty_bonames[] string ls_retrieve_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_retrieveboname)) > 0 Then ls_retrieve_bonames[1] = as_retrieveboname End If ll_method_rc = registerDataset (as_datasetid, anv_dataset, ls_retrieve_bonames, ls_empty_bonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname, boolean ab_allowdirectupdates);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, One // Retrieval Business Object, and if Direct Updates // (ones not going through an Update Business Object) are supported. // Update Business Objects will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // as_retrieveboname - One BusinessObject associated with the dataset retrieves // ab_allowdirectupdates - Determines if Direct Updates are supported // Returns: // 1 - Success // -1 - Failure //-------------------------------------------------------------- // Revisions // 20010209-RST: Added ab_allowdirectupdates to the overloaded call. // Previously, the method was passing FALSE instead of // the parameter. // //////////////////////////////////////////////////////////////// // 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 = "registerDataset (string, n_cst_dataset, string, boolean )" inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, anv_dataset, as_retrieveboname, ab_allowdirectupdates)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className() + "~r~n" + & " as_retrieveboname="+as_retrieveboname+"~r~n" + & " ab_allowdirectupdates ="+string(ab_allowdirectupdates)) // Declare local variables string ls_empty_bonames[] string ls_retrieve_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_retrieveboname)) > 0 Then ls_retrieve_bonames[1] = as_retrieveboname End If // 20010209-RST ll_method_rc = registerDataset (as_datasetid, anv_dataset, ls_retrieve_bonames, ls_empty_bonames, ab_allowdirectupdates) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname, string as_updateboname);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, One Retrieve Business // Object, and One Update Business Object. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // as_retrieveboname - One BusinessObject associated with the dataset retrieves // as_updateboname - One BusinessObject associated with the dataset updates // 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 = "registerDataset ( string, string, string, string )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, as_retrieveboname, as_updateboname)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject + "~r~n" + & " as_retrieveboname="+as_retrieveboname+ "~r~n" + & " as_updateboname ="+as_updateboname) // Declare local variables string ls_update_bonames[] string ls_retrieve_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_retrieveboname)) > 0 Then ls_retrieve_bonames[1] = as_retrieveboname End If If len(trim(as_updateboname)) > 0 Then ls_update_bonames[1] = as_updateboname End If ll_method_rc = registerDataset (as_datasetid, as_dataobject, & ls_retrieve_bonames, ls_update_bonames, false) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], string as_updatebonames[], boolean ab_allowdirectupdate);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, Zero-to-Many Retrieval Business // Objects, Zero-to-Many Update Business Objects. In the cases // where there are no Update Business Objects, the AllowDirectUpdates // flags = TRUE is accepted. // This method accomplishes its goal by creating a "default dataset object" // to support the passed in dataobject. // // This method should not be called directly. It should only be // be called by the other registerDataset(...) methods. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Retrival time // as_updatebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Update time // ab_allowdirectupdate - Determines if Direct Updates are supported // (Entries in as_updatebonames[] and this // value=true are not valid) // 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 = "registerDataset ( string, string, string[], string[], boolean )" // Declare local variables long ll_method_rc Long ll_datasettype String ls_datasettype n_cst_dataset lnv_dataset inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, " + & "as_retrievebonames[], as_updatebonames[], ab_allowdirectupdates)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject + "~r~n" + & " ab_allowdirectupdate ="+string(ab_allowdirectupdate)) // Create a "dataset instance" to support this dataset lnv_dataset = create using is_dataset inv_log.DYNAMIC propagateSettings( lnv_dataset ) If isNull(lnv_dataset) Or Not isValid(lnv_dataset) Then addError (METHOD_NAME, "Failed to create a valid ("+ is_dataset +") object") Return -1 End If // Associate the passed in dataobject to the "default dataset object" If lnv_dataset.setDataobject(as_dataobject, GetLanguageID()) <= 0 Then addError (METHOD_NAME, "Not a valid dataobject. " + & "Failed while perfoming lnv_dataset.setDataobject(" + as_dataobject+")") destroy lnv_dataset Return -1 End If // Perform the actual registration of the dataset using the "default dataset object" // instead of a simple dataobject ll_method_rc = registerDataset (as_datasetid, lnv_dataset, & as_retrievebonames, as_updatebonames, ab_allowdirectupdate) // Do not destroy the "default dataset object" on a successful registration If ll_method_rc <= 0 Then destroy lnv_dataset End If Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], boolean ab_allowdirectupdates);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, and Zero-to-Many // Retrieve Business Objects, and if Direct Updates (ones not // going through an Update Business Object) are supported. // Update Business Objects will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Retrival time // ab_allowdirectupdates - Determines if Direct Updates are supported // 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 = "registerDataset ( string, string, string[], boolean )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, " + & "as_retrievebonames[])~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject+ "~r~n"+ & " ab_allowdirectupdates ="+string(ab_allowdirectupdates)) // Declare local variables string ls_empty_bonames[] long ll_method_rc ll_method_rc = registerDataset (as_datasetid, as_dataobject, as_retrievebonames, & ls_empty_bonames, ab_allowdirectupdates) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname, boolean ab_allowdirectupdates);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its dataobject, One Retrieval Business // Object, and if Direct Updates (ones not going through an // Update Business Object) are supported. // Update Business Objects will not be supported. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // as_dataobject - The dataobject associated with the dataset // as_retrieveboname - One BusinessObject associated with the dataset retrieves // ab_allowdirectupdates - Determines if Direct Updates are supported // Returns: // 1 - Success // -1 - Failure //-------------------------------------------------------------- // Revisions // 20010209-RST: Added ab_allowdirectupdates to the overloaded call. // Previously, the method was passing FALSE instead of // the parameter. //////////////////////////////////////////////////////////////// // 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 = "registerDataset ( string, string, string, boolean )" inv_log.traceLog( METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "(as_datasetid, as_dataobject, as_retrieveboname, ab_allowdirectupdates)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " as_dataobject ="+as_dataobject + "~r~n" + & " as_retrieveboname="+as_retrieveboname+"~r~n" + & " ab_allowdirectupdates ="+string(ab_allowdirectupdates)) // Declare local variables string ls_empty_bonames[] string ls_retrieve_bonames[] long ll_method_rc // Put single BO in first entry of array If len(trim(as_retrieveboname)) > 0 Then ls_retrieve_bonames[1] = as_retrieveboname End If ll_method_rc = registerDataset (as_datasetid, as_dataobject, ls_retrieve_bonames, ls_empty_bonames, ab_allowdirectupdates) Return ll_method_rc end function protected function long registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], string as_updatebonames[], boolean ab_allowdirectupdate);//////////////////////////////////////////////////////////////// // Description: // Registers a dataset, its supporting dataset object, // Zero-to-Many Retrieval Business Objects, Zero-to-Many Update // Business Objects. In the cases where there are no Update Business // Objects, the AllowDirectUpdates flags = TRUE is accepted. // // This method should not be called directly. It should only be // be called by the other registerDataset(...) methods. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The ID of the dataset // anv_dataset - The anv_dataset object class supporting the dataset // as_retrievebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Retrival time // as_updatebonames[] - Zero-to-Many BusinessObjects associated with // the dataset at Update time // ab_allowdirectupdate - Determines if Direct Updates are supported // (Entries in as_updatebonames[] and this // value=true are not valid) // 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 = "registerDataset ( string, n_cst_dataset, string[], string[], boolean )" inv_log.traceLog( METHOD_NAME, "" ) if isNull( anv_dataset ) then inv_log.log (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "DataSet object is null. Make sure DataSet variable is properly created and that the variable is properly used in the call to registerDataSet." ) return -1 end if // Declare local variables long ll_rc long ll_upper long ll_idx long ll_idx2 long ll_newentry long ll_bo_updateupper long ll_bo_retrieveupper string ls_bo_inarray string ls_bo_retrieveregistered string ls_debugregister string ls_dataobject string ls_retrieve_bonames = "{" string ls_update_bonames = "{" n_cst_BusinessObject lnv_businessobject n_cst_RetrieveObject lnv_retrieveobject If ib_trace or ib_debug Then ll_upper = upperBound(as_retrievebonames) For ll_idx = 1 to ll_upper If len(ls_retrieve_bonames) > 1 Then ls_retrieve_bonames += ", " ls_retrieve_bonames += as_retrievebonames[ll_idx] Next ls_retrieve_bonames += "}" ll_upper = upperBound(as_updatebonames) For ll_idx = 1 to ll_upper If len(ls_update_bonames) > 1 Then ls_update_bonames += ", " ls_update_bonames += as_updatebonames[ll_idx] Next ls_update_bonames += "}" ls_debugregister = "(as_datasetid, anv_dataset, " + & "as_retrievebonames[], as_updatebonames[], ab_allowdirectupdates)~r~n"+ & " as_datasetid ="+as_datasetid + "~r~n" + & " anv_dataset ="+anv_dataset.className() + "~r~n" + & " as_retrievebonames ="+ls_retrieve_bonames + "~r~n" + & " as_updatebonames ="+ls_update_bonames + "~r~n" + & " ab_allowdirectupdate ="+string(ab_allowdirectupdate) inv_log.traceLog (METHOD_NAME, "" ) inv_log.debugLog (METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, ls_debugregister) End If // Perform cleanup as_datasetid = Lower(Trim(as_datasetid)) // Validate arguments If isNull(as_datasetid) Or Len(as_datasetid)=0 Then addError (METHOD_NAME, "Invalid as_datasetid argument") Return -1 End If If isNull(anv_dataset) Or Not isValid(anv_dataset) Then addError (METHOD_NAME, "Invalid anv_dataset argument") Return -1 End If if il_datasettype = inv_constants.DATASET_TYPE_DWO then anv_dataset.getDataobject(ls_dataobject) If len(trim(ls_dataobject)) = 0 Then inv_log.warninglog( METHOD_NAME, "Unconfigured anv_dataset class passed in. "+ & "Invalid anv_dataset argument") End If end if If isNull(as_retrievebonames) Then // upperBound of Zero means that there are no Business Objects desired addError (METHOD_NAME, "Invalid as_retrievebonames argument") Return -1 End If If isNull(as_updatebonames) Then // upperBound of Zero means that there are no Business Objects desired addError (METHOD_NAME, "Invalid as_updatebonames argument") Return -1 End If If isNull(ab_allowdirectupdate) Then addError (METHOD_NAME, "Invalid ab_allowdirectupdate argument") Return -1 End If If upperBound(as_updatebonames) > 0 And ab_allowdirectupdate Then addError (METHOD_NAME, "Invalid number entries of as_updatebonames[]> 0 ("+ & string(upperBound(as_updatebonames)) + ") " + & "And ab_allowdirectupdate=True conbination of arguments") Return -1 End If // Validate that the datasetID is not already registered If getDatasetIdx(as_datasetid) > 0 Then addError (METHOD_NAME, "The as_datasetid is already registered ("+as_datasetid+")" ) Return -1 End If // Validate required references If IsNull(inv_registerattrib) Then addError(METHOD_NAME, "Invalid inv_registerattrib reference") Return -1 End If If IsNull(inv_objecthelper) Or Not isValid(inv_objecthelper) Then addError(METHOD_NAME, "Invalid inv_objecthelper reference") Return -1 End If //Propagate log settings inv_log.dynamic propagateSettings( anv_dataset ) // Perform cleanup and Validate the Retrieve Business Object Names ls_bo_inarray = "" ll_bo_retrieveupper = upperBound(as_retrievebonames) For ll_idx = 1 to ll_bo_retrieveupper as_retrievebonames[ll_idx] = Trim(as_retrievebonames[ll_idx]) If isNull(as_retrievebonames[ll_idx]) Or len(as_retrievebonames[ll_idx]) = 0 Then addError (METHOD_NAME, "Invalid empty entry in " + & "as_retrievebonames["+string(ll_idx) +"] argument") Return -1 End If // Make sure the same Business Object is not in the same array more than once If Pos(ls_bo_inarray, "@#$"+as_retrievebonames[ll_idx]+"@#$") > 0 Then // Already found in the array addError(METHOD_NAME, "Duplicate entry found in as_retrievebonames["+ & string(ll_idx)+"] =" +as_retrievebonames[ll_idx]) Return -1 End If // Keep string with all previous Business Object names in the array ls_bo_inarray += "@#$" + as_retrievebonames[ll_idx] + "@#$" // Perform a Create in order to validate the Retrieve Business Object Name try lnv_retrieveobject = create using as_retrievebonames[ll_idx] catch ( RuntimeError re ) addError(METHOD_NAME, "Processing datasetid("+as_datasetid+") " + & "cannot create instance of '"+as_retrievebonames[ll_idx]+"' "+ & "RC="+string(ll_rc)) Return -1 End try if IsValid(lnv_retrieveobject) then destroy lnv_retrieveobject Next // Perform cleanup and Validate the Update Business Object Names ls_bo_inarray = "" ll_bo_updateupper = upperBound(as_updatebonames) For ll_idx = 1 to ll_bo_updateupper as_updatebonames[ll_idx] = Trim(as_updatebonames[ll_idx]) If isNull(as_updatebonames[ll_idx]) Or len(as_updatebonames[ll_idx]) = 0 Then addError (METHOD_NAME, "Invalid empty entry in " + & "as_updatebonames["+string(ll_idx) +"] argument") Return -1 End If // Make sure the same Business Object is not in the same array more than once If Pos(ls_bo_inarray, "@#$"+as_updatebonames[ll_idx]+"@#$") > 0 Then // Already found in the array addError(METHOD_NAME, "Duplicate entry found in as_updatebonames["+ & string(ll_idx)+"] =" +as_updatebonames[ll_idx]) Return -1 End If // Keep string with all previous Business Object names in the array ls_bo_inarray += "@#$" + as_updatebonames[ll_idx] + "@#$" // Perform a Create in order to validate the Business Object Name try lnv_businessobject = create using as_updatebonames[ll_idx] catch ( RuntimeError re1 ) addError(METHOD_NAME, "Cannot create instance of "+as_updatebonames[ll_idx]) Return -1 End try if IsValid(lnv_businessobject) then destroy lnv_businessobject Next // Perform the actual register ll_newentry = upperBound(inv_registerattrib) + 1 inv_registerattrib[ll_newentry] = create n_cst_interfacemanagerregattrib inv_registerattrib[ll_newentry].is_id = as_datasetid inv_registerattrib[ll_newentry].inv_dataset = anv_dataset if UpperBound(as_retrievebonames) > 0 then inv_registerattrib[ll_newentry].is_retrievebonames = as_retrievebonames end if if UpperBound(as_updatebonames) > 0 then inv_registerattrib[ll_newentry].is_updatebonames = as_updatebonames end if If upperBound(inv_registerattrib[ll_newentry].is_updatebonames) = 0 Then inv_registerattrib[ll_newentry].ib_allowdirectupdate = ab_allowdirectupdate End If inv_log.DYNAMIC propagateSettings( inv_registerattrib[ll_newentry].inv_dataset ) Return 1 end function protected function long retrievestart_luw (ref n_cst_datasetattrib anv_datasetattribs[]);//////////////////////////////////////////////////////////////// // Description: // Called by the retrieve process BEFORE retrieves are actually performed. // it is possible in this method to re-arrange the order that the datasets are in or to // actually add/delete datasets SO BE CAREFUL!!! // Revisions // 2.1 - Initial version // Arguments: // anv_datasetattribs[] - an array of dataset attribute objects // // 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 = "retrieveStart_LUW " inv_log.traceLog (METHOD_NAME, "") If ib_trace and ib_detailed Then long ll_idx for ll_idx = 1 to upperbound(anv_datasetattribs) inv_log.traceLog (METHOD_NAME, "(anv_datasetattribs["+string(ll_idx)+"]."+anv_datasetattribs[ll_idx].is_name+")") next End If return 1 end function public function long retrieve (ref s_mimerequest astr_mimerequest);//////////////////////////////////////////////////////////////// // Description: // Performs a retrive according to the information passed through the MIME Request object // Revisions // 3.0 - Initial version // Arguments: // astr_mimerequest - REF // 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 = "retrieve (REF s_mimerequest)" inv_log.traceLog (METHOD_NAME, "") // Declare local variables long ll_retrieve_rc long ll_result long ll_idx long ll_idx_dddw long ll_upper long ll_datasetidx long ll_registeredupper long ll_colcount long ll_rc long ll_sqldbcode long ll_datasetindex string ls_message string ls_datasetid string ls_dddwname string ls_column string ls_dataobject string ls_debug string ls_argumentnames[] string ls_argumenttypes[] string ls_sessionid string ls_characterset string ls_runtimeerror datawindowchild ldwc_dddw n_cst_contentproviderservicebroker lnv_contentproviderservicebroker n_cst_datastoreservice lnv_dssrv n_datastore lds_luws[] n_cst_datasetattrib lnv_datasetattrib[] try if initialize(astr_mimerequest) = -1 then return -1 //Get the Character Set inv_argument.getArgument( inv_constants.EAF_CHARACTER_SET_ARGUMENT_NAME, ls_characterset ) //Create the content provider service broker lnv_contentproviderservicebroker = create n_cst_contentproviderservicebroker inv_log.DYNAMIC propagateSettings( lnv_contentproviderservicebroker ) // Validate the datastore implementation If isNull(is_datastore) Or len(trim(is_datastore)) = 0 Then inv_log.addError( METHOD_NAME, "Error creating the working datastore. is_datastore is not populated.", inv_messaging ) End If // Determine the number of datasets to be retrieved ll_upper = upperBound( astr_mimerequest.datasets ) If ll_upper <= 0 Then inv_log.addError( METHOD_NAME, "No datasets have been requested.", inv_messaging ) return -1 End If //Create and Initialize the DataSetAttrib objects //First loop to establish MessageService etc. in case error occurs in this loop - all MessageService instances are created for ll_datasetindex = 1 to ll_upper //Create the DataSet attribute object lnv_datasetattrib[ll_datasetindex] = create n_cst_datasetattrib //Set the DataSet Name lnv_datasetattrib[ll_datasetindex].is_name = astr_mimerequest.datasets[ll_datasetindex].name //Create the MessagingService lnv_datasetattrib[ll_datasetindex].inv_messaging = create n_cst_messageservice //Place the entire argument string on the attribute object lnv_datasetattrib[ll_datasetindex].is_xmlarguments = astr_mimerequest.datasets[ll_datasetindex].arguments //Create the ArgumentService lnv_datasetattrib[ll_datasetindex].inv_argumentservice = create n_cst_argumentservice //Propagate log settings to the ArgumentService inv_log.propagateSettings( lnv_datasetattrib[ll_datasetindex].inv_argumentservice ) // Create the datastore lnv_datasetattrib[ll_datasetindex].ids_working = create using is_datastore inv_log.propagateSettings( lnv_datasetattrib[ll_datasetindex].ids_working ) next //Complete Initialization of DataSetAttrib objects for ll_datasetindex = 1 to ll_upper //Create the ContentProviderService for the requested MIME Type if lnv_contentproviderservicebroker.getContentProviderService( astr_mimerequest.datasets[ll_datasetindex].mimetype, lnv_datasetattrib[ll_datasetindex].inv_contentproviderservice ) = -1 then lnv_datasetattrib[ll_datasetindex].inv_messaging.append( lnv_contentproviderservicebroker.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to getContentProviderService:" + astr_mimerequest.datasets[ll_datasetindex].mimetype, lnv_datasetattrib[ll_datasetindex].inv_messaging ) return -1 end if //Propagte log settings to ContentProviderService inv_log.propagateSettings( lnv_datasetattrib[ll_datasetindex].inv_contentproviderservice ) if lnv_datasetattrib[ll_datasetindex].inv_argumentservice.initialize( astr_mimerequest.datasets[ll_datasetindex].arguments ) = -1 then lnv_datasetattrib[ll_datasetindex].inv_messaging.append( lnv_datasetattrib[ll_datasetindex].inv_argumentservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to initialize the ArgumentService for DataSet '" + lnv_datasetattrib[ll_datasetindex].is_name + "'", lnv_datasetattrib[ll_datasetindex].inv_messaging ) return -1 end if //Get the Retrieve Action lnv_datasetattrib[ll_datasetindex].inv_argumentservice.getArgument( inv_constants.EAF_RETRIEVE_ACTION_TYPE_ARGUMENT_NAME, lnv_datasetattrib[ll_datasetindex].is_action ) next //Create the datastore service lnv_dssrv = create n_cst_datastoreservice inv_log.propagateSettings( lnv_dssrv ) //Invoke prepareDataSets() to allow dynamic registration of DataSets ll_rc = prepareDataSets(lnv_datasetattrib) if ll_rc < 0 then inv_log.addError( METHOD_NAME, "Retrieve failed due to error in prepareDataSets()", inv_messaging ) return -1 end If //Determine if LUW Processing is enabled if (il_LUWprocessing = LUWRETRIEVE) or (il_LUWprocessing = LUWALL) then ll_rc = retrievestart_luw(lnv_datasetattrib) if ll_rc < 0 then inv_log.addError( METHOD_NAME, "Retrieve cancelled due to failure of LUW RetrieveStart processing", inv_messaging ) return -1 End If end if // Retrieve the requested datasets For ll_idx = 1 To ll_upper // Get the dataset ID ls_datasetid = lnv_datasetattrib[ll_idx].is_name //Get the registered index ll_datasetidx = getDatasetIdx(ls_datasetid) if ll_datasetidx <= 0 then inv_log.addError( METHOD_NAME, "DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' not found.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If ls_debug += "~r~n Retrieve dataset = '"+ls_datasetid+"'" // Validate the dataset object If isNull(inv_registerattrib[ll_datasetidx].inv_dataset) Or Not isValid(inv_registerattrib[ll_datasetidx].inv_dataset) Then inv_log.addError( METHOD_NAME, "Invalid DataSet object (inv_dataset) for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' encountered.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If // Pass Component Name to dataset object inv_registerattrib[ll_datasetidx].inv_dataset.SetComponentName(this.GetComponentName()) // Pass User ID to dataset object inv_registerattrib[ll_datasetidx].inv_dataset.SetUserName(GetUserName()) // Pass Languageid to dataset object inv_registerattrib[ll_datasetidx].inv_dataset.SetLanguageid(GetLanguageID()) //Get the session id if it exists //Do not test for failures - empty session ids are ok lnv_datasetattrib[ll_idx].inv_argumentservice.getArgument( inv_constants.EAF_SESSION_ID_ARGUMENT_NAME, ls_sessionid ) //Set the session id on the dataset inv_registerattrib[ll_datasetidx].inv_dataset.setSessionID( ls_sessionid ) //Determine if the DataSet has already been prepared if not lnv_datasetattrib[ll_idx].ib_prepared then // Get the appropriate datawindow dataobject inv_registerattrib[ll_datasetidx].inv_dataset.getDataobject(ls_dataobject) If isNull(ls_dataobject) Or Len(trim(ls_dataobject))=0 Then inv_log.addError( METHOD_NAME, "Invalid DataObject for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If // Assign the dataobject and Language If lnv_datasetattrib[ll_idx].ids_working.setLanguageID(GetLanguageID()) <= 0 Then inv_log.addError( METHOD_NAME, "Failed to set LanguageID for DataObject '" + ls_dataobject + "' and DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' Make sure DataObject is spelled correctly and has been deployed to the server.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If If lnv_datasetattrib[ll_idx].ids_working.setDataobject(ls_dataobject) <= 0 Then inv_log.addError( METHOD_NAME, "Failed to set DataObject '" + ls_dataobject + "' for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' Make sure DataObject is spelled correctly and has been deployed to the server.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If lnv_datasetattrib[ll_idx].ib_prepared = true end if if lnv_datasetattrib[ll_idx].is_action = "" then lnv_datasetattrib[ll_idx].is_action = inv_constants.RETRIEVE_FULLONNEED // Allow the Business Objects to set any requirements on the DataWindow Object If lnv_datasetattrib[ll_idx].is_action = inv_constants.RETRIEVE_SYNTAXONLY Or lnv_datasetattrib[ll_idx].is_action = inv_constants.RETRIEVE_FULLONNEED Then If this.applyDataObjectRules(ls_datasetid, lnv_datasetattrib[ll_idx].ids_working, inv_registerattrib[ll_datasetidx].is_retrievebonames, true, lnv_datasetattrib[ll_idx].is_action, lnv_datasetattrib[ll_idx].inv_messaging) < 0 Then inv_log.addError( METHOD_NAME, "Failed to apply DataObject Rules for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If End If // Assign the transaction object if SQLCA.istransactionconnected( ) then If lnv_datasetattrib[ll_idx].ids_working.setTransObject(SQLCA) <= 0 Then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_datasetattrib[ll_idx].ids_working.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to set Transaction Object (SQLCA) for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If end if //Process DropDownDataWindows if inv_registerattrib[ll_datasetidx].inv_dataset.retrieveChildren(lnv_datasetattrib[ll_idx]) = -1 then lnv_datasetattrib[ll_idx].inv_messaging.append( inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging ) inv_log.addError( METHOD_NAME, "Child DataWindow population failed for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 end if If lnv_datasetattrib[ll_idx].is_action = inv_constants.RETRIEVE_DATAONLY Then ls_debug += "~r~n Retrieve of DropDownDataWindows was skipped" End If // Set retrieve Type ll_retrieve_rc = inv_registerattrib[ll_datasetidx].inv_dataset.setRetrieveAction(lnv_datasetattrib[ll_idx].is_action) // Request the retrieve operation if the retrieve type is not syntax only if lnv_datasetattrib[ll_idx].is_action <> inv_constants.RETRIEVE_SYNTAXONLY then ll_retrieve_rc = inv_registerattrib[ll_datasetidx].inv_dataset.retrieve( lnv_datasetattrib[ll_idx]) end if If isNull(ll_retrieve_rc) Or ll_retrieve_rc < 0 Then lnv_datasetattrib[ll_idx].inv_messaging.append( inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to retrieve DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If // Allow the Business Objects to set any requirements on the DataWindow Object After Retrieve If lnv_datasetattrib[ll_idx].is_action = inv_constants.RETRIEVE_DATAONLY Or lnv_datasetattrib[ll_idx].is_action = inv_constants.RETRIEVE_FULLONNEED Then If this.applyDataObjectRules(ls_datasetid, lnv_datasetattrib[ll_idx].ids_working, inv_registerattrib[ll_datasetidx].is_retrievebonames, false, lnv_datasetattrib[ll_idx].is_action, lnv_datasetattrib[ll_idx].inv_messaging) < 0 Then inv_log.addError( METHOD_NAME, "Failed to apply DataObject Rules for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If End If ls_debug += "~r~n Retrieved dataset "+ls_datasetid+'. RC='+string(ll_retrieve_rc) + " RowCount="+string(lnv_datasetattrib[ll_idx].ids_working.rowCount()) if (il_LUWprocessing = LUWRETRIEVE) or (il_LUWprocessing = LUWALL) then lds_luws[ll_idx] = lnv_datasetattrib[ll_idx].ids_working ll_rc = retrievebetween_luw (ll_idx, lnv_datasetattrib) if ll_rc < 0 then inv_log.addError( METHOD_NAME, "Retrieve cancelled due to failure of Retrieve Between LUW processing", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 end if end if //Have ContentProviderService prepare the DataStore's content if lnv_datasetattrib[ll_idx].inv_contentproviderservice.prepareContent( lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx], inv_registerattrib[ll_datasetidx].inv_dataset ) = -1 then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_datasetattrib[ll_idx].inv_contentproviderservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to prepare content for DataSet '" + ls_datasetid + "'", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 end if //Invoke the dataset's createContentBegin method to allow changes specific to content type before generation ll_rc = inv_registerattrib[ll_datasetidx].inv_dataset.createContentBegin( lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx] ) Choose Case ll_rc Case -1 lnv_datasetattrib[ll_idx].inv_messaging.append( inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed in createContentBegin of dataset '" + lnv_datasetattrib[ll_idx].is_name + "'", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 Case 1 //Instruct the Content Provider service to create the content for the requested MIME Type If lnv_datasetattrib[ll_idx].inv_contentproviderservice.createContent(lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx]) < 0 Then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_datasetattrib[ll_idx].inv_contentproviderservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to create content for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If //Invoke the dataset's createContentEnd method to allow changes specific to content type before generation if inv_registerattrib[ll_datasetidx].inv_dataset.createContentEnd( lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx] ) = -1 then lnv_datasetattrib[ll_idx].inv_messaging.append( inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed in createContentEnd of dataset '" + lnv_datasetattrib[ll_idx].is_name + "'", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 end if Case 2 //Skip the content creation service - content was created in DataSet's createContentBegin method End Choose //Add Row Count as Message lnv_datasetattrib[ll_idx].inv_messaging.add( inv_constants.EAF_ROWCOUNT_MESSAGE_NAME, inv_constants.MESSAGE_TYPE_EAF_DATA, string( lnv_datasetattrib[ll_idx].ids_working.rowCount() ) ) Next //Determine if LUW Processing is enabled if (il_LUWprocessing = LUWRETRIEVE) or (il_LUWprocessing = LUWALL) then ll_rc = retrieveend_luw(lnv_datasetattrib) if ll_rc < 0 then inv_log.addError( METHOD_NAME, "Retrieve cancelled due to failure of LUW RetrieveEnd processing", inv_messaging ) return -1 End If for ll_idx = 1 to ll_upper // cleanup destroy lds_luws[ll_idx] next end if catch ( RuntimeError re ) ls_runtimeerror = "Runtime Error:" + inv_constants.CRLF + inv_constants.CRLF ls_runtimeerror += "Error Code: " + string(re.number) + inv_constants.CRLF ls_runtimeerror += "Object: " + re.objectName + inv_constants.CRLF ls_runtimeerror += "Class: " + re.class + inv_constants.CRLF ls_runtimeerror += "Function/Event: " + re.routineName + inv_constants.CRLF ls_runtimeerror += "Line: " + string(re.line) + inv_constants.CRLF inv_log.addError( METHOD_NAME, "Runtime Error: " + ls_runtimeerror, inv_messaging ) return -1 finally //Places all messages in reference structure here in case of errors inv_messaging.toXML( ls_characterset, astr_mimerequest.messages ) //Place the Messages onto the mime request dataset messages property for each DataSet For ll_idx = 1 To ll_upper lnv_datasetattrib[ll_idx].inv_messaging.toXML( ls_characterset, astr_mimerequest.datasets[ll_idx].messages ) Next //Perform cleanup if isValid( lnv_dssrv ) then destroy lnv_dssrv end if if isValid( lnv_contentproviderservicebroker ) then destroy lnv_contentproviderservicebroker end if ll_upper = upperBound( lds_luws[] ) for ll_idx = 1 to ll_upper if isValid( lds_luws[ll_idx] ) then destroy lds_luws[ll_idx] end if next ll_upper = upperBound( lnv_datasetattrib[] ) for ll_idx = 1 to ll_upper if isValid( lnv_datasetattrib[ll_idx] ) then destroy lnv_datasetattrib[ll_idx] end if next inv_log.debugLog(METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG,"Summary of..." + ls_debug) end try return 1 end function public function long update (ref s_mimerequest astr_mimerequest);//////////////////////////////////////////////////////////////// // Description: // Perform an update according to the information passed in // through the InterfaceStructure // Revisions // 1.0 - Initial version // Arguments: // astr_interface - The data that needs to be updated // Returns: // 1 - Success // 0 - Nothing to update // -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 = "update (REF s_mimerequest)" inv_log.traceLog (METHOD_NAME, "") // Declare local variables boolean lb_istransactionaborted long ll_rc long ll_ccrc long ll_idx long ll_upper long ll_bocount long ll_boidx long ll_sqldbcode long ll_datasetidx string ls_message string ls_boname string ls_datasetid string ls_describeresult string ls_dataobject string ls_debug boolean lb_luw string ls_updateaction string ls_characterset string ls_runtimeerror n_cst_datastoreservice lnv_dssrv n_cst_contentproviderservicebroker lnv_contentproviderservicebroker n_cst_datasetattrib lnv_datasetattrib[] try if initialize(astr_mimerequest) = -1 then return -1 //Get the Character Set inv_argument.getArgument( inv_constants.EAF_CHARACTER_SET_ARGUMENT_NAME, ls_characterset ) // Use Conten Providert Service Broker to get correct Content Provider Service lnv_contentproviderservicebroker = create n_cst_contentproviderservicebroker // Confirm that something was passed in ll_upper = upperBound(astr_mimerequest.datasets) If ll_upper <= 0 Then // Nothing was passed in to update Return 0 End If // Check that the component is in a transaction If Not this.isInTransaction() Then inv_log.warningLog (METHOD_NAME, "Component is Not executing in a transaction") End If // Validate the datastore implementation If isNull(is_datastore) Or len(trim(is_datastore)) = 0 Then inv_log.addError( METHOD_NAME, "Invalid DataObject for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) Return -1 End If //Create the datastore service lnv_dssrv = create n_cst_datastoreservice inv_log.propagateSettings( lnv_dssrv ) //Determine LUW Processing //Need to add functionality to turn on LUW processing from the client lb_luw = ((il_LUWprocessing = LUWUPDATE) or (il_LUWprocessing = LUWALL)) //Create the DataSetAttrib objects for ll_idx = 1 to ll_upper //Create the DataSet attribute object lnv_datasetattrib[ll_idx] = create n_cst_datasetattrib //Set the DataSet Name lnv_datasetattrib[ll_idx].is_name = astr_mimerequest.datasets[ll_idx].name //Place the entire argument string on the attribute object lnv_datasetattrib[ll_idx].is_xmlarguments = astr_mimerequest.datasets[ll_idx].arguments //Create the MessagingService lnv_datasetattrib[ll_idx].inv_messaging = create n_cst_messageservice //Create the ArgumentService lnv_datasetattrib[ll_idx].inv_argumentservice = create n_cst_argumentservice //Propagate log settings to the ArgumentService inv_log.propagateSettings( lnv_datasetattrib[ll_idx].inv_argumentservice ) //Create datastore for DataSet and propagate log settings lnv_datasetattrib[ll_idx].ids_working = create using is_datastore inv_log.propagateSettings( lnv_datasetattrib[ll_idx].ids_working ) //Create the ContentProviderService for the requested MIME Type if lnv_contentproviderservicebroker.getContentProviderService( astr_mimerequest.datasets[ll_idx].mimetype, lnv_datasetattrib[ll_idx].inv_contentproviderservice ) = -1 then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_contentproviderservicebroker.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to getContentProviderService:" + astr_mimerequest.datasets[ll_idx].mimetype, lnv_datasetattrib[ll_idx].inv_messaging ) return -1 end if //Propagate log settings to ContentProviderService inv_log.propagateSettings( lnv_datasetattrib[ll_idx].inv_contentproviderservice ) //Initialize the ArgumentService with the XML Arguments if lnv_datasetattrib[ll_idx].inv_argumentservice.initialize( astr_mimerequest.datasets[ll_idx].arguments ) = -1 then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_datasetattrib[ll_idx].inv_argumentservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to initialize the ArgumentService for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 end if //Get the Update Action lnv_datasetattrib[ll_idx].inv_argumentservice.getArgument( inv_constants.EAF_UPDATE_ACTION_TYPE_ARGUMENT_NAME, lnv_datasetattrib[ll_idx].is_action ) //LUW lnv_datasetattrib[ll_idx].ib_luw = lb_luw next //Invoke prepareDataSets() to allow dynamic registration of DataSets ll_rc = prepareDataSets(lnv_datasetattrib) if ll_rc < 0 then inv_log.addError( METHOD_NAME, "Update failed due to error in prepareDataSets()", inv_messaging ) return -1 end If for ll_idx = 1 to ll_upper //Get the internal DataSet Index ll_datasetidx = getDatasetIdx(lnv_datasetattrib[ll_idx].is_name) If ll_datasetidx < 1 Then inv_log.addError( METHOD_NAME, "Invalid DataSet '"+ lnv_datasetattrib[ll_idx].is_name + "' requested for update.", lnv_datasetattrib[ll_idx].inv_messaging ) Return -1 End If //Get update BO Names lnv_datasetattrib[ll_idx].is_updatebonames = inv_registerattrib[ll_datasetidx].is_updatebonames //Determine if DataSet has already been prepared if not lnv_datasetattrib[ll_idx].ib_prepared then //Get DataObject and LanguageID for DataSet inv_registerattrib[ll_datasetidx].inv_dataset.getDataobject(ls_dataobject) // Assign the dataobject and Language ID If lnv_datasetattrib[ll_idx].ids_working.setDataobject(ls_dataobject) <= 0 Then inv_log.addError( METHOD_NAME, "Failed to set DataObject '" + ls_dataobject + "' for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' Make sure DataObject is spelled correctly and has been deployed to the server.", lnv_datasetattrib[ll_idx].inv_messaging ) Return -1 End If If lnv_datasetattrib[ll_idx].ids_working.setLanguageID(GetLanguageID()) <= 0 Then inv_log.addError( METHOD_NAME, "Failed to set LanguageID for DataObject '" + ls_dataobject + "' and DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' Make sure DataObject is spelled correctly and has been deployed to the server.", lnv_datasetattrib[ll_idx].inv_messaging ) Return -1 End If lnv_datasetattrib[ll_idx].ib_prepared = true end if // Assign the transaction object if lnv_datasetattrib[ll_idx].is_action <> inv_constants.UPDATE_SENDALL then ll_rc = lnv_datasetattrib[ll_idx].ids_working.setTransObject(SQLCA) If ll_rc <= 0 Then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_datasetattrib[ll_idx].ids_working.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to set Transaction Object (SQLCA) for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If end if if lb_luw then //Set the original DataSet index for reference in the LUW methods lnv_datasetattrib[ll_idx].il_original_idx = ll_idx end if //Have ContentProviderService prepare the DataSet's content if lnv_datasetattrib[ll_idx].inv_contentproviderservice.prepareContent( lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx], inv_registerattrib[ll_datasetidx].inv_dataset ) = -1 then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_datasetattrib[ll_idx].inv_contentproviderservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to prepare content for DataSet '" + ls_datasetid + "'", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 end if next //Invoke update_startluw if lb_luw then ll_rc = updatestart_luw(lnv_datasetattrib) if ll_rc < 0 then inv_log.addError( METHOD_NAME, "Update cancelled due to failure of LUW UpdateStart processing", inv_messaging ) return -1 end if end if ll_rc = 1 // Loop around all performing the updates for ll_idx = 1 To ll_upper // Get the next Dataset ID ls_datasetid = lnv_datasetattrib[ll_idx].is_name ll_datasetidx = getDatasetIdx(ls_datasetid) ls_debug += "~r~n Processing ls_datasetid='" +ls_datasetid + "' idx=" + string(ll_datasetidx) + "; (" + string(ll_idx) + " of " + string(ll_upper) + ")" //Only process updates if there are updates to process if lnv_datasetattrib[ll_idx].ids_working.modifiedCount() > 0 or lnv_datasetattrib[ll_idx].ids_working.deletedCount() > 0 then //See if the DataSet is to be updated by BusinessObjects ll_bocount = upperBound(inv_registerattrib[ll_datasetidx].is_updatebonames) If ll_bocount = 0 and not inv_registerattrib[ll_datasetidx].ib_allowdirectupdate Then inv_log.warningLog( METHOD_NAME, "Attempted to update a NON-updateable dataset '" + ls_datasetid + "'" ) end if // Pass User ID to dataset object inv_registerattrib[ll_datasetidx].inv_dataset.SetUserName(GetUserName()) // Pass Component Name to dataset object inv_registerattrib[ll_datasetidx].inv_dataset.SetComponentName(this.GetComponentName()) // Pass Languageid to dataset object inv_registerattrib[ll_datasetidx].inv_dataset.SetLanguageid(GetLanguageID()) //Delegate the Update to the DataSet ll_rc = inv_registerattrib[ll_datasetidx].inv_dataset.update(lnv_datasetattrib[ll_idx]) If ll_rc < 1 Then lnv_datasetattrib[ll_idx].inv_messaging.append( inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging ) inv_log.addError( METHOD_NAME, "Update failed for DataSet '" + ls_datasetid + "'", lnv_datasetattrib[ll_idx].inv_messaging ) exit end if end If if lb_LUW then ll_rc = updateBetween_LUW(lnv_datasetattrib, ll_idx) if ll_rc < 0 Then inv_log.addError( METHOD_NAME, "Update cancelled due to failure of LUW UpdateBetween processing", inv_messaging ) ll_rc = -1 exit End If end if next if ll_rc = 1 then if lb_luw then ll_rc = updateend_luw(lnv_datasetattrib) if ll_rc < 0 then inv_log.addError( METHOD_NAME, "Update cancelled due to failure of LUW UpdateEnd processing", inv_messaging ) return -1 end if end if end if catch ( RuntimeError re ) ls_runtimeerror = "Runtime Error:" + inv_constants.CRLF + inv_constants.CRLF ls_runtimeerror += "Error Code: " + string(re.number) + inv_constants.CRLF ls_runtimeerror += "Object: " + re.objectName + inv_constants.CRLF ls_runtimeerror += "Class: " + re.class + inv_constants.CRLF ls_runtimeerror += "Function/Event: " + re.routineName + inv_constants.CRLF ls_runtimeerror += "Line: " + string(re.line) + inv_constants.CRLF ls_runtimeerror += "Message: " + re.getMessage() + inv_constants.CRLF inv_log.addError( METHOD_NAME, "Runtime Error: " + ls_runtimeerror, inv_messaging ) this.setAbort() return -1 finally // Find out if the Transaction has been aborted lb_istransactionaborted = this.isTransactionAborted() // Make sure the return code is properly matched to the Transaction status If ll_rc > 0 And lb_istransactionaborted Then // A Component must have aborted without setting a proper return value ls_debug += "~r~n A Component must have aborted without setting a proper return value. Changing ll_rc to -1" ll_rc = - 1 ElseIf ll_rc < 0 And not lb_istransactionaborted Then // A Component must have said it would abort but failed to do such ls_debug += "~r~n A Component must have returned -1 without setting a proper Transaction setAbort(). Changing Transaction to setAbort()" this.setAbort() lb_istransactionaborted = true End If ll_upper = upperBound( lnv_datasetattrib ) //Places all messages in reference structure here in case of errors For ll_idx = 1 To ll_upper ll_datasetidx = getDataSetIdx( lnv_datasetattrib[ll_idx].is_name ) if not lb_istransactionaborted then //Need to reset updates in this case. lnv_datasetattrib[ll_idx].ids_working.resetUpdate() end if //Invoke the dataset's createContentBegin method to allow changes specific to content type before generation ll_ccrc = inv_registerattrib[ll_datasetidx].inv_dataset.createContentBegin( lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx] ) Choose Case ll_ccrc Case -1 lnv_datasetattrib[ll_idx].inv_messaging.append( inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed in createContentBegin of dataset '" + lnv_datasetattrib[ll_idx].is_name + "'", lnv_datasetattrib[ll_idx].inv_messaging ) ll_rc = -1 Case 1 //Instruct the Content Provider service to create the content for the requested MIME Type If lnv_datasetattrib[ll_idx].inv_contentproviderservice.createContent(lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx]) < 0 Then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_datasetattrib[ll_idx].inv_contentproviderservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to create content for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) ll_rc = -1 End If //Invoke the dataset's createContentEnd method to allow changes specific to content type before generation if inv_registerattrib[ll_datasetidx].inv_dataset.createContentEnd( lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx] ) = -1 then lnv_datasetattrib[ll_idx].inv_messaging.append( inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed in createContentEnd of dataset '" + lnv_datasetattrib[ll_idx].is_name + "'", lnv_datasetattrib[ll_idx].inv_messaging ) ll_rc = -1 end if Case 2 //Skip the content creation service - content was created in DataSet's createContentBegin method End Choose //Add Row Count as Message lnv_datasetattrib[ll_idx].inv_messaging.add( inv_constants.EAF_ROWCOUNT_MESSAGE_NAME, inv_constants.MESSAGE_TYPE_EAF_DATA, string( lnv_datasetattrib[ll_idx].ids_working.rowCount() ) ) //Place the Messages onto the mime request dataset messages property for return to client lnv_datasetattrib[ll_idx].inv_messaging.toXML( ls_characterset, astr_mimerequest.datasets[ll_idx].messages ) Next //Put the InterfaceManager messages into the messages holder on the structure inv_messaging.toXML( ls_characterset, astr_mimerequest.messages ) //Clean up local objects if isValid( lnv_dssrv ) then destroy lnv_dssrv end if if isValid( lnv_contentproviderservicebroker ) then destroy lnv_contentproviderservicebroker end if ll_upper = upperBound( lnv_datasetattrib[] ) for ll_idx = 1 to ll_upper if isValid( lnv_datasetattrib[ll_idx] ) then destroy lnv_datasetattrib[ll_idx] end if next inv_log.debugLog(METHOD_NAME, inv_constants.MESSAGE_TYPE_EAF_DEBUG, "Summary of..."+ ls_debug) end try return ll_rc end function protected function long updatestart_luw (ref n_cst_datasetattrib anv_datasetattrib[]);//////////////////////////////////////////////////////////////// // Description: // Called by the update process prior to performing any updates // Revisions // 3.0 - Initial version // Arguments: // anv_datasetattrib - an array of DataSet Attribute objects // // 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 = "updateStart_LUW ( REF n_cst_datasetattrib[] )" inv_log.traceLog (METHOD_NAME, "") // If there are more than one datasets and only one newmodified row, it need pass pk to referenced datasets maybe if UpperBound(anv_datasetattrib) > 1 then if anv_datasetattrib[1].ids_working.RowCount() = 1 then if anv_datasetattrib[1].ids_working.GetItemStatus(1, 0, Primary!) = NewModified! then anv_datasetattrib[1].inv_messaging.add ("requestpkflag", inv_constants.MESSAGE_TYPE_EAF_DATA, "true") end if end if end if return 1 end function protected function long updatebetween_luw (ref n_cst_datasetattrib anv_datasetattrib[], long al_datasetidx);//////////////////////////////////////////////////////////////// // Description: // Called by the update process after each successsful update of a dataset // If al_datasetidx = upperbound(anv_luwattrib) then this is the last dataset to be updated // // Revisions // 2.0 - Initial version // Arguments: // anv_luwattrib - an array of luwattrib objects // al_datasetidx - the index if the dataset being updated // // 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 = "updateBetween_LUW " inv_log.traceLog (METHOD_NAME, "") Long ll_row, ll_row1 String ls_text, ls_autocodecolumn, ls_trno, ls_idcolumn, ls_table if UpperBound(anv_datasetattrib) > 1 and al_datasetidx = 1 then if anv_datasetattrib[1].inv_messaging.GetMessageText("requestpkflag", ls_text) = 1 then if Lower(ls_text) = "true" then // Set Document Code anv_datasetattrib[1].inv_messaging.GetMessageText("autocodecolumn", ls_autocodecolumn) if ls_autocodecolumn <> "" then anv_datasetattrib[1].inv_messaging.GetMessageText(ls_autocodecolumn, ls_trno) for ll_row = 2 to UpperBound(anv_datasetattrib) if anv_datasetattrib[ll_row].ids_working.iscolumnexist(ls_autocodecolumn) then for ll_row1 = 1 to anv_datasetattrib[ll_row].ids_working.RowCount() anv_datasetattrib[ll_row].ids_working.SetItem(ll_row1, ls_autocodecolumn, ls_trno) next end if next end if // Set Identity ID anv_datasetattrib[1].inv_messaging.GetMessageText("identitycolumn", ls_idcolumn) ls_table = Lower(anv_datasetattrib[1].ids_working.Describe("DataWindow.Table.UpdateTable")) if ls_idcolumn <> "" then anv_datasetattrib[1].inv_messaging.GetMessageText(ls_idcolumn, ls_trno) for ll_row = 2 to UpperBound(anv_datasetattrib) if anv_datasetattrib[ll_row].ids_working.iscolumnexist(ls_table + "_" + ls_idcolumn) then for ll_row1 = 1 to anv_datasetattrib[ll_row].ids_working.RowCount() anv_datasetattrib[ll_row].ids_working.SetItem(ll_row1, ls_table + "_" + ls_idcolumn, Long(ls_trno)) next end if next end if end if end if end if return 1 end function protected function long retrievebetween_luw (long al_justretrieved, ref n_cst_datasetattrib anv_datasetattribs[]);//////////////////////////////////////////////////////////////// // Description: // Called by the retrieve process between each retrieve // The entry in the as_dataset matches the entry in the ads_datastores // only if it has been retrieved yet. Use the al_justretrieved as an index // into both arrays for what has been completed. // If al_justretrieved = upperbound(astr_datasets) then this is the LAST dataset to be retrieved // // Revisions // 2.0 - Initial version // Arguments: // al_justcompleted - the index into the array of the retrieve that was just completed. // anv_datasetattribs[] - an array of n_cst_datasetattrib objects // ads_datastores[] - an array of n_datastores // // 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 = "retrieveStart_LUW " return 1 end function public function long defineloggingservice ();//////////////////////////////////////////////////////////////// // Description: // Sets the logging service implementation class name to n_cst_imloggingservice // Revisions // 3.0 - Initial version // Arguments: // as_error - The actual error messsage // 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 = "defineLoggingService( ) " is_loggingservice = "n_cst_imloggingservice" Return 1 end function protected function long preparedatasets (ref n_cst_datasetattrib anv_datasetattribs[]);//////////////////////////////////////////////////////////////// // Description: // Called by the retrieve process before retrieves are actually performed. // Purpose of this method is to provide a place to add DataSets at runtime // Sample code below // Revisions // 3.0 - Initial version // Arguments: // anv_datasetattribs[] - an array of dataset attribute objects // // 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 = "prepareDataSets( n_cst_datasetattrib[] ) " long ll_datasetcount long ll_datasetindex, ll_row string ls_holder, ls_runtimeerror string ls_dataobjectname, ls_datasetname, ls_datasettype boolean lb_updateable n_cst_stringservice lnv_string String ls_retrievebonames, ls_retrieveboname[] String ls_updatebonames, ls_updateboname[] n_cst_dataset lnvo_dataset String ls_deleteflag try ll_datasetcount = upperBound( anv_datasetattribs ) for ll_datasetindex = 1 to ll_datasetcount if anv_datasetattribs[ll_datasetindex].is_action = inv_constants.UPDATE_SENDALL then lnvo_dataset = create n_cst_dataset // Pass Component Name to dataset object lnvo_dataset.SetComponentName(this.GetComponentName()) // Pass User ID to dataset object lnvo_dataset.SetUserName(GetUserName()) // Pass Languageid to dataset object lnvo_dataset.SetLanguageid(GetLanguageID()) //Register the dataset if registerDataSet( anv_datasetattribs[ll_datasetindex].is_name, lnvo_dataset, ls_retrieveboname, ls_updateboname, lb_updateable ) <= 0 then if IsValid(lnvo_dataset) then destroy lnvo_dataset end if return -1 end if // Set as Prepared anv_datasetattribs[ll_datasetindex].ib_prepared = true continue end if //Determine if the dataset has already been registered if getDataSetIDX( anv_datasetattribs[ll_datasetindex].is_name ) <=0 then //Not found....attempt to register anv_datasetattribs[ll_datasetindex].inv_argumentservice.getArgument( "DataWindowObjectName", ls_dataobjectname ) anv_datasetattribs[ll_datasetindex].inv_argumentservice.getArgument( "DataSetName", ls_datasetname ) if ls_dataobjectname = "" and ls_datasetname = "" then //Fails because DWO or dataset name was not passed addError( METHOD_NAME, "Failed to register DataSet " + anv_datasetattribs[ll_datasetindex].is_name + " because DataWindowObjectName or DataSetName argument not found" ) return -1 end if if not isValid ( lnv_string ) then lnv_string = create n_cst_stringservice end if //Determine if the new DataSet is updateable if anv_datasetattribs[ll_datasetindex].inv_argumentservice.getArgument( "Updateable", ls_holder ) = 1 then lb_updateable = lnv_string.toBoolean( ls_holder ) else //Default updateable setting lb_updateable = true end if //Determine the retrieve businessobjects if anv_datasetattribs[ll_datasetindex].inv_argumentservice.getArgument( "RetrieveBoNames", ls_retrievebonames ) = 1 then lnv_string.Parsestringtoarray( ls_retrievebonames, ";", ls_retrieveboname) end if //Determine the update businessobjects if anv_datasetattribs[ll_datasetindex].inv_argumentservice.getArgument( "UpdateBoNames", ls_updatebonames ) = 1 then lnv_string.Parsestringtoarray( ls_updatebonames, ";", ls_updateboname) end if //Determine the dataset type if anv_datasetattribs[ll_datasetindex].inv_argumentservice.getArgument( "DataSetType", ls_datasettype ) = 1 then if IsNumber(ls_datasettype) then il_datasettype = Long(ls_datasettype) else addError(METHOD_NAME, "Invalid DataSetType arguement datatype") return -1 end if end if if ls_datasetname = "" then lnvo_dataset = create n_cst_dataset else lnvo_dataset = create using ls_datasetname end if // Pass Component Name to dataset object lnvo_dataset.SetComponentName(this.GetComponentName()) // Pass User ID to dataset object lnvo_dataset.SetUserName(GetUserName()) // Pass Languageid to dataset object lnvo_dataset.SetLanguageid(GetLanguageID()) //Register the dataset if registerDataSet( anv_datasetattribs[ll_datasetindex].is_name, lnvo_dataset, ls_retrieveboname, ls_updateboname, lb_updateable ) <= 0 then if IsValid(lnvo_dataset) then destroy lnvo_dataset end if return -1 end if if ls_dataobjectname <> "" then // Pass Languageid to dataset object anv_datasetattribs[ll_datasetindex].ids_working.SetLanguageid(GetLanguageID()) anv_datasetattribs[ll_datasetindex].ids_working.SetDataObject(ls_dataobjectname, il_datasettype, is_resourcesearchpath) end if // If delete falg = true, delete all data for update if il_datasettype = inv_constants.DATASET_TYPE_SQL then if anv_datasetattribs[ll_datasetindex].inv_argumentservice.getArgument( "DeleteFlag", ls_deleteflag ) = 1 then if Lower(ls_deleteflag) = "y" or Lower(ls_deleteflag) = "true" then anv_datasetattribs[ll_datasetindex].ids_working.Retrieve() for ll_row = anv_datasetattribs[ll_datasetindex].ids_working.RowCount() to 1 step -1 anv_datasetattribs[ll_datasetindex].ids_working.DeleteRow(ll_row) next end if end if end if // Set as Prepared anv_datasetattribs[ll_datasetindex].ib_prepared = true end if next catch ( RuntimeError re ) ls_runtimeerror = "Runtime Error:" + inv_constants.CRLF + inv_constants.CRLF ls_runtimeerror += "Error Code: " + string(re.number) + inv_constants.CRLF ls_runtimeerror += "Object: " + re.objectName + inv_constants.CRLF ls_runtimeerror += "Class: " + re.class + inv_constants.CRLF ls_runtimeerror += "Function/Event: " + re.routineName + inv_constants.CRLF ls_runtimeerror += "Line: " + string(re.line) + inv_constants.CRLF inv_log.addError( METHOD_NAME, "Runtime Error: " + ls_runtimeerror, inv_messaging ) if IsValid(lnvo_dataset) then destroy lnvo_dataset end if return -1 finally if isValid( lnv_string ) then destroy lnv_string end if end try return 1 end function protected function long retrieveend_luw (ref n_cst_datasetattrib anv_datasetattribs[]);//////////////////////////////////////////////////////////////// // Description: // Called by the retrieve process AFTER retrieves are actually performed. // Revisions // 3.0 - Initial version // Arguments: // anv_datasetattribs[] - an array of dataset attribute objects // // 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 = "retrieveEnd_LUW " inv_log.traceLog (METHOD_NAME, "(anv_datasetattribs[])") If ib_trace and ib_detailed Then long ll_idx for ll_idx = 1 to upperbound(anv_datasetattribs) inv_log.traceLog (METHOD_NAME, "(anv_datasetattribs["+string(ll_idx)+"]."+anv_datasetattribs[ll_idx].is_name+")") next End If return 1 end function protected function long updateend_luw (ref n_cst_datasetattrib anv_datasetattrib[]);//////////////////////////////////////////////////////////////// // Description: // Called by the update process after performing any updates // Revisions // 3.0 - Initial version // Arguments: // anv_datasetattrib - an array of DataSet Attribute objects // // 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 = "updateEnd_LUW ( REF n_cst_datasetattrib[] )" inv_log.traceLog (METHOD_NAME, "") return 1 end function public function long getdefaultretrievebonames (string as_datasetid, datastore ads_working, ref string as_retrieveboname[]);//////////////////////////////////////////////////////////////// // Description: // Gets the default retrieve business objects // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - the current dataset id // ads_working - the current working datastore // as_retrieveboname[] - Returns the retrieve business objects // Returns: // 1 - Success - There are default retrieve business objects entries // 0 - Success - No default retrieve business objects entries // -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 = "getDefaultRetrieveBONames ( datasetname, datastore ads_woring, REF as_retrieveboname[])" String ls_table String ls_classname Long ll_rc n_cst_classdefinitionservice lnvo_classdef inv_log.traceLog (METHOD_NAME, "") lnvo_classdef = create n_cst_classdefinitionservice ll_rc = 0 ls_classname = inv_constants.RETRIEVE_CLASSNAME_PREFIX + "_shared_base" if lnvo_classdef.isclassexist(lower(ls_classname)) then as_retrieveboname[UpperBound(as_retrieveboname) + 1] = ls_classname ll_rc = 1 end if ls_table = Lower(ads_working.Describe("DataWindow.Table.UpdateTable")) ls_classname = inv_constants.RETRIEVE_CLASSNAME_PREFIX + "_" + ls_table if lnvo_classdef.isclassexist(lower(ls_classname)) then as_retrieveboname[UpperBound(as_retrieveboname) + 1] = ls_classname ll_rc = 1 end if destroy lnvo_classdef return ll_rc end function protected function long initialize (ref s_mimerequest astr_mimerequest);constant string METHOD_NAME = "initialize (REF s_mimerequest)" inv_log.traceLog (METHOD_NAME, "") String ls_InterfaceManagerName, ls_userid, ls_languageid, ls_runtimeerror, ls_characterset String ls_resourcesearchpaths, ls_resourcesearchpath[] Long ll_languageid n_cst_stringservice lnv_string try // Validate arguments If IsNull(astr_mimerequest) Then inv_log.addError( METHOD_NAME, "Invalid astr_mimerequest object", inv_messaging ) Return -1 End If //Initialize the ArgumentService with the XML Arguments if inv_argument.initialize( astr_mimerequest.messages ) = -1 then inv_log.addError( METHOD_NAME, "Error initializing argument service", inv_messaging ) return -1 end if //Get the Character Set inv_argument.getArgument( inv_constants.EAF_CHARACTER_SET_ARGUMENT_NAME, ls_characterset ) //Set Component Name inv_argument.getArgument( inv_constants.EAF_INTERFACEMANAGER_COMPONENT_ARGUMENT_NAME, ls_InterfaceManagerName ) SetComponentName(ls_InterfaceManagerName) if IsValid(inv_objecthelper) then inv_objecthelper.SetComponentName(ls_InterfaceManagerName) end if if IsValid(inv_log) then inv_log.SetComponentName(ls_InterfaceManagerName) end if //Get User ID inv_argument.getArgument( inv_constants.EAF_USERID_ARGUMENT_NAME, ls_userid) if ls_userid <> "" then SetUserName(ls_userid) if IsValid(inv_log) then inv_log.SetUserName(ls_userid) end if end if //Get LanguageID inv_argument.getArgument( inv_constants.EAF_LANGUAGEID_ARGUMENT_NAME, ls_languageid ) if IsNumber(ls_languageid) then ll_languageid = Long(ls_languageid) else ll_languageid = 1 end if SetLanguageid(ll_languageid) if IsValid(inv_objecthelper) then inv_objecthelper.SetLanguageid(ll_languageid) end if //Determine the Resource Search Path if inv_argument.getArgument( "ResourceSearchPath", ls_resourcesearchpaths ) = 1 then lnv_string = create n_cst_stringservice if Pos(Lower(ls_resourcesearchpaths), "&languageid") > 0 then ls_resourcesearchpaths = lnv_string.globalreplace( ls_resourcesearchpaths, "&languageid", String(GetLanguageID()), true) end if lnv_string.Parsestringtoarray( ls_resourcesearchpaths, ";", ls_resourcesearchpath) if UpperBound(ls_resourcesearchpath) > 0 then is_resourcesearchpath = ls_resourcesearchpath end if end if // Validate transaction and connect to the database If componentConnect() <> 1 then addError( METHOD_NAME, "Error connecting to the database in componentConnect() operation" ) return -1 End If catch ( RuntimeError re ) ls_runtimeerror = "Runtime Error:" + inv_constants.CRLF + inv_constants.CRLF ls_runtimeerror += "Error Code: " + string(re.number) + inv_constants.CRLF ls_runtimeerror += "Object: " + re.objectName + inv_constants.CRLF ls_runtimeerror += "Class: " + re.class + inv_constants.CRLF ls_runtimeerror += "Function/Event: " + re.routineName + inv_constants.CRLF ls_runtimeerror += "Line: " + string(re.line) + inv_constants.CRLF inv_log.addError( METHOD_NAME, "Runtime Error: " + ls_runtimeerror, inv_messaging ) return -1 finally if IsValid(lnv_string) then destroy lnv_string end if end try return 1 end function public function long executeservice (ref s_mimerequest astr_mimerequest);//////////////////////////////////////////////////////////////// // Description: // Performs a execute service according to the information passed through the MIME Request object // Revisions // 3.0 - Initial version // Arguments: // astr_mimerequest - REF // 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 = "executeservice (REF s_mimerequest)" inv_log.traceLog (METHOD_NAME, "") // Declare local variables string ls_characterset string ls_runtimeerror string ls_servicename string ls_classname string ls_requesttype string ls_table string ls_ids, ls_id[] long ll_id[], ll_row Long ll_ret string ls_functionclass n_cst_component lnvo_service ClassDefinition lclassdef n_cst_stringservice lnvo_string n_cst_argumentservice lnv_argumentservice try if initialize(astr_mimerequest) = -1 then return -1 //Get the Character Set inv_argument.getArgument( inv_constants.EAF_CHARACTER_SET_ARGUMENT_NAME, ls_characterset ) //Create the ArgumentService lnv_argumentservice = create n_cst_argumentservice //Propagate log settings to the ArgumentService inv_log.propagateSettings( lnv_argumentservice ) if lnv_argumentservice.initialize( astr_mimerequest.datasets[1].arguments ) = -1 then inv_messaging.append( lnv_argumentservice.inv_messaging ) addError( METHOD_NAME, "Failed to initialize the ArgumentService for DataSet '" + astr_mimerequest.datasets[1].name + "'" ) return -1 end if //Get requesttype Parameters inv_argument.getArgument( inv_constants.REQUESTTYPE_ARGUMENT_NAME, ls_requesttype) choose case Upper(ls_requesttype) case "COMMIT", "ROLLBACK", "CLOSE", "CLOSEROLLBACK" lnv_argumentservice.getArgument( "id", ls_ids) lnvo_string = create n_cst_stringservice lnvo_string.parsestringtoarray(ls_ids, ",", ls_id) if UpperBound(ls_id) = 0 then addError(METHOD_NAME, "Failed to get Status ID argument" ) return -1 else for ll_row = 1 to UpperBound(ls_id) if not IsNumber(ls_id[ll_row]) then addError(METHOD_NAME, "Invalid Status ID datatype, it should be integer or long." ) return -1 else ll_id[ll_row] = Long(ls_id[ll_row]) end if next end if //Get Table Name lnv_argumentservice.getArgument( "TableName", ls_table ) if ls_table = "" then addError( METHOD_NAME, "Faild to get valid table name for do status processing" ) return -1 end if ls_classname = inv_constants.COMMIT_CLASSNAME_PREFIX + "_" + ls_table case "EXECUTESERVICE" //Get Service Name lnv_argumentservice.getArgument( "ServiceName", ls_servicename ) if ls_servicename = "" then addError( METHOD_NAME, "Faild to get valid service name for execute service processing" ) return -1 end if ls_classname = inv_constants.BUSINESS_SERVICE_CLASSNAME_PREFIX + "_" + ls_servicename case "EXECUTEFUNCTION" //Get Function class lnv_argumentservice.getArgument( "FunctionClass", ls_functionclass ) if ls_functionclass = "" then addError( METHOD_NAME, "Faild to get valid function class for execute service processing" ) return -1 end if ls_classname = ls_functionclass case else addError(METHOD_NAME, "Invalid request type: " + ls_requesttype ) ll_ret = -1 end choose lclassdef = FindClassDefinition(lower(ls_classname)) if ISNULL(lclassdef) then addError( METHOD_NAME, "Faild to find valid NVO class for " + ls_classname) return -1 end if lnvo_service = create using ls_classname lnvo_service.SetComponentName(GetComponentName()) lnvo_service.SetLanguageID(GetLanguageID()) lnvo_service.SetUserName(GetUserName()) choose case Upper(ls_requesttype) case "COMMIT" ll_ret = lnvo_service.Dynamic docommit(ll_id) case "ROLLBACK" ll_ret = lnvo_service.Dynamic dorollback(ll_id) case "CLOSE" ll_ret = lnvo_service.Dynamic close(ll_id) case "CLOSEROLLBACK" ll_ret = lnvo_service.Dynamic closerollback(ll_id) case "EXECUTEFUNCTION" lnv_argumentservice.getArgument( "FunctionName", ls_servicename ) lnvo_service.Dynamic initialize(astr_mimerequest.datasets[1].arguments, astr_mimerequest.datasets[1].data.binary) ll_ret = lnvo_service.TriggerEvent(ls_servicename) case "EXECUTESERVICE" astr_mimerequest.messages = astr_mimerequest.datasets[1].arguments ll_ret = lnvo_service.Dynamic process(astr_mimerequest) end choose inv_messaging.append( lnvo_service.inv_messaging ) catch ( RuntimeError re ) ls_runtimeerror = "Runtime Error:" + inv_constants.CRLF + inv_constants.CRLF ls_runtimeerror += "Error Code: " + string(re.number) + inv_constants.CRLF ls_runtimeerror += "Object: " + re.objectName + inv_constants.CRLF ls_runtimeerror += "Class: " + re.class + inv_constants.CRLF ls_runtimeerror += "Function/Event: " + re.routineName + inv_constants.CRLF ls_runtimeerror += "Line: " + string(re.line) + inv_constants.CRLF addError( METHOD_NAME, "Runtime Error: " + ls_runtimeerror ) return -1 finally //Places all messages in reference structure here in case of errors inv_messaging.toXML( ls_characterset, astr_mimerequest.messages, astr_mimerequest.datasets[1].data.binary ) if IsValid(lnvo_service) then destroy lnvo_service end if if IsValid(lnvo_string) then destroy lnvo_string end if if IsValid(lnv_argumentservice) then destroy lnv_argumentservice end if end try return ll_ret end function protected function long setinterfacelogicbonames (string as_datasetid, string as_itemchangedbonames[], string as_lookupbonames[]);//////////////////////////////////////////////////////////////// // Description: // Set Interface Logic business object // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The datasetid // 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 = "setinterfacelogicbonames( ) " inv_log.traceLog (METHOD_NAME, "") Long ll_datasetidx try ll_datasetidx = getdatasetidx(as_datasetid) if ll_datasetidx <= 0 then addError( METHOD_NAME, "DataSet '" + as_datasetid + "' not found.") return -1 End If inv_registerattrib[ll_datasetidx].is_itemchangedbonames = as_itemchangedbonames inv_registerattrib[ll_datasetidx].is_lookupbonames = as_lookupbonames finally end try Return 1 end function public function long itemchanged (ref s_mimerequest astr_mimerequest);//////////////////////////////////////////////////////////////// // Description: // Performs a itemchanged according to the information passed through the MIME Request object // Revisions // 3.0 - Initial version // Arguments: // astr_mimerequest - REF // 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 = "itemchanged (REF s_mimerequest)" inv_log.traceLog (METHOD_NAME, "") // Declare local variables long ll_idx long ll_upper long ll_datasetidx long ll_rc long ll_datasetindex string ls_datasetid string ls_dataobject string ls_characterset string ls_runtimeerror string ls_table long ll_row n_cst_datasetattrib lnv_datasetattrib[] n_cst_itemchanged lnv_businessobject n_cst_classdefinitionservice lnvo_classdefinitionservice try if initialize(astr_mimerequest) = -1 then return -1 lnvo_classdefinitionservice = create n_cst_classdefinitionservice //Get the Character Set inv_argument.getArgument( inv_constants.EAF_CHARACTER_SET_ARGUMENT_NAME, ls_characterset ) // Determine the number of datasets to be Itemchanged ll_upper = upperBound( astr_mimerequest.datasets ) If ll_upper <= 0 Then inv_log.addError( METHOD_NAME, "No datasets have been requested.", inv_messaging ) return -1 End If //Create and Initialize the DataSetAttrib objects //First loop to establish MessageService etc. in case error occurs in this loop - all MessageService instances are created for ll_datasetindex = 1 to ll_upper //Create the DataSet attribute object lnv_datasetattrib[ll_datasetindex] = create n_cst_datasetattrib //Set the DataSet Name lnv_datasetattrib[ll_datasetindex].is_name = astr_mimerequest.datasets[ll_datasetindex].name //Create the MessagingService lnv_datasetattrib[ll_datasetindex].inv_messaging = create n_cst_messageservice //Place the entire argument string on the attribute object lnv_datasetattrib[ll_datasetindex].is_xmlarguments = astr_mimerequest.datasets[ll_datasetindex].arguments //Create the ArgumentService lnv_datasetattrib[ll_datasetindex].inv_argumentservice = create n_cst_argumentservice //Complete Initialization of DataSetAttrib objects if lnv_datasetattrib[ll_datasetindex].inv_argumentservice.initialize( astr_mimerequest.datasets[ll_datasetindex].arguments ) = -1 then lnv_datasetattrib[ll_datasetindex].inv_messaging.append( lnv_datasetattrib[ll_datasetindex].inv_argumentservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to initialize the ArgumentService for DataSet '" + lnv_datasetattrib[ll_datasetindex].is_name + "'", lnv_datasetattrib[ll_datasetindex].inv_messaging ) return -1 end if //Propagate log settings to the ArgumentService inv_log.propagateSettings( lnv_datasetattrib[ll_datasetindex].inv_argumentservice ) // Create the datastore lnv_datasetattrib[ll_datasetindex].ids_working = create using is_datastore inv_log.propagateSettings( lnv_datasetattrib[ll_datasetindex].ids_working ) next //Invoke prepareDataSets() to allow dynamic registration of DataSets ll_rc = prepareDataSets(lnv_datasetattrib) if ll_rc < 0 then inv_log.addError( METHOD_NAME, "Itemchanged failed due to error in prepareDataSets()", inv_messaging ) return -1 end If // Execute the requested datasets For ll_idx = 1 To ll_upper // Get the dataset ID ls_datasetid = lnv_datasetattrib[ll_idx].is_name //Get the registered index ll_datasetidx = getDatasetIdx(ls_datasetid) if ll_datasetidx <= 0 then inv_log.addError( METHOD_NAME, "DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' not found.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If //Determine if the DataSet has already been prepared if not lnv_datasetattrib[ll_idx].ib_prepared then // Get the appropriate datawindow dataobject inv_registerattrib[ll_datasetidx].inv_dataset.getDataobject(ls_dataobject) If isNull(ls_dataobject) Or Len(trim(ls_dataobject))=0 Then inv_log.addError( METHOD_NAME, "Invalid DataObject for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If // Assign the dataobject and Language If lnv_datasetattrib[ll_idx].ids_working.setLanguageID(GetLanguageID()) <= 0 Then inv_log.addError( METHOD_NAME, "Failed to set LanguageID for DataObject '" + ls_dataobject + "' and DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' Make sure DataObject is spelled correctly and has been deployed to the server.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If If lnv_datasetattrib[ll_idx].ids_working.setDataobject(ls_dataobject) <= 0 Then inv_log.addError( METHOD_NAME, "Failed to set DataObject '" + ls_dataobject + "' for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' Make sure DataObject is spelled correctly and has been deployed to the server.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If lnv_datasetattrib[ll_idx].ib_prepared = true end if // Get registered itemchanged business objects if UpperBound(inv_registerattrib[ll_datasetidx].is_itemchangedbonames) = 0 then // Register itemchanged business objects ls_table = Lower(lnv_datasetattrib[ll_idx].ids_working.Describe("DataWindow.Table.UpdateTable")) if ls_table = "?" or Trim(ls_table) = "" or ls_table = "none" then ls_table = GetComponentName() end if if lnvo_classdefinitionservice.isclassexist(inv_constants.ITEMCHANGED_CLASSNAME_PREFIX + "_" + ls_table) then inv_registerattrib[ll_datasetidx].is_itemchangedbonames[1] = inv_constants.ITEMCHANGED_CLASSNAME_PREFIX + "_" + ls_table else inv_registerattrib[ll_datasetidx].is_itemchangedbonames[1] = inv_constants.ITEMCHANGED_CLASSNAME_PREFIX end if end if // Loop around all Business Objects For ll_row = 1 To UpperBound(inv_registerattrib[ll_datasetidx].is_itemchangedbonames) // Create the Next Business Object try lnv_businessobject = create using inv_registerattrib[ll_datasetidx].is_itemchangedbonames[ll_row] catch ( RuntimeError re1 ) addError(METHOD_NAME, "Cannot create instance of '"+inv_registerattrib[ll_datasetidx].is_itemchangedbonames[ll_row]+"' RetCode="+string(ll_rc)) Return -1 End try // Set Component Name lnv_businessobject.SetComponentName(this.GetComponentName()) // Set User Name lnv_businessobject.SetUserName(this.GetUserName()) // Set Language ID lnv_businessobject.SetLanguageid(this.GetLanguageID()) // Itemchanged if lnv_businessobject.itemchanged(lnv_datasetattrib[ll_idx]) = -1 then return -1 destroy lnv_businessobject next Next catch ( RuntimeError re ) ls_runtimeerror = "Runtime Error:" + inv_constants.CRLF + inv_constants.CRLF ls_runtimeerror += "Error Code: " + string(re.number) + inv_constants.CRLF ls_runtimeerror += "Object: " + re.objectName + inv_constants.CRLF ls_runtimeerror += "Class: " + re.class + inv_constants.CRLF ls_runtimeerror += "Function/Event: " + re.routineName + inv_constants.CRLF ls_runtimeerror += "Line: " + string(re.line) + inv_constants.CRLF inv_log.addError( METHOD_NAME, "Runtime Error: " + ls_runtimeerror, inv_messaging ) return -1 finally //Places all messages in reference structure here in case of errors inv_messaging.toXML( ls_characterset, astr_mimerequest.messages ) //Place the Messages onto the mime request dataset messages property for each DataSet For ll_idx = 1 To ll_upper lnv_datasetattrib[ll_idx].inv_messaging.toXML( ls_characterset, astr_mimerequest.datasets[ll_idx].messages ) Next // Clean up If isValid(lnv_businessobject) Then destroy lnv_businessobject ll_upper = upperBound( lnv_datasetattrib[] ) for ll_idx = 1 to ll_upper if isValid( lnv_datasetattrib[ll_idx] ) then destroy lnv_datasetattrib[ll_idx] end if next if IsValid(lnvo_classdefinitionservice) then destroy lnvo_classdefinitionservice end if end try return 1 end function public function long masterconfirm (ref s_mimerequest astr_mimerequest);//////////////////////////////////////////////////////////////// // Description: // Performs a masterconfirm according to the information passed through the MIME Request object // Revisions // 3.0 - Initial version // Arguments: // astr_mimerequest - REF // 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 = "masterconfirm (REF s_mimerequest)" inv_log.traceLog (METHOD_NAME, "") // Declare local variables long ll_idx long ll_upper long ll_datasetidx long ll_rc long ll_datasetindex string ls_datasetid string ls_dataobject string ls_characterset string ls_runtimeerror string ls_table long ll_row n_cst_datasetattrib lnv_datasetattrib[] n_cst_itemchanged lnv_businessobject n_cst_classdefinitionservice lnvo_classdefinitionservice n_cst_contentproviderservicebroker lnv_contentproviderservicebroker try if initialize(astr_mimerequest) = -1 then return -1 //Create the content provider service broker lnv_contentproviderservicebroker = create n_cst_contentproviderservicebroker inv_log.DYNAMIC propagateSettings( lnv_contentproviderservicebroker ) lnvo_classdefinitionservice = create n_cst_classdefinitionservice //Get the Character Set inv_argument.getArgument( inv_constants.EAF_CHARACTER_SET_ARGUMENT_NAME, ls_characterset ) // Determine the number of datasets to be masterconfirm ll_upper = upperBound( astr_mimerequest.datasets ) If ll_upper <= 0 Then inv_log.addError( METHOD_NAME, "No datasets have been requested.", inv_messaging ) return -1 End If //Create and Initialize the DataSetAttrib objects //First loop to establish MessageService etc. in case error occurs in this loop - all MessageService instances are created for ll_datasetindex = 1 to ll_upper //Create the DataSet attribute object lnv_datasetattrib[ll_datasetindex] = create n_cst_datasetattrib //Set the DataSet Name lnv_datasetattrib[ll_datasetindex].is_name = astr_mimerequest.datasets[ll_datasetindex].name //Create the MessagingService lnv_datasetattrib[ll_datasetindex].inv_messaging = create n_cst_messageservice //Place the entire argument string on the attribute object lnv_datasetattrib[ll_datasetindex].is_xmlarguments = astr_mimerequest.datasets[ll_datasetindex].arguments //Create the ArgumentService lnv_datasetattrib[ll_datasetindex].inv_argumentservice = create n_cst_argumentservice //Complete Initialization of DataSetAttrib objects if lnv_datasetattrib[ll_datasetindex].inv_argumentservice.initialize( astr_mimerequest.datasets[ll_datasetindex].arguments ) = -1 then lnv_datasetattrib[ll_datasetindex].inv_messaging.append( lnv_datasetattrib[ll_datasetindex].inv_argumentservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to initialize the ArgumentService for DataSet '" + lnv_datasetattrib[ll_datasetindex].is_name + "'", lnv_datasetattrib[ll_datasetindex].inv_messaging ) return -1 end if //Propagate log settings to the ArgumentService inv_log.propagateSettings( lnv_datasetattrib[ll_datasetindex].inv_argumentservice ) // Create the datastore lnv_datasetattrib[ll_datasetindex].ids_working = create using is_datastore inv_log.propagateSettings( lnv_datasetattrib[ll_datasetindex].ids_working ) //Create the ContentProviderService for the requested MIME Type if lnv_contentproviderservicebroker.getContentProviderService( astr_mimerequest.datasets[ll_datasetindex].mimetype, lnv_datasetattrib[ll_datasetindex].inv_contentproviderservice ) = -1 then lnv_datasetattrib[ll_datasetindex].inv_messaging.append( lnv_contentproviderservicebroker.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to getContentProviderService:" + astr_mimerequest.datasets[ll_datasetindex].mimetype, lnv_datasetattrib[ll_datasetindex].inv_messaging ) return -1 end if next //Invoke prepareDataSets() to allow dynamic registration of DataSets ll_rc = prepareDataSets(lnv_datasetattrib) if ll_rc < 0 then inv_log.addError( METHOD_NAME, "masterconfirm failed due to error in prepareDataSets()", inv_messaging ) return -1 end If // Execute the requested datasets For ll_idx = 1 To ll_upper // Get the dataset ID ls_datasetid = lnv_datasetattrib[ll_idx].is_name //Get the registered index ll_datasetidx = getDatasetIdx(ls_datasetid) if ll_datasetidx <= 0 then inv_log.addError( METHOD_NAME, "DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' not found.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If //Determine if the DataSet has already been prepared if not lnv_datasetattrib[ll_idx].ib_prepared then // Get the appropriate datawindow dataobject inv_registerattrib[ll_datasetidx].inv_dataset.getDataobject(ls_dataobject) If isNull(ls_dataobject) Or Len(trim(ls_dataobject))=0 Then inv_log.addError( METHOD_NAME, "Invalid DataObject for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If // Assign the dataobject and Language If lnv_datasetattrib[ll_idx].ids_working.setLanguageID(GetLanguageID()) <= 0 Then inv_log.addError( METHOD_NAME, "Failed to set LanguageID for DataObject '" + ls_dataobject + "' and DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' Make sure DataObject is spelled correctly and has been deployed to the server.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If If lnv_datasetattrib[ll_idx].ids_working.setDataobject(ls_dataobject) <= 0 Then inv_log.addError( METHOD_NAME, "Failed to set DataObject '" + ls_dataobject + "' for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "' Make sure DataObject is spelled correctly and has been deployed to the server.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If lnv_datasetattrib[ll_idx].ib_prepared = true end if // Get registered masterconfirm business objects if UpperBound(inv_registerattrib[ll_datasetidx].is_itemchangedbonames) = 0 then // Register masterconfirm business objects ls_table = Lower(lnv_datasetattrib[ll_idx].ids_working.Describe("DataWindow.Table.UpdateTable")) if ls_table = "?" or Trim(ls_table) = "" or ls_table = "none" then ls_table = GetComponentName() end if if lnvo_classdefinitionservice.isclassexist(inv_constants.ITEMCHANGED_CLASSNAME_PREFIX + "_" + ls_table) then inv_registerattrib[ll_datasetidx].is_itemchangedbonames[1] = inv_constants.ITEMCHANGED_CLASSNAME_PREFIX + "_" + ls_table else inv_registerattrib[ll_datasetidx].is_itemchangedbonames[1] = inv_constants.ITEMCHANGED_CLASSNAME_PREFIX end if end if // Loop around all Business Objects For ll_row = 1 To UpperBound(inv_registerattrib[ll_datasetidx].is_itemchangedbonames) // Create the Next Business Object try lnv_businessobject = create using inv_registerattrib[ll_datasetidx].is_itemchangedbonames[ll_row] catch ( RuntimeError re1 ) addError(METHOD_NAME, "Cannot create instance of '"+inv_registerattrib[ll_datasetidx].is_itemchangedbonames[ll_row]+"' RetCode="+string(ll_rc)) Return -1 End try // Set Component Name lnv_businessobject.SetComponentName(this.GetComponentName()) // Set User Name lnv_businessobject.SetUserName(this.GetUserName()) // Set Language ID lnv_businessobject.SetLanguageid(this.GetLanguageID()) // masterconfirm if lnv_businessobject.masterconfirm(lnv_datasetattrib[ll_idx]) = -1 then return -1 destroy lnv_businessobject next //Have ContentProviderService prepare the DataStore's content if lnv_datasetattrib[ll_idx].inv_contentproviderservice.prepareContent( lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx], inv_registerattrib[ll_datasetidx].inv_dataset ) = -1 then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_datasetattrib[ll_idx].inv_contentproviderservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to prepare content for DataSet '" + ls_datasetid + "'", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 end if //Invoke the dataset's createContentBegin method to allow changes specific to content type before generation ll_rc = inv_registerattrib[ll_datasetidx].inv_dataset.createContentBegin( lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx] ) Choose Case ll_rc Case -1 lnv_datasetattrib[ll_idx].inv_messaging.append( inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed in createContentBegin of dataset '" + lnv_datasetattrib[ll_idx].is_name + "'", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 Case 1 //Instruct the Content Provider service to create the content for the requested MIME Type If lnv_datasetattrib[ll_idx].inv_contentproviderservice.createContent(lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx]) < 0 Then lnv_datasetattrib[ll_idx].inv_messaging.append( lnv_datasetattrib[ll_idx].inv_contentproviderservice.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed to create content for DataSet '" + lnv_datasetattrib[ll_idx].is_name + "'.", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 End If //Invoke the dataset's createContentEnd method to allow changes specific to content type before generation if inv_registerattrib[ll_datasetidx].inv_dataset.createContentEnd( lnv_datasetattrib[ll_idx], astr_mimerequest.datasets[ll_idx] ) = -1 then lnv_datasetattrib[ll_idx].inv_messaging.append( inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging ) inv_log.addError( METHOD_NAME, "Failed in createContentEnd of dataset '" + lnv_datasetattrib[ll_idx].is_name + "'", lnv_datasetattrib[ll_idx].inv_messaging ) return -1 end if Case 2 //Skip the content creation service - content was created in DataSet's createContentBegin method End Choose //Add Row Count as Message lnv_datasetattrib[ll_idx].inv_messaging.add( inv_constants.EAF_ROWCOUNT_MESSAGE_NAME, inv_constants.MESSAGE_TYPE_EAF_DATA, string( lnv_datasetattrib[ll_idx].ids_working.rowCount() ) ) Next catch ( RuntimeError re ) ls_runtimeerror = "Runtime Error:" + inv_constants.CRLF + inv_constants.CRLF ls_runtimeerror += "Error Code: " + string(re.number) + inv_constants.CRLF ls_runtimeerror += "Object: " + re.objectName + inv_constants.CRLF ls_runtimeerror += "Class: " + re.class + inv_constants.CRLF ls_runtimeerror += "Function/Event: " + re.routineName + inv_constants.CRLF ls_runtimeerror += "Line: " + string(re.line) + inv_constants.CRLF inv_log.addError( METHOD_NAME, "Runtime Error: " + ls_runtimeerror, inv_messaging ) return -1 finally //Places all messages in reference structure here in case of errors inv_messaging.toXML( ls_characterset, astr_mimerequest.messages ) //Place the Messages onto the mime request dataset messages property for each DataSet For ll_idx = 1 To ll_upper lnv_datasetattrib[ll_idx].inv_messaging.toXML( ls_characterset, astr_mimerequest.datasets[ll_idx].messages ) Next // Clean up If isValid(lnv_businessobject) Then destroy lnv_businessobject ll_upper = upperBound( lnv_datasetattrib[] ) for ll_idx = 1 to ll_upper if isValid( lnv_datasetattrib[ll_idx] ) then destroy lnv_datasetattrib[ll_idx] end if next if IsValid(lnvo_classdefinitionservice) then destroy lnvo_classdefinitionservice end if if isValid( lnv_contentproviderservicebroker ) then destroy lnv_contentproviderservicebroker end if end try return 1 end function protected function long applydataobjectrules (string as_datasetid, ref datastore ads_working, string as_businessobjects[], boolean ab_retrievebefore, string as_retrieveaction, ref n_cst_messageservice anv_messaging);//////////////////////////////////////////////////////////////// // Description: // Apply DataObject Rules to the passed in datastore. // Revisions // 1.0 - Initial version // Arguments: // as_datasetid - The dataset ID // ads_working - The datastore to receive the changes // as_businessobjects[] - The objects responsible for the rules // Returns: // 1 - Success - Rules were applied // 0 - Success - No rules were applied // -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 = "applyDataobjectRules (as_datasetid, as_dataobject, ads_working, as_businessobjects[])" inv_log.traceLog (METHOD_NAME, "") // Declare local variables long ll_rc long ll_idx long ll_upper long ll_start, ll_end boolean lb_debug string ls_boname string ls_dwsyntax string ls_dwsyntaxoriginal string ls_dwdata string ls_dwdataoriginal string ls_dwsyntaxout string ls_dwdataout blob lblb_dwsyntax blob lblb_dwsyntaxout string ls_defretrievebonames[] string ls_runtimeerror string ls_returnsyntax boolean lb_retrievedataonly long ll_row string ls_cname n_cst_RetrieveObject lnv_businessobject try // Validate arguments If isNull(as_datasetid) Then // Empty values are allowed addError(METHOD_NAME, "Invalid as_datasetid argument") Return -1 End If If isNull(ads_working) or Not isValid(ads_working) Then addError(METHOD_NAME, "Invalid ads_working argument") Return -1 End If If not IsNumber(ads_working.Describe("DataWindow.Processing")) Then addError(METHOD_NAME, "Invalid ads_working.dataobject or datawindow syntax argument value") Return -1 End If If IsNull(as_businessobjects) Then addError(METHOD_NAME, "Invalid as_businessobjects argument") Return -1 End If // Get Default retrieve businessobjects if this.GetDefaultRetrieveBONames(as_datasetid, ads_working, ls_defretrievebonames) = 1 then for ll_idx = 1 to UpperBound(ls_defretrievebonames) as_businessobjects[UpperBound(as_businessobjects) + 1] = ls_defretrievebonames[ll_idx] next end if ll_upper = upperBound(as_businessobjects) If ll_upper = 0 Then return 0 // Allow the Business Objects to set any requirements on the DataWindow Object ls_dwsyntaxoriginal = ads_working.object.datawindow.syntax ls_dwsyntax = ls_dwsyntaxoriginal if not ab_retrievebefore then ls_dwdataoriginal = ads_working.object.datawindow.data ls_dwdata = ls_dwdataoriginal end if // Loop around all Business Objects For ll_idx = 1 To ll_upper ls_boname = as_businessobjects[ll_idx] // Create the Next Business Object try lnv_businessobject = create using ls_boname catch ( RuntimeError re1 ) addError(METHOD_NAME, "Cannot create instance of '"+ls_boname+"' RetCode="+string(ll_rc)) Return -1 End try // Set Component Name lnv_businessobject.SetComponentName(this.GetComponentName()) // Set User Name lnv_businessobject.SetUserName(this.GetUserName()) // Set Language ID lnv_businessobject.SetLanguageid(this.GetLanguageID()) If as_retrieveaction = inv_constants.RETRIEVE_DATAONLY then lb_retrievedataonly = true else lb_retrievedataonly = false end if // Ask the Business Object to set its requirements if ab_retrievebefore then ll_rc = lnv_businessobject.applyDataobjectRules( & as_datasetid, ads_working.dataobject, ls_dwsyntax, ls_dwsyntaxout) else ls_returnsyntax = "" ll_rc = lnv_businessobject.applyDataobjectRulesAfterRetrieve( & as_datasetid, ads_working.dataobject, ls_dwsyntax, ls_dwdata, lb_retrievedataonly, ls_dwsyntaxout, ls_dwdataout, ls_returnsyntax) if lb_retrievedataonly and ls_returnsyntax <> "" then anv_messaging.add("returnsyntax", ls_returnsyntax) end if end if anv_messaging.append( lnv_businessobject.inv_messaging ) If isValid(lnv_businessobject) Then destroy lnv_businessobject If ll_rc < 0 Then addError(METHOD_NAME, "Intercomponent call businessObject.applyDataobjectRules() failed ("+ls_boname+")") Return -1 ElseIf ll_rc > 0 Then If Len(ls_dwsyntaxout) > 0 Then ls_dwsyntax = ls_dwsyntaxout ls_dwsyntaxout = "" End If if not ab_retrievebefore then ls_dwdata = ls_dwdataout ls_dwdataout = "" end if End If Next // Now put the Syntax and data back in the working datastore if not lb_retrievedataonly then If ls_dwsyntax <> ls_dwsyntaxoriginal Then If ads_working.create(ls_dwsyntax) < 0 Then addError(METHOD_NAME, "Unexpected failure of Create operation after Rules were applied") Return -1 End If End If end if if not ab_retrievebefore then If ls_dwsyntax <> ls_dwsyntaxoriginal or ls_dwdata <> ls_dwdataoriginal Then ads_working.Reset() if ls_dwdata <> "" then if lb_retrievedataonly then for ll_row = 1 to Integer(ads_working.Describe("DataWindow.Column.Count")) ls_cname = ads_working.Describe("#" + String(ll_row) + ".Name") ads_working.SetValidate(ls_cname, "") next end if ll_rc = ads_working.ImportString(ls_dwdata) If ll_rc < 0 Then addError(METHOD_NAME, "Unexpected failure of import data operation after Rules were applied, ImportString() returned rc=" + String(ll_rc)) Return -1 End If ads_working.ResetUpdate() end if End If end if catch ( RuntimeError re ) ls_runtimeerror = "Runtime Error:" + inv_constants.CRLF + inv_constants.CRLF ls_runtimeerror += "Error Code: " + string(re.number) + inv_constants.CRLF ls_runtimeerror += "Object: " + re.objectName + inv_constants.CRLF ls_runtimeerror += "Class: " + re.class + inv_constants.CRLF ls_runtimeerror += "Function/Event: " + re.routineName + inv_constants.CRLF ls_runtimeerror += "Line: " + string(re.line) + inv_constants.CRLF addError( METHOD_NAME, "Runtime Error: " + ls_runtimeerror ) return -1 finally If isValid(lnv_businessobject) Then destroy lnv_businessobject end try Return 1 end function on eaf_n_cst_interfacemanager.create call super::create end on on eaf_n_cst_interfacemanager.destroy call super::destroy end on event constructor;call super::constructor;///////////////////////////////////////////////////////////////// // Description: // Occurs when the object is created // Revisions // 1.0 - Initial version // Arguments: // None // Returns: //////////////////////////////////////////////////////////////// // 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 = "constructor " //Create the instance services inv_argument = create n_cst_argumentservice //Propagate log settings to services inv_log.propagateSettings( inv_argument ) end event event deactivate;//////////////////////////////////////////////////////////////// // Description: // Occurs when the object is deactivated // Revisions // 1.0 - Initial version // Arguments: // None // Returns: //////////////////////////////////////////////////////////////// // 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 = "deactivate " long ll_datasetidx long ll_datasetcount //Reset the messages in the instance messaging object inv_messaging.reset() //Reset the argument service instance inv_argument.reset() //Reset the DataSet message services ll_datasetcount = upperBound(inv_registerattrib) for ll_datasetidx = 1 to ll_datasetcount inv_registerattrib[ll_datasetidx].inv_dataset.inv_messaging.reset() next Super::Event deactivate() Return end event event destructor;call super::destructor;///////////////////////////////////////////////////////////////// // Description: // Occurs when the object is destroyed // Revisions // 1.0 - Initial version // Arguments: // None // Returns: //////////////////////////////////////////////////////////////// // 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 = "destructor" long ll_idx long ll_upperbound if isValid( inv_argument ) then destroy inv_argument end if ll_upperbound = upperBound( inv_registerattrib[] ) for ll_idx = 1 to ll_upperbound if isValid( inv_registerattrib[ll_idx]) then destroy inv_registerattrib[ll_idx] end if next end event
File: eaf_n_cst_interfacemanager.sru
Size: 159323
Date: Tue, 22 Jan 2008 23:40:16 +0100
Size: 159323
Date: Tue, 22 Jan 2008 23:40:16 +0100
- n_cst_component eaf_n_cst_interfacemanager(sru)
- applydataobjectrules (string as_datasetid, ref datastore ads_working, string as_businessobjects[], boolean ab_retrievebefore, string as_retrieveaction, ref n_cst_messageservice anv_messaging) returns long
- defineloggingservice () returns long
- executeservice (ref s_mimerequest astr_mimerequest) returns long
- getdatasetidx (string as_datasetid) returns long
- getdefaultretrievebonames (string as_datasetid, datastore ads_working, ref string as_retrieveboname[]) returns long
- getregistered (ref string as_datasetids[]) returns long
- initialize (ref s_mimerequest astr_mimerequest) returns long
- itemchanged (ref s_mimerequest astr_mimerequest) returns long
- masterconfirm (ref s_mimerequest astr_mimerequest) returns long
- preparedatasets (ref n_cst_datasetattrib anv_datasetattribs[]) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, boolean ab_allowdirectupdates) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname, boolean ab_allowdirectupdates) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname, string as_updateboname) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrieveboname, string as_updatebonames[]) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[]) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], boolean ab_allowdirectupdates) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], string as_updateboname) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], string as_updatebonames[]) returns long
- registerdataset (string as_datasetid, n_cst_dataset anv_dataset, string as_retrievebonames[], string as_updatebonames[], boolean ab_allowdirectupdate) returns long
- registerdataset (string as_datasetid, string as_dataobject) returns long
- registerdataset (string as_datasetid, string as_dataobject, boolean ab_allowdirectupdates) returns long
- registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname) returns long
- registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname, boolean ab_allowdirectupdates) returns long
- registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname, string as_updateboname) returns long
- registerdataset (string as_datasetid, string as_dataobject, string as_retrieveboname, string as_updatebonames[]) returns long
- registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[]) returns long
- registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], boolean ab_allowdirectupdates) returns long
- registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], string as_updateboname) returns long
- registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], string as_updatebonames[]) returns long
- registerdataset (string as_datasetid, string as_dataobject, string as_retrievebonames[], string as_updatebonames[], boolean ab_allowdirectupdate) returns long
- retrieve (ref s_mimerequest astr_mimerequest) returns long
- retrievebetween_luw (long al_justretrieved, ref n_cst_datasetattrib anv_datasetattribs[]) returns long
- retrieveend_luw (ref n_cst_datasetattrib anv_datasetattribs[]) returns long
- retrievestart_luw (ref n_cst_datasetattrib anv_datasetattribs[]) returns long
- setdataset (string as_dataset) returns long
- setdatastore (string as_datastore) returns long
- setinterfacelogicbonames (string as_datasetid, string as_itemchangedbonames[], string as_lookupbonames[]) returns long
- setluwprocessing (long al_type) returns long
- update (ref s_mimerequest astr_mimerequest) returns long
- updatebetween_luw (ref n_cst_datasetattrib anv_datasetattrib[], long al_datasetidx) returns long
- updateend_luw (ref n_cst_datasetattrib anv_datasetattrib[]) returns long
- updatestart_luw (ref n_cst_datasetattrib anv_datasetattrib[]) returns long