Predefined network tasks
Inside framework, there are number of predefined requests, which allow the user to interact with DOCUframe web api.
Authentication
GSDRequestAuthenticate
is a request which allows the user, to log into the database. It is used by the GSDRequestExecutor
, before each call to the database. It will return true when the provided user and password match the ones stored inside the DOCUframe database. All other requests may be performed, when the authentication is sucessfull. It is very important to note, that the password provided to this macro, must not be a clear text string. It has to be an md5() hash of the password.
Example:
1 2 3 4 | let login = "GSDTestUser" let serverAddress = "127.0.0.1" let password = "passwordString".md5() let authenticationRequest = GSDRequestAuthenticate(userName: login, userPassword: password , serverAdresss: serverAddress ) |
Execute Macro
GSDRequestExecuteMacro
is a request which allows the user to call an web interface macro from the database. This request can handle specific parameters, which one want's to pass to the macro.
Example:
1 2 3 4 5 6 7 8 9 10 11 | let parameters = [ "Parameter1":"Value", "Parameter2":"Value2", "Parameter3":3, "Parameter4":[ "Subparameter1":"SubValue1", "Subparameter2":5 ]] let macroName: = "TestMacroName" let executeMacroRequest = GSDRequestExecuteMacro(macroName: macroName) executeMacroRequest.parameters = parameters |
Get Object
GSDRequestGetObject
is a request which allows the user to get an object from the database. By default it takes all the information about the object. Developer has the possibility to provide SerializationObject
which will decide about that, which information's should be returned in a response.
Example:
1 | let getObjectRequest = GSDRequestGetObject(objectOid: "3DFA" returnedFields: [:]) |
Serialization
GSDRequestSerialization
is an protocol, which defines the look of SerializationObject
. It can be used in a request for downloading the information about the object, to format the output data to match certain use-case. Parameters:
DOCUframe by default has got some standard serialization macros implemented. There is a possibility that user will ovveride the default impoementation by his own. By this parameter one can decide on which user level the serializaiton macro should be called.
1 | hmacroLevel:GSDRequestMacroLevel? |
Available macro levels:
- enduser
- oemPartner
- gsd
The type of the serialization which should be used.
1 | serializationType: GSDRequestSerializationType |
Available serialization types:
- empty - In the response user will obtain basic information about object:
ObjectID
,StoreTime
, andClassName
- full - In the response user will obtain all fields, accordingly to standard DOCUframe implementation of
ToJSON
function - macro - In the response user will obtain all fields defined by selected serialization macro
- custom - The response is
The name of the macro, which should be used to serialize a specific object:
1 | macroName:String |