Skip to content

Commit

Permalink
Fixes #709
Browse files Browse the repository at this point in the history
  • Loading branch information
aedelmann committed Aug 4, 2017
1 parent f677c32 commit 3e50063
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ class AWSGenerator implements IVortoCodeGenerator {
IVortoCodeGenProgressMonitor monitor) throws VortoCodeGeneratorException {
var output = new GenerationResultZip(infomodel,getServiceKey());
var chainedGenerators = new ChainedCodeGeneratorTask<InformationModel>();

// chainedGenerators.addTask(new ThingShadowForOperationsTask());


// Adds Generators for Speech to Command using Alexa Skill Service.
// That way it is possible to update a thing shadow by various speech command variations defined as mapping rules
chainedGenerators.addTask(new GeneratorTaskFromFileTemplate(new AlexaIndentSchemaTemplate()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ class AlexaSkillLambdaTemplate extends AbstractAlexaTemplate {
var reprompt;
var welcomeOutput = "Let's ask the «element.name». What do you want to know?";
«IF context.configurationProperties.getOrDefault("boschcloud","false").equalsIgnoreCase("true"
«IF context.configurationProperties.getOrDefault("cloud","").equalsIgnoreCase("bosch"
var thingsApiToken = "INSERT API TOKEN OF BOSCH IOT THINGS HERE";
var thingId = «context.configurationProperties.getOrDefault("thingId","\"INSERT THING ID HERE\"";
var thingId = "«context.configurationProperties.getOrDefault("thingId","INSERT THING ID HERE"";
var username= "INSERT USERNAME HERE";
var password= "INSERT PASSWORD HERE";
var http = require('http');
«ENDIF»
«IF context.configurationProperties.getOrDefault("awsiot","false").equalsIgnoreCase("true"
«IF context.configurationProperties.getOrDefault("cloud","").equalsIgnoreCase("aws"
var config = {
"thingName": "<PUT THING NAME HERE>",
"endpointAddress": "<PUT YOUR ENDPOINT URL HERE>"
Expand Down Expand Up @@ -119,7 +119,7 @@ class AlexaSkillLambdaTemplate extends AbstractAlexaTemplate {
console.log("in fetch«fbProperty.name.toFirstUpper»«statusProperty.name.toFirstUpper»");
var sessionAttributes = {};
«IF context.configurationProperties.getOrDefault("boschcloud","false").equalsIgnoreCase("true"
«IF context.configurationProperties.getOrDefault("cloud","").equalsIgnoreCase("bosch"
var httpRequest = {
host : "things.apps.bosch-iot-cloud.com",
path: "/api/1/things/"+thingId,
Expand All @@ -141,7 +141,7 @@ class AlexaSkillLambdaTemplate extends AbstractAlexaTemplate {
});
});
«ENDIF»
«IF context.configurationProperties.getOrDefault("awsiot","false").equalsIgnoreCase("true"
«IF context.configurationProperties.getOrDefault("cloud","").equalsIgnoreCase("aws"
iotdata.getThingShadow({
thingName: config.thingName
},function(err, data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public IGenerationResult generate(InformationModel infomodel,

if (invocationContext.getConfigurationProperties().getOrDefault("alexa", FALSE).equalsIgnoreCase(TRUE)) {
Map<String, String> props = new HashMap<>();
props.put("boschcloud", "true");
props.put("cloud", "bosch");
props.put("thingId", invocationContext.getConfigurationProperties().getOrDefault("thingId", ""));
IGenerationResult awsResult = invocationContext.lookupGenerator("aws").generate(infomodel,
InvocationContext.simpleInvocationContext(props), monitor);
result.append(awsResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.eclipse.vorto.server.commons.IGeneratorConfigUITemplate

class AWSConfigTemplate implements IGeneratorConfigUITemplate {

private static final Set<String> KEYS = new HashSet(Arrays.asList("boschcloud","awsiot"));
private static final Set<String> KEYS = new HashSet(Arrays.asList("cloud"));

override getContent(GeneratorServiceInfo info) {
'''
Expand All @@ -35,8 +35,8 @@ class AWSConfigTemplate implements IGeneratorConfigUITemplate {
<span class="label label-primary pull-right"><i class="fa fa-cloud"></i></span>
</div><!-- /.box-header -->
<div class="box-body">
<p><input type="checkbox" ng-model="configParams.boschcloud">&nbsp;Bosch IoT Suite</p>
<p><input type="checkbox" ng-model="configParams.awsiot">&nbsp;AWS IoT Thing Shadow</p>
<p><input type="radio" ng-model="configParams.cloud" value="bosch">&nbsp;Bosch IoT Suite</p>
<p><input type="radio" ng-model="configParams.cloud" value="aws">&nbsp;AWS IoT Thing Shadow</p>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ import org.eclipse.vorto.server.commons.IGeneratorConfigUITemplate

class BoschThingsConfigTemplate implements IGeneratorConfigUITemplate {

private static final Set<String> KEYS = new HashSet(Arrays.asList("simulator","validation","alexa", "kura", "webui"));
private static final Set<String> KEYS = new HashSet(Arrays.asList("simulator","validation","alexa", "kura", "webui","thingId"));

override getContent(GeneratorServiceInfo info) {
'''
<div class="form-group">
<div class="row">
<div class="col-sm-12">
<p>Thing ID: <input type="text" size="50" ng-model="configParams.thingId" placeholder="Optional Thing ID, e.g com.mycompany:4711"></p>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="box box-primary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ repositoryControllers.controller('GeneratorConfigController', [ '$scope','$http'
if ($scope.generator.configKeys && $scope.generator.configKeys.length > 0) {
for (var i = 0;i < $scope.generator.configKeys.length;i++) {
var key = $scope.generator.configKeys[i];
if ($scope.configParams[key] === true) {
if ($scope.configParams[key]) {
return true;
}
}
Expand All @@ -463,7 +463,7 @@ repositoryControllers.controller('GeneratorConfigController', [ '$scope','$http'
if ($scope.generator.configKeys && $scope.generator.configTemplate) {
for (var i = 0;i < $scope.generator.configKeys.length;i++) {
var key = result.configKeys[i];
$scope.configParams[key] = false;
$scope.configParams[key] = "";
}
$scope.configTemplate = $scope.generator.configTemplate;
} else {
Expand Down

0 comments on commit 3e50063

Please sign in to comment.