Policy TestSuite Enabled
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / policy-models / Editor / PolicyTemplateController / BRMSParamPolicyController.js
index c5160e7..b376857 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-angular.module('abs').controller('brmsParamPolicyController', function ($scope, $window, PolicyAppService, modalService, $modal, Notification) {
+angular.module('abs').controller('brmsParamPolicyController', ['$scope', '$window', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function ($scope, $window, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) {
     $("#dialog").hide();
 
+    $scope.policyNavigator;
     $scope.savebutton = true;
-    $scope.finalPath = null;
+    $scope.refreshCheck = false;
+    
+    $scope.refresh = function(){
+       if($scope.refreshCheck){
+               $scope.policyNavigator.refresh();
+       }
+       $scope.modal('createNewPolicy', true);
+    };
+    
+    $scope.modal = function(id, hide) {
+        return $('#' + id).modal(hide ? 'hide' : 'show');
+    };
     
     $scope.validateSuccess = true;
     var readValue = $scope.temp.policy.readOnly;
@@ -109,7 +121,7 @@ angular.module('abs').controller('brmsParamPolicyController', function ($scope,
                        $scope.datarule = data.policyData;
                        var modalInstance = $modal.open({
                        backdrop: 'static', keyboard: false,
-                        templateUrl : 'brmsshowrule',
+                        templateUrl : 'app/policyApp/policy-models/Editor/PolicyTemplates/BRMSShowParamRuleModal.html',
                         controller: 'showrulecontroller',
                         resolve: {
                             message: function () {
@@ -129,7 +141,11 @@ angular.module('abs').controller('brmsParamPolicyController', function ($scope,
     };
     
     $scope.saveBrmsParamPolicy = function(policy){
-        console.log(policy);
+       if(policy.itemContent != undefined){
+               $scope.refreshCheck = true; 
+               $scope.policyNavigator = policy.itemContent;
+               policy.itemContent = "";
+       }
         $scope.savebutton = false;
         var uuu = "policycreation/save_policy";
         var postData={policyData: policy};
@@ -231,7 +247,7 @@ angular.module('abs').controller('brmsParamPolicyController', function ($scope,
         var lastItem = $scope.temp.policy.attributes.length-1;
         $scope.temp.policy.attributes.splice(lastItem);
     };
-});
+}]);
 
 app.controller('showrulecontroller' ,  function ($scope, $modalInstance, message){
        if(message.datas!=null){