added sysprog entities
This commit is contained in:
163
SYSPROG/STPROC/SRP_GIT_SERIALIZER.txt
Normal file
163
SYSPROG/STPROC/SRP_GIT_SERIALIZER.txt
Normal file
@ -0,0 +1,163 @@
|
||||
Compile function SRP_Git_Serializer(@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 : SRP_Git_Serializer
|
||||
|
||||
Description : Service module for the converting files to formats suitable for Git.
|
||||
|
||||
Parameters:
|
||||
Service [IN] - The service to execute
|
||||
Params [IN] - Service specific parameters
|
||||
|
||||
History (Date, Initials, Notes)
|
||||
02/20/19 KRF Original programmer
|
||||
07/30/19 KRF Renamed to SRP_Git_Serializer and updated to use new DLL stubs
|
||||
************************************************************************************************/
|
||||
#pragma precomp SRP_PreCompiler
|
||||
#pragma output SYSLISTS SRP_GIT_SERIALIZER
|
||||
$insert LOGICAL
|
||||
|
||||
Declare function ISRPGitSerializer_ReadFromGit, ISRPGitSerializer_ReadFileFromGit, ISRPGitSerializer_PathToEntityId, ISRPGitSerializer_Deserialize
|
||||
Declare function ISRPGitSerializer_EntityIdToPath, ISRPGitSerializer_GetSupportedTypes, ISRPGitSerializer_EntityIdToKeys, ISRPGitSerializer_EntityIdToRelativePath
|
||||
Declare function Str_Unicode, Unicode_Str, ISRPGitSerializer_GetMetaData
|
||||
Declare subroutine ISRPGitSerializer_WriteToGit, ISRPGitSerializer_WriteToGitSync, ISRPGitSerializer_DeleteFromGit, ISRPGitSerializer_CopyOutput, ISRPGitSerializer_SetMetaData
|
||||
|
||||
GoToService
|
||||
|
||||
Return Response or ""
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SERVICES
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Converts the given entity into a file suitable for GIT comparisons.
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service Write(EntityId, Record, RepoPath, Metadata)
|
||||
|
||||
If Len(Metadata) then
|
||||
ISRPGitSerializer_SetMetaData(Metadata)
|
||||
end
|
||||
RecordW = Str_Unicode(Record)
|
||||
ISRPGitSerializer_WriteToGit(EntityId, RecordW, Len(Record), RepoPath)
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Converts the given entity into a file suitable for GIT comparisons. Synchronous.
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service WriteSync(EntityId, Record, RepoPath, Metadata)
|
||||
|
||||
If Len(Metadata) then
|
||||
ISRPGitSerializer_SetMetaData(Metadata)
|
||||
end
|
||||
RecordW = Str_Unicode(Record)
|
||||
ISRPGitSerializer_WriteToGitSync(EntityId, RecordW, Len(Record), RepoPath)
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Deletes the file associated with this entity id
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service Delete(EntityId, RepoPath)
|
||||
|
||||
ISRPGitSerializer_DeleteFromGit(EntityId, RepoPath)
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Converts a file suitable for GIT comparisons back into an OI entity.
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service Read(EntityId, RepoPath, Ref Metadata)
|
||||
|
||||
Len = ISRPGitSerializer_ReadFromGit(EntityId, RepoPath)
|
||||
GoSub GetOutput
|
||||
Metadata = ISRPGitSerializer_GetMetaData()
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Reads the given file, returning the record and it's entity id
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service ReadFile(RepoPath, FilePath, Ref EntityId, Ref Metadata)
|
||||
|
||||
EntityId = Str(\00\, 260)
|
||||
Len = ISRPGitSerializer_ReadFileFromGit(EntityId, RepoPath, FilePath)
|
||||
EntityId = EntityId[1, \00\]
|
||||
GoSub GetOutput
|
||||
Metadata = ISRPGitSerializer_GetMetaData()
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Deserializes text
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service Deserialize(EntityId, Text, Ref Metadata)
|
||||
|
||||
Len = ISRPGitSerializer_Deserialize(EntityId, Text)
|
||||
GoSub GetOutput
|
||||
Metadata = ISRPGitSerializer_GetMetaData()
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Given an EntityId, this service constructs the target full file and path name
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service EntityIdToPath(RepoPath, EntityId)
|
||||
|
||||
Response = ISRPGitSerializer_EntityIdToPath(RepoPath, EntityId)
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Given an EntityId, this service constructs the target path name relative to the repo directory
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service EntityIdToRelativePath(EntityId)
|
||||
|
||||
Response = ISRPGitSerializer_EntityIdToRelativePath(EntityId)
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Given a full file and path name, this service constructs the target EntityId
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service PathToEntityId(RepoPath, FilePath)
|
||||
|
||||
Response = ISRPGitSerializer_PathToEntityId(RepoPath, FilePath)
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Given an EntityId, this service constructs all the tables and keys housing that entities data
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service EntityIdToKeys(EntityId)
|
||||
|
||||
Response = ISRPGitSerializer_EntityIdToKeys(EntityId)
|
||||
|
||||
end service
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// An @FM delimited list of supported entity types
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
Service GetSupportedEntityTypes()
|
||||
|
||||
Response = ISRPGitSerializer_GetSupportedTypes()
|
||||
|
||||
end service
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GOSUBS
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GetOutput:
|
||||
|
||||
If Len GT 0 then
|
||||
ResponseW = Str(\0000\, Len)
|
||||
ISRPGitSerializer_CopyOutput(ResponseW, Len)
|
||||
Response = Unicode_Str(ResponseW)
|
||||
end
|
||||
|
||||
return
|
||||
|
Reference in New Issue
Block a user