From 6347bd901603b89cd40a77e001c2c08ffb138cb7 Mon Sep 17 00:00:00 2001 From: Umut Onat Artuvan Date: Wed, 29 Jul 2020 23:01:18 +0200 Subject: [PATCH] bug fix --- SCTransformation/ClientApplicationGenerator.cs | 8 +++++++- .../controller/smartcontract/ControllerEvents.st | 6 +++--- .../controller/smartcontract/ControllerFunctions.st | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/SCTransformation/ClientApplicationGenerator.cs b/SCTransformation/ClientApplicationGenerator.cs index 84f02bc..1ce922f 100644 --- a/SCTransformation/ClientApplicationGenerator.cs +++ b/SCTransformation/ClientApplicationGenerator.cs @@ -89,7 +89,13 @@ private static string BuildJavaApplication(SmartContractDescriptor smartContract foreach (var parameter in function.Outputs) { - template.Add("outputparameterarray", new[] {parameter}); + var privateParameter = new Parameter + { + FirstCapital = ToUpperFirstLetter(parameter.Name), + Name = parameter.Name, + ParamType = parameter.Type + }; + template.Add("outputparameterarray", new[] {privateParameter}); } controllerFunctions += template.Render(); diff --git a/SCTransformation/Templates/JavaApplication/controller/smartcontract/ControllerEvents.st b/SCTransformation/Templates/JavaApplication/controller/smartcontract/ControllerEvents.st index 86961ac..eea5585 100644 --- a/SCTransformation/Templates/JavaApplication/controller/smartcontract/ControllerEvents.st +++ b/SCTransformation/Templates/JavaApplication/controller/smartcontract/ControllerEvents.st @@ -3,7 +3,7 @@ @RequestMapping(value = "/query/€event.Name€", method = RequestMethod.POST, consumes = {MediaType.APPLICATION_JSON_VALUE\}) public List query€event.FirstCapital€(@RequestBody QueryInput input) { List parameters= new ArrayList(){ - €eventoutputparameterarray:{it|{add(new Parameter().builder().name("€it.Name€").type("{\"type\": \"€it.Type€\"\}").build());\}};separator="\n"€ + €eventoutputparameterarray:{it|{add(new Parameter().builder().name("€it.Name€").type("{\"type\": \"€it.ParamType€\"\}").build());\}};separator="\n"€ \}; return scipClientFunctions.performQuery(null,"€event.Name€",parameters,input.getFilter(),input.getTimeFrame()); \} @@ -12,7 +12,7 @@ @RequestMapping(value = "/subscribe/€event.Name€", method = RequestMethod.POST, consumes = {MediaType.APPLICATION_JSON_VALUE\}) public Observable subscribe€event.FirstCapital€(@RequestBody SubscribeInput input) { List parameters= new ArrayList(){ - €eventoutputparameterarray:{it|{add(new Parameter().builder().name("€it.Name€").type("{\"type\": \"€it.Type€\"\}").build());\}};separator="\n"€ + €eventoutputparameterarray:{it|{add(new Parameter().builder().name("€it.Name€").type("{\"type\": \"€it.ParamType€\"\}").build());\}};separator="\n"€ \}; return scipClientFunctions.performSubscribe(null,"€event.Name€",parameters,input.getFilter(),input.getCorrelationIdentifier(), input.getDegreeOfConfidence()); \} @@ -21,7 +21,7 @@ @RequestMapping(value = "/unsubscribe/€event.Name€", method = RequestMethod.POST, consumes = {MediaType.APPLICATION_JSON_VALUE\}) public UnsubscribeResponse unsubscribe€event.FirstCapital€() { List parameters= new ArrayList(){ - €eventoutputparameterarray:{it|{add(new Parameter().builder().name("€it.Name€").type("{\"type\": \"€it.Type€\"\}").build());\}};separator="\n"€ + €eventoutputparameterarray:{it|{add(new Parameter().builder().name("€it.Name€").type("{\"type\": \"€it.ParamType€\"\}").build());\}};separator="\n"€ \}; return scipClientFunctions.performUnsubscribe("€event.Name€",null,parameters,null); \} diff --git a/SCTransformation/Templates/JavaApplication/controller/smartcontract/ControllerFunctions.st b/SCTransformation/Templates/JavaApplication/controller/smartcontract/ControllerFunctions.st index e963aa6..82fdcdb 100644 --- a/SCTransformation/Templates/JavaApplication/controller/smartcontract/ControllerFunctions.st +++ b/SCTransformation/Templates/JavaApplication/controller/smartcontract/ControllerFunctions.st @@ -6,7 +6,7 @@ €inputparameterarray:{it|{add(Parameter.builder().name("€it.Name€").type("{\"type\": \"€it.ParamType€\"\}").value(parameter.get€it.FirstCapital€()).build());\}};separator="\n"€ \}; List outputParameters = new ArrayList(){ - €outputparameterarray:{it|{add(new Parameter().builder().name("€it.name€").type("{\"type\": \"€it.type€\"\}").build());\}};separator="\n"€ + €outputparameterarray:{it|{add(new Parameter().builder().name("€it.Name€").type("{\"type\": \"€it.ParamType€\"\}").build());\}};separator="\n"€ \}; return scipClientFunctions.performInvoke("€function.Name€",inputParameters,outputParameters,parameter.getDegreeOfConfidence()).get(); \}