-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add entity PrintQueue, extend receptionist odata service #25
- Loading branch information
1 parent
8ce51ed
commit 6f8baa5
Showing
3 changed files
with
100 additions
and
5 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
odatareceptionist/procedures/PrintQueueUpdate.hdbprocedure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
-- | ||
-- Copyright 2016 SAP Mentors | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
-- | ||
PROCEDURE "SITREG"."com.sap.sapmentors.sitreg.odatareceptionist.procedures::PrintQueueUpdate" ( | ||
IN inrow "SITREG"."com.sap.sapmentors.sitreg.data::SITreg.PrintQueue", | ||
IN oldrow "SITREG"."com.sap.sapmentors.sitreg.data::SITreg.PrintQueue", | ||
OUT error "SITREG"."com.sap.sapmentors.sitreg.data::SITreg.error" | ||
) | ||
LANGUAGE SQLSCRIPT | ||
SQL SECURITY DEFINER | ||
DEFAULT SCHEMA SITREG | ||
AS | ||
BEGIN | ||
|
||
DECLARE lv_Count INT; | ||
|
||
DECLARE lv_ParticipantID STRING; | ||
DECLARE lv_EventID STRING; | ||
DECLARE lv_FirstName STRING; | ||
DECLARE lv_LastName STRING; | ||
DECLARE lv_Twitter STRING; | ||
DECLARE lv_PrintStatus STRING; -- Q = queued, S = sent, P = printed | ||
DECLARE lv_CreatedBy STRING; | ||
DECLARE lv_CreatedAt STRING; | ||
DECLARE lv_ChangedBy STRING; | ||
DECLARE lv_ChangedAt STRING; | ||
|
||
DECLARE lv_PrintStatus_tmp STRING; | ||
|
||
DECLARE lv_msg STRING; | ||
|
||
SELECT * INTO lv_ParticipantID | ||
, lv_EventID | ||
, lv_FirstName | ||
, lv_LastName | ||
, lv_Twitter | ||
, lv_PrintStatus | ||
, lv_CreatedBy | ||
, lv_CreatedAt | ||
, lv_ChangedBy | ||
, lv_ChangedAt | ||
FROM :inrow; | ||
|
||
SELECT "PrintStatus" | ||
INTO lv_PrintStatus_tmp | ||
FROM "com.sap.sapmentors.sitreg.data::SITreg.PrintQueue" | ||
WHERE "ParticipantID" = lv_ParticipantID; | ||
|
||
IF lv_PrintStatus_tmp <> '' THEN | ||
IF lv_PrintStatus_tmp = 'S' THEN | ||
IF lv_PrintStatus = 'P' THEN | ||
UPDATE "com.sap.sapmentors.sitreg.data::SITreg.PrintQueue" | ||
SET "PrintStatus" = lv_PrintStatus | ||
, "History.ChangedBy" = CURRENT_USER | ||
, "History.ChangedAt" = CURRENT_TIMESTAMP | ||
WHERE "ParticipantID" = lv_ParticipantID; | ||
ELSE | ||
error = select 400 as http_status_code, | ||
'Update failed' error_message, | ||
'Status can only be set to printed' detail from dummy; | ||
END IF; | ||
ELSE | ||
error = select 400 as http_status_code, | ||
'Update failed' error_message, | ||
'Entry is not is status sent' detail from dummy; | ||
END IF; | ||
ELSE | ||
error = select 400 as http_status_code, | ||
'Update failed' error_message, | ||
'Entry does not exist' detail from dummy; | ||
END IF; | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters