project BLF > class RPCRequestService > method ReadContextPropertiesForXMLImport

Description

This method reads all context properties needed for the XML Import functionality.


Parameters


izInputDSinputdataset-handle
ocActionoutputcharacter
ocActivityoutputcharacter
olReturnObjectDatasetoutputlogical
olReturnInternalIdsoutputlogical
olIsPartialUpdateoutputlogical
ocPartialUpdateExceptionListoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method RPCRequestService.ImportXML


program code (program1/rpcrequestservice.p)

/* action: this is the action that should be performed for the incoming data.  This action is the same as defined for 
   the XML daemon. This action is only relevant when the data passed into here is for creation. 
   The following values are accepted:
    SAVE: (this is the default when this property is left blank)  This action indicates that the system should try to 
          process the data, and return the normal error messages via the ohException dataset in case of an error.  
          It returns 0 in oiReturnStatus if the data was correctly processed, with no errors in the business logic.  
          It returns <0 in oiReturnStatus if there was an error in the business logic.
    SAVEDRAFT: this action indicates that the system should try to process the data.  If the business code returns an error, 
               then it tries to save the object(s) as draft, so that they can be completed later on.  
               The value in oiReturnStatus will be 0 if the data is processed correctly, 
               or if drafts were successfully created. It only returns a negative value if something goes wrong in 
               the other logic.
    DRAFT: this action indicates that the system should save the incoming data immediately as draft, 
           without prior attempt to validate the data.
    VALIDATE: this action indicates that the system should only try to validate the incoming data, 
              without trying to save it neither as real object nor as draft. */
assign ocAction = <M-12 GetContextProperty
                     (input  '' (icPropertyQualifier), 
                      input  'action' (icPropertyName)) in RPCRequestService>.

/* activity: pass the code of an activity defined in the referenced business component, or leave blank.
   For deleting records in the database, you need activity code 'DELETE' */
assign ocActivity = <M-15 GetContextProperty
                       (input  '' (icPropertyQualifier), 
                        input  'activity' (icPropertyName)) in RPCRequestService>.

/* returnObjectDataset: If this property is set to false (or no) the system will not return any data.
   By default, it will return the object dataset.  */
assign vcReturnObjectDataset = <M-16 GetContextProperty
                                  (input  '' (icPropertyQualifier), 
                                   input  'returnObjectDataset' (icPropertyName)) in RPCRequestService>
       olReturnObjectDataset = not can-do("false,no", vcReturnObjectDataset).

/* Read some properties from the tContextInfo table in the input dataset */
assign vhtContextInfo = izInputDS::tContextInfo no-error.

if valid-handle(vhtContextInfo)
then vlFound = izInputDS::tContextInfo:find-first() no-error.

if vlFound
then do:
    if ocActivity = ? or
       ocActivity = ""
    then assign ocActivity = izInputDS::tContextInfo::tcActivityCode no-error.

    /* PartialUpdate: this property is used to indicate that the dataset that is passed should be treated as a partial
       dataset.  Default is false. */
    /* PartialUpdateExceptionList: This property is used to pass the list of fields that does not need to be taken
       into account for the partial update.  The fields in this list will ALLWAYS be updated, whatever
       the value in the input field is.  This is to overcome the situation where the value of a field
       NEEDS to be unknown value. */
    /* ReturnInternalIds: this property can be used to force the system to return the internal ID values.
       By default, only the ID of the main table is returned. */
    assign vlInfoFromtContextInfo    = false
           vcCommentFromtContextInfo = izInputDS::tContextInfo::tcComment no-error.

    do viFcCount1 = num-entries(vcCommentFromtContextInfo, " ") to 1 by -1:
        assign vcEntry = entry(viFcCount1, vcCommentFromtContextInfo, " ").

        if vcEntry begins "ReturnInternalIds="
        then assign olReturnInternalIds = can-do("yes,true", replace(vcEntry, "ReturnInternalIds=", "")).
    end.

    assign vhField = izInputDS::tContextInfo:buffer-field("tlPartialUpdate") no-error.

    if valid-handle(vhField)
    then assign olIsPartialUpdate      = izInputDS::tContextInfo::tlPartialUpdate
                vlInfoFromtContextInfo = true.

    assign vhField = izInputDS::tContextInfo:buffer-field("tcPartialUpdateExceptionList") no-error.

    if valid-handle(vhField)
    then assign ocPartialUpdateExceptionList = izInputDS::tContextInfo::tcPartialUpdateExceptionList
                vlInfoFromtContextInfo       = true.

    if not vlInfoFromtContextInfo
    then do viFcCount1 = num-entries(vcCommentFromtContextInfo, " ") to 1 by -1:
        assign vcEntry = entry(viFcCount1, vcCommentFromtContextInfo, " ").

        if vcEntry begins "PartialUpdate="
        then assign olIsPartialUpdate = can-do("yes,true", replace(vcEntry, "PartialUpdate=", "")).

        if vcEntry begins "PartialUpdateExceptionList="
        then assign ocPartialUpdateExceptionList = replace(vcEntry, "PartialUpdateExceptionList=", "").
    end.
end.