open-insight/LSL2/STPROC/CUST_EPI_PART_SERVICES.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

100 lines
4.0 KiB
Plaintext

Compile function Cust_Epi_Part_Services(@Service, @Params)
/***********************************************************************************************************************
This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
permission from SRP Computer Solutions, Inc.
Name : Cust_Epi_Part_Services
Description : Handler program for all module related services.
Notes : Service module to support environmental state issues. Environmental refers to the state of the
operating system, which includes version, client vs. server, and path to critical systems.
Parameters :
Service [in] -- Name of the service being requested
Param1-10 [in/out] -- Additional request parameter holders
Response [out] -- Response to be sent back to the Controller (MCP) or requesting procedure
Metadata :
History : (Date, Initials, Notes)
12/06/22 djs Original programmer.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
$insert LOGICAL
$insert SERVICE_SETUP
$insert PROD_SPEC_EQUATES
$insert CUST_EPI_PART_EQUATES
Declare function Database_Services, Error_Services, SRP_JSON
Declare subroutine Database_Services, Error_Services, SRP_JSON
GoToService else
Error_Services('Add', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
end
Return Response or ""
//-----------------------------------------------------------------------------
// SERVICES
//-----------------------------------------------------------------------------
Service ConvertRecordToJSON(KeyID, Record, ItemURL)
jsonRecord = ''
If KeyID NE '' then
If Record EQ '' then Record = Database_Services('ReadDataRow', 'CUST_EPI_PART', KeyID)
If Error_Services('NoError') then
@DICT = Database_Services('GetTableHandle', 'DICT.CUST_EPI_PART')
@ID = KeyID
@RECORD = Record
If SRP_JSON(objJSON, 'New', 'Object') then
If SRP_JSON(objCustEpiPart, 'New', 'Object') then
SRP_JSON(objCustEpiPart, 'SetValue', 'keyId', @ID)
SRP_JSON(objJSON, 'Set', 'custEpiPart', objCustEpiPart)
SRP_JSON(objCustEpiPart, 'Release')
end
If itemURL NE '' then
// The itemURL was passed in so add HAL+JSON properties.
// Create the _links property and then all link objects needed for this resource.
If SRP_JSON(objLinks, 'New', 'Object') then
// Create a self link.
If SRP_JSON(objLink, 'New', 'Object') then
SRP_JSON(objLink, 'SetValue', 'href', ItemURL, 'String')
SRP_JSON(objLink, 'SetValue', 'title', 'Self', 'String')
SRP_JSON(objLinks, 'Set', 'self', objLink)
SRP_JSON(objLink, 'Release')
end
SRP_JSON(objJSON, 'Set', '_links', objLinks)
SRP_JSON(objLinks, 'Release')
end
// Create the _class property for this resource.
SRP_JSON(objJSON, 'SetValue', '_class', 'resource')
end
jsonRecord = SRP_JSON(objJSON, 'Stringify', 'Styled')
SRP_JSON(objJSON, 'Release')
end else
Error_Services('Add', 'Unable to create JSON representation in the ' : Service : ' service.')
end
end
end else
Error_Services('Add', 'KeyID argument was missing in the ' : Service : ' service.')
end
Response = jsonRecord
end service