Merge "Fix targetResourceId issue"
diff --git a/src/main/java/org/onap/clamp/loop/Loop.java b/src/main/java/org/onap/clamp/loop/Loop.java
index f47a6a0..8977086 100644
--- a/src/main/java/org/onap/clamp/loop/Loop.java
+++ b/src/main/java/org/onap/clamp/loop/Loop.java
@@ -115,7 +115,7 @@
 
     @Expose
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "loop")
-    @OrderBy("log_instant DESC")
+    @OrderBy("id DESC")
     private Set<LoopLog> loopLogs = new HashSet<>();
 
     public Loop() {
diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
index 5e12516..fc6cc4d 100644
--- a/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
+++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
@@ -101,10 +101,9 @@
 	<div class="modal-body">
 		<div attribute-test="policywindowpropertiesb" class="modal-body row">
 
-			<div class="panel panel-default col-sm-9 policyPanel">
+			<div class="panel panel-default col-sm-10 policyPanel">
 				<form id="operationalPolicyHeaderForm" class="form-horizontal">
-					<div>
-						<div class="form-group clearfix row">
+						<div class="form-group clearfix">
 							<label class="col-sm-2">Parent policy</label>
 							<div class="col-sm-3" style="padding: 0px;">
 								<select type="text" id="trigger_policy" name="trigger_policy"
@@ -124,7 +123,7 @@
 							</div>
 
 							<label for="abatement" class="col-sm-2">Abatement</label>
-							<div class="col-sm-3" style="padding: 0px;">
+							<div class="col-sm-2" style="padding-left: 0px;">
 								<select class="form-control" id="abatement" name="abatement">
    									<option value="false" selected>False</option>
    									<option value="true">True</option>
@@ -138,7 +137,6 @@
 								    readonly="readonly" id="clname" ng-model="clname"/>
 						    </div>
 						</div>
-					</div>
 				</form>
 				<div class="panel-heading" style="background-color: white;">
 					<ul id="nav_Tabs" class="nav nav-tabs">
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index cf75872..8dfc068 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -8,7 +8,7 @@
 				<removeHeaders pattern="*" />
 				<doTry>
 					<to
-						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get All ClosedLoop')" />
+						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Loop')" />
 					<to
 						uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
 					<to
@@ -36,7 +36,7 @@
 					excludePattern="loopName" />
 				<doTry>
 					<to
-						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get Closed Loop')" />
+						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Loop')" />
 					<to
 						uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
 					<to
@@ -201,11 +201,17 @@
 					pattern="*"
 					excludePattern="loopName" />
 				<doTry>
+					<log
+						loggingLevel="INFO"
+						message="DCAE DEPLOY request for loop: ${header.loopName}" />
 					<to
-						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DEPLOY the closed loop')" />
+						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DCAE DEPLOY request')" />
 					<to
 						uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
 					<to uri="direct:load-loop" />
+					<to
+						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE DEPLOY request','INFO',${exchangeProperty[loopObject]})" />
+					
 					<to uri="direct:get-status-from-policy" />
 					<to uri="direct:get-status-from-dcae" />
 					<log
@@ -221,9 +227,9 @@
 						<otherwise>
 							<log
 								loggingLevel="INFO"
-								message="Closed Loop is in state ${exchangeProperty[policyStatus]}, it can only be deployed when in state SUBMIT" />
+								message="Loop is in state ${exchangeProperty[policyStatus]}, it can only be deployed when in state SUBMIT" />
 							<to
-								uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Closed Loop is in state ${exchangeProperty[policyStatus]}, it can only be deployed when in state SUBMIT','ERROR',${exchangeProperty[loopObject]})" />
+								uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Loop is in state ${exchangeProperty[policyStatus]}, it can only be deployed when in state SUBMIT','ERROR',${exchangeProperty[loopObject]})" />
 						</otherwise>
 					</choice>
 					<log
@@ -258,11 +264,16 @@
 					pattern="*"
 					excludePattern="loopName" />
 				<doTry>
+					<log
+						loggingLevel="INFO"
+						message="DCAE UNDEPLOY request for loop: ${header.loopName}" />
 					<to
-						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Undeploy the closed loop')" />
+						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DCAE UNDEPLOY request')" />
 					<to
 						uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
 					<to uri="direct:load-loop" />
+					<to
+						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE UNDEPLOY request','INFO',${exchangeProperty[loopObject]})" />
 					<to uri="direct:get-status-from-dcae" />
 					<choice>
 						<when>
@@ -273,9 +284,9 @@
 						<otherwise>
 							<log
 								loggingLevel="INFO"
-								message="Closed Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be undeployed when in state DEPLOYED/IN_ERROR/PROCESSING" />
+								message="Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be undeployed when in state DEPLOYED/IN_ERROR/PROCESSING" />
 							<to
-								uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Closed Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be deployed when in state DEPLOYED','ERROR',${exchangeProperty[loopObject]})" />
+								uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be deployed when in state DEPLOYED','ERROR',${exchangeProperty[loopObject]})" />
 						</otherwise>
 					</choice>
 					<log
@@ -312,12 +323,15 @@
 				<doTry>
 					<log
 						loggingLevel="INFO"
-						message="Receive STOP request for loop: ${header.loopName}" />
+						message="STOP request for loop: ${header.loopName}" />
 					<to
-						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'Stop the closed loop')" />
+						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'STOP request')" />
 					<to
 						uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
 					<to uri="direct:load-loop" />
+					<to
+						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request','INFO',${exchangeProperty[loopObject]})" />
+					
 					<to uri="direct:remove-all-policy-from-active-pdp-group" />
 					<log
 						loggingLevel="INFO"
@@ -353,13 +367,15 @@
 				<doTry>
 					<log
 						loggingLevel="INFO"
-						message="Receive RESTART request for loop: ${header.loopName}" />
+						message="RESTART request for loop: ${header.loopName}" />
 					<to
-						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'Restart the closed loop')" />
+						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'RESTART request')" />
 					<to
 						uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
 					<to uri="direct:load-loop" />
 
+					<to
+						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request','INFO',${exchangeProperty[loopObject]})" />
 
 					<to uri="direct:add-all-to-active-pdp-group" />
 					<log
@@ -396,14 +412,14 @@
 				<doTry>
 					<log
 						loggingLevel="INFO"
-						message="Receive SUBMIT request for loop: ${header.loopName}" />
+						message="POLICY SUBMIT request for loop: ${header.loopName}" />
 					<to
-						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Submit the closed loop')" />
+						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'POLICY SUBMIT request')" />
 					<to
 						uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
 					<to uri="direct:load-loop" />
 					<to
-						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive SUBMIT request','INFO',${exchangeProperty[loopObject]})" />
+						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('POLICY SUBMIT request','INFO',${exchangeProperty[loopObject]})" />
 					<setProperty propertyName="raiseHttpExceptionFlag">
 						<simple resultType="java.lang.Boolean">false</simple>
 					</setProperty>
@@ -499,14 +515,14 @@
 				<doTry>
 					<log
 						loggingLevel="INFO"
-						message="Receive DELETE request for loop: ${header.loopName}" />
+						message="DELETE request for loop: ${header.loopName}" />
 					<to
-						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'Delete the closed loop')" />
+						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'DELETE request')" />
 					<to
 						uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
 					<to uri="direct:load-loop" />
 					<to
-						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive DELETE request','INFO',${exchangeProperty[loopObject]})" />
+						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request','INFO',${exchangeProperty[loopObject]})" />
 					<to uri="direct:remove-all-policy-from-active-pdp-group" />
 					<split>
 						<simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
@@ -584,14 +600,14 @@
 				<doTry>
 					<log
 						loggingLevel="INFO"
-						message="Get current status for loop: ${header.loopName}" />
+						message="GET STATUS request for loop: ${header.loopName}" />
 					<to
-						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get the closed loop status')" />
+						uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET STATUS request')" />
 					<to
 						uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
 					<to uri="direct:load-loop" />
 					<to
-						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive GET STATUS request','INFO',${exchangeProperty[loopObject]})" />
+						uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('GET STATUS request','INFO',${exchangeProperty[loopObject]})" />
 					<setProperty propertyName="raiseHttpExceptionFlag">
 						<simple resultType="java.lang.Boolean">false</simple>
 					</setProperty>
diff --git a/src/main/resources/clds/camel/routes/flexible-flow.xml b/src/main/resources/clds/camel/routes/flexible-flow.xml
index 790a167..89ff24b 100644
--- a/src/main/resources/clds/camel/routes/flexible-flow.xml
+++ b/src/main/resources/clds/camel/routes/flexible-flow.xml
@@ -494,9 +494,9 @@
 		<doTry>
 			<log
 				loggingLevel="INFO"
-				message="Deploy the closed loop: ${exchangeProperty[loopObject].getName()}" />
+				message="Deploying the loop: ${exchangeProperty[loopObject].getName()}" />
 			<to
-				uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploy closed loop')" />
+				uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop')" />
 			<setBody>
 				<method ref="org.onap.clamp.loop.LoopOperation"
 					method="getDeployPayload(${exchangeProperty[loopObject]})" />
@@ -525,9 +525,9 @@
 			</setHeader>
 			<log
 				loggingLevel="INFO"
-				message="Endpoint to deploy closed loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[deploymentId]}"></log>
+				message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[deploymentId]}"></log>
 			<toD
-				uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[deploymentId]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[RaiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
+				uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[deploymentId]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
 			<to
 				uri="bean:org.onap.clamp.loop.LoopOperation?method=updateLoopInfo(*,${exchangeProperty[loopObject]},${exchangeProperty[deploymentId]})" />
 			<doFinally>
@@ -535,7 +535,7 @@
 				<to
 					uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
 				<setProperty propertyName="logMessage">
-					<simple>Deploy closed loop status (id:${exchangeProperty[deploymentId]})</simple>
+					<simple>DEPLOY loop status (id:${exchangeProperty[deploymentId]})</simple>
 				</setProperty>
 				<to uri="direct:dump-loop-log-http-response" />
 			</doFinally>
@@ -547,9 +547,9 @@
 		<doTry>
 			<log
 				loggingLevel="INFO"
-				message="Undeploy the closed loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
+				message="Undeploying the loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
 			<to
-				uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploy closed loop')" />
+				uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploying the loop')" />
 
 			<setBody>
 				<simple>{\"serviceTypeId\": \"${exchangeProperty[loopObject].getDcaeBlueprintId()}\"}
@@ -575,9 +575,9 @@
 			</setHeader>
 			<log
 				loggingLevel="INFO"
-				message="Endpoint to undeploy closed loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
+				message="Endpoint to undeploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
 			<toD
-				uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[RaiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
+				uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
 			<to
 				uri="bean:org.onap.clamp.loop.LoopOperation?method=updateLoopInfo(*,${exchangeProperty[loopObject]},null)" />
 			<doFinally>
@@ -585,7 +585,7 @@
 				<to
 					uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
 				<setProperty propertyName="logMessage">
-					<simple>Undeploy closed loop status</simple>
+					<simple>UNDEPLOY loop status</simple>
 				</setProperty>
 				<to uri="direct:dump-loop-log-http-response" />
 			</doFinally>
@@ -628,7 +628,7 @@
 				<to
 					uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
 				<setProperty propertyName="logMessage">
-					<simple>Query closed loop from Policy status</simple>
+					<simple>Policy deployment status</simple>
 				</setProperty>
 				<setProperty propertyName="policyStatus">
 					<method ref="org.onap.clamp.loop.LoopOperation"
@@ -685,7 +685,7 @@
 						<to
 							uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
 						<setProperty propertyName="logMessage">
-							<simple>Query closed loop from DCAE status</simple>
+							<simple>DCAE deployment status</simple>
 						</setProperty>
 						<setProperty propertyName="dcaeStatus">
 							<method ref="org.onap.clamp.loop.LoopOperation"