Merged PR 21151: Return To Fab Operations and Processing

This commit is contained in:
Ouellette Jonathan (CSC FI SPS MESLEO)
2025-07-16 21:17:07 +02:00
parent b607432be4
commit aabd4c3a91
56 changed files with 8856 additions and 2508 deletions

View File

@ -129,7 +129,7 @@ API returntofab.ID.GET
UserId = Xlate('OI_WIZARD', OIWizardID, 'EMPLOYEE_ID', 'X')
RTFId = EndpointSegment
If Error_Services('NoError') AND RTFId NE '' then
RTFJson = Return_To_Fab_Services('ConvertReturnToFabRecordToJSON', RTFId)
RTFJson = Return_To_Fab_Services('ConvertReturnToFabRecordToJSON', RTFId, UserId)
If Error_Services('NoError') then
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
HTTP_Services('SetResponseBody', RTFJson, False$, 'application/hal+json')
@ -247,7 +247,6 @@ end api
API returntofab.reportopenforms.HEAD
API returntofab.reportopenforms.GET
OIWizardID = ''
Cookies = HTTP_Services('GetHTTPCookie')
For each Cookie in Cookies using ';'
@ -258,29 +257,19 @@ API returntofab.reportopenforms.GET
Next Cookie
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
If ValidSession then
UserId = Xlate('OI_WIZARD', OIWizardID, 'EMPLOYEE_ID', 'X')
RTFId = EndpointSegment
If Error_Services('NoError') AND RTFId NE '' then
RTFJson = Return_To_Fab_Services('CreateReturnToFabReportJson', True$)
If Error_Services('NoError') then
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
HTTP_Services('SetResponseBody', RTFJson, False$, 'application/hal+json')
If Assigned(Message) then
HTTP_Services('SetResponseStatus', 201, Message)
end else
HTTP_Services('SetResponseStatus', 201)
end
end else
end
UserId = Xlate('OI_WIZARD', OIWizardID, 'EMPLOYEE_ID', 'X')
RTFJson = Return_To_Fab_Services('CreateReturnToFabReportJson', True$)
If RTFJson NE '' then
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
HTTP_Services('SetResponseBody', RTFJson, False$, 'application/hal+json')
If Assigned(Message) then
HTTP_Services('SetResponseStatus', 201, Message)
end else
HTTP_Services('SetResponseStatus', 400, Error_Services('GetMessage'))
HTTP_Services('SetResponseStatus', 201)
end
end else
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
ErrorMessage = 'Error getting report data.'
end
end api
@ -288,7 +277,6 @@ end api
API returntofab.reportallforms.HEAD
API returntofab.reportallforms.GET
OIWizardID = ''
Cookies = HTTP_Services('GetHTTPCookie')
For each Cookie in Cookies using ';'
@ -303,9 +291,9 @@ API returntofab.reportallforms.GET
If ValidSession then
UserId = Xlate('OI_WIZARD', OIWizardID, 'EMPLOYEE_ID', 'X')
RTFId = EndpointSegment
If Error_Services('NoError') AND RTFId NE '' then
If RTFId NE '' then
RTFJson = Return_To_Fab_Services('CreateReturnToFabReportJson', False$)
If Error_Services('NoError') then
If RTFJson NE '' then
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
HTTP_Services('SetResponseBody', RTFJson, False$, 'application/hal+json')
If Assigned(Message) then
@ -314,11 +302,10 @@ API returntofab.reportallforms.GET
HTTP_Services('SetResponseStatus', 201)
end
end else
ErrorMessage = 'Error getting report data.'
end
end else
HTTP_Services('SetResponseStatus', 400, Error_Services('GetMessage'))
HTTP_Services('SetResponseStatus', 400, 'Return To Fab ID was null')
end
end else
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
@ -370,6 +357,37 @@ CreateResultOptionCollection:
return
CreateOperationOptionCollection:
JSONCollection = ''
Abort = False$
OperationOptions = Return_To_Fab_Services('GetRTFOperationIDs')
hJSONCollection = ''
If SRP_JSON(hJSONCollection, 'New', 'Object') then
hOperationOptionCollection = ''
If SRP_JSON(hOperationOptionCollection, 'New', 'Array') then
For each OperationOptionId in OperationOptions using @VM setting fPos
SRP_Json(hOperationOptionCollection, 'AddValue', OperationOptionId, 'String')
Next OperationOptionId
SRP_JSON(hJSONCollection, 'Set', 'OperationOptions', hOperationOptionCollection)
SRP_JSON(hOperationOptionCollection, 'Release')
end
JSONCollection = SRP_JSON(hJSONCollection, 'Stringify', 'Fast')
SRP_JSON(hJSONCollection, 'Release')
end
If Error_Services('NoError') then
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
HTTP_Services('SetResponseBody', JSONCollection, False$, 'application/hal+json')
If Assigned(Message) then
HTTP_Services('SetResponseStatus', 201, Message)
end else
HTTP_Services('SetResponseStatus', 201)
end
end else
Message = Error_Services('GetMessage')
HTTP_Services('SetResponseStatus', 500, 'Error in the ' : CurrentAPI : ' API. Message: ': Message)
end
return
API returntofab.getreturntofablabelzpl.HEAD
API returntofab.getreturntofablabelzpl.GET
@ -404,3 +422,26 @@ API returntofab.getreturntofablabelzpl.GET
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
end
end api
API returntofab.rtfoperations.HEAD
API returntofab.rtfoperations.GET
OIWizardID = ''
Cookies = HTTP_Services('GetHTTPCookie')
For each Cookie in Cookies using ';'
Key = Field(Cookie, '=', 1)
If Key EQ 'sessionID' then
OIWizardID = Field(Cookie, '=', 2)
end
Next Cookie
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
If ValidSession then
GoSub CreateOperationOptionCollection
end else
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
end
end api