New observable notify design in pubsub

Implemented the new subscription mechanism for the pub sub notify function

Change-Id: I5e6484adf1a0413d48b54b55048cda1a59b387ee
Issue-ID: SDC-1178
Signed-off-by: Idan Amit <ia096e@intl.att.com>
diff --git a/catalog-ui/src/app/utils/change-lifecycle-state-handler.ts b/catalog-ui/src/app/utils/change-lifecycle-state-handler.ts
index d32730d..f1c6544 100644
--- a/catalog-ui/src/app/utils/change-lifecycle-state-handler.ts
+++ b/catalog-ui/src/app/utils/change-lifecycle-state-handler.ts
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,6 +24,7 @@
 import {AsdcComment} from "../models/comments";
 import {ModalsHandler} from "./modals-handler";
 import {ServiceServiceNg2} from "../ng2/services/component-services/service.service";
+import {EventBusService} from "../ng2/services/event-bus.service";
 
 /**
  * Created by obarda on 2/11/2016.
@@ -37,7 +38,8 @@
         'ComponentFactory',
         '$filter',
         'ModalsHandler',
-        'ServiceServiceNg2'
+        'ServiceServiceNg2',
+        'EventBusService'
     ];
 
     constructor(private sdcConfig:IAppConfigurtaion,
@@ -45,7 +47,8 @@
                 private ComponentFactory:ComponentFactory,
                 private $filter:ng.IFilterService,
                 private ModalsHandler:ModalsHandler,
-                private ServiceServiceNg2:ServiceServiceNg2) {
+                private ServiceServiceNg2:ServiceServiceNg2,
+                private eventBusService:EventBusService) {
 
     }
 
@@ -101,7 +104,12 @@
             let onOk = (confirmationText):void => {
                 comment.userRemarks = confirmationText;
                 scope.isLoading = true;
-                component.changeLifecycleState(data.url, comment).then(onSuccess, onError);
+
+                if (data.url === "lifecycleState/CHECKIN") {
+                    this.eventBusService.notify("CHECK_IN").subscribe(() => {
+                        component.changeLifecycleState(data.url, comment).then(onSuccess, onError);
+                    });
+                }
             };
 
             let onCancel = ():void => {
@@ -118,10 +126,14 @@
             // Show email dialog if defined in menu.json
             //-------------------------------------------------
             let onOk = (resource):void => {
-                if (resource) {
-                    onSuccess(resource);
-                } else {
-                    onError("Error changing life cycle state");
+                if (data.url === "lifecycleState/certificationRequest") {
+                    this.eventBusService.notify("SUBMIT_FOR_TESTING").subscribe(() => {
+                        if (resource) {
+                            onSuccess(resource);
+                        } else {
+                            onError("Error changing life cycle state");
+                        }
+                    });
                 }
             };