Commit b88ddbdf authored by Peter Harrison's avatar Peter Harrison

TimeerManager - handle issue with loading Rules

changes to play.html - example use of AngularJS & Bootstrap
parent 3001ee4e
......@@ -72,7 +72,7 @@
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
......@@ -89,7 +89,7 @@
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
......@@ -316,7 +316,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.5</version>
<version>4.3.6</version>
</dependency>
<dependency>
......@@ -363,6 +363,30 @@
<version>2.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-elasticloadbalancing</artifactId>
<version>1.10.37</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-iam</artifactId>
<version>1.10.37</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-cloudfront</artifactId>
<version>1.10.37</version>
</dependency>
<dependency>
<groupId>com.sun.xml.stream</groupId>
<artifactId>sjsxp</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
......
......@@ -30,6 +30,7 @@ import java.util.Map;
import javax.annotation.PreDestroy;
import nz.net.orcon.kanban.controllers.BoardsCache;
import nz.net.orcon.kanban.controllers.ResourceNotFoundException;
import nz.net.orcon.kanban.controllers.RuleCache;
import nz.net.orcon.kanban.model.Condition;
import nz.net.orcon.kanban.model.ConditionType;
......@@ -121,14 +122,18 @@ public class TimerManager {
// Start Timers
for( String ruleId : rules.keySet()){
Rule rule = ruleCache.getItem(boardId,ruleId);
if(null != rule.getAutomationConditions()){
for( Condition condition : rule.getAutomationConditions().values()) {
if( ConditionType.TIMER.equals(condition.getConditionType())){
activateTimer( boardId, rule.getId(), condition.getValue());
LOG.info("Timer Loaded: " + boardId + "." + rule.getId());
try {
Rule rule = ruleCache.getItem(boardId,ruleId);
if(null != rule.getAutomationConditions()){
for( Condition condition : rule.getAutomationConditions().values()) {
if( ConditionType.TIMER.equals(condition.getConditionType())){
activateTimer( boardId, rule.getId(), condition.getValue());
LOG.info("Timer Loaded: " + boardId + "." + rule.getId());
}
}
}
} catch(ResourceNotFoundException e){
LOG.warn("Rule not found: " + boardId + "." + ruleId);
}
}
}
......
......@@ -68,6 +68,7 @@
<entry key="dateTool" value-ref="dateTool" />
<entry key="createVariableAction" value-ref="createVariableAction" />
<entry key="clusterManager" value-ref="clusterManager" />
<entry key="awsAutomation" value-ref="awsAutomationAction" />
</map>
</property>
</bean>
......@@ -129,6 +130,25 @@
</property>
</bean>
<bean id="awsCredential" class="com.amazonaws.auth.BasicAWSCredentials">
<constructor-arg value="${aws.keyid}"/>
<constructor-arg value="${aws.secret}"/>
</bean>
<bean id="awsLoadBalanceClient" class="com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient">
<constructor-arg ref="awsCredential"/>
</bean>
<bean id="awsIdentityClient" class="com.amazonaws.services.identitymanagement.AmazonIdentityManagementClient">
<constructor-arg ref="awsCredential"/>
</bean>
<bean id="awsCloudFrontClient" class="com.amazonaws.services.cloudfront.AmazonCloudFrontClient">
<constructor-arg ref="awsCredential"/>
</bean>
<bean id="awsAutomationAction" class="nz.net.orcon.kanban.automation.actions.AwsAutomationAction"/>
<!-- Cluster Management -->
<bean id="clusterManager" class="nz.net.orcon.kanban.automation.ClusterManager"/>
......
......@@ -9,8 +9,9 @@
<body>
<div ng-app="myApp" ng-controller="boardCtrl" ng-init="mySwitch=true;board='Board';phase='Phase'">
<nav class="navbar-form navbar-left navbar-inverse">
<div ng-app="gravityApp" ng-controller="boardCtrl" ng-init="mySwitch=true;board='Board';phase='Phase';view='View';filter='Filter'">
<nav class="navbar-form navbar-left navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
......@@ -29,6 +30,9 @@
<li ng-repeat="(key, value) in boards">
<a href="" ng-click="setBoard(key,value)">{{value}}</a>
</li>
<li>
<a href="" ng-click="">New Board</a>
</li>
</ul>
</li>
<li class="dropdown">
......@@ -39,6 +43,34 @@
</li>
</ul>
</li>
<li class="dropdown">
<a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{view}}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="" ng-click="setView('','')">None</a>
</li>
<li ng-repeat="view in views">
<a href="" ng-click="setView(key,view)">{{view.name}}</a>
</li>
<li>
<a href="" ng-click="">New View</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{filter}}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="" ng-click="setFilter('','')">None</a>
</li>
<li ng-repeat="filter in filters">
<a href="" ng-click="setFilter(key,filter)">{{filter.name}}</a>
</li>
<li>
<a href="" ng-click="">New Filter</a>
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="../navbar-fixed-top/">Logout</a></li>
......@@ -51,12 +83,9 @@
<!-- Main component for a primary marketing message or call to action -->
<div class="jumbotron">
<h1>{{board}}</h1>
<ul>
<li ng-repeat="phase in phases">{{phase.name}}</li>
</ul>
<h2>{{board}}</h2>
<p>Gravity combines the simplicity and elegance of kanban boards
<p ng-show="board=='Board'">Gravity combines the simplicity and elegance of kanban boards
for controlling business workflows with a powerful automation engine
that allows businesses to eliminate repetitive electronic tasks.
It puts managers in the driving seat of their business processes.
......@@ -65,7 +94,6 @@
from Gravity Workflow Automation.</p>
</div>
</div> <!-- /container -->
</div>
......@@ -73,39 +101,7 @@
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
var app = angular.module('myApp', []);
app.controller('boardCtrl', function($scope, $http) {
$http.get("/gravity/spring/board")
.success(function (response) {$scope.boards = response;});
$scope.setBoard = function(key,name) {
$scope.board = name;
$scope.boardid = key;
fullUrl = "/gravity/spring/board/" + key;
$http.get(fullUrl).success(function (response) {
$scope.boardData = response;
var phases=[];
for( key in response.phases ) {
phases.push(response.phases[key]);
}
$scope.phases = phases;
$scope.phase = phases[0].name;
$scope.phasid = phases[0].id;
});
}
$scope.setPhase = function(key,phase) {
$scope.phase = phase.name;
$scope.phaseid = key;
}
});
</script>
<script src="scripts/core/gravityApp.js"></script>
</body>
</html>
\ No newline at end of file
var app = angular.module('gravityApp', []);
app.controller('boardCtrl', function($scope, $http) {
$http.get("/gravity/spring/board")
.success(function (response) { $scope.boards = response; });
$scope.setBoard = function(key,name) {
$scope.board = name;
$scope.boardid = key;
fullUrl = "/gravity/spring/board/" + key;
$http.get(fullUrl).success(function (response) {
$scope.boardData = response;
var phases=[];
for( key in response.phases ) {
phases.push(response.phases[key]);
}
$scope.phases = phases;
$scope.phase = phases[0].name;
$scope.phasid = phases[0].id;
$scope.views = response.views;
$scope.filters = response.filters;
});
}
$scope.setPhase = function(key,phase) {
$scope.phase = phase.name;
$scope.phaseid = key;
}
$scope.setFilter = function(key,filter) {
if(key==''){
$scope.filter = 'Filter';
$scope.filterid = key;
} else {
$scope.filter = filter.name;
$scope.filterid = key;
}
}
$scope.setView = function(key,view) {
if(key==''){
$scope.view = 'View';
$scope.viewid = key;
} else {
$scope.view = view.name;
$scope.viewid = key;
}
}
});
......@@ -26,7 +26,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
......
......@@ -33,7 +33,6 @@ import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import junit.framework.Assert;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment