aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMunir Ahmad <munir.ahmad@bell.ca>2018-02-24 12:24:11 -0500
committerMunir Ahmad <munir.ahmad@bell.ca>2018-02-24 12:24:11 -0500
commit06907552e96482ae66a43f4d5cd735432b7ccd65 (patch)
treedd8ebbfaa6040480f5d1a0f612f790f86cab4244
parent6f242c09ef7b4d48c47104729a641a4bc9dd008e (diff)
Swap for loop in favor of foreach
Change-Id: I04b3691abd958a1455f55b8b295a7f08998b8692 Issue-ID: SO-437 Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java8
-rw-r--r--common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java4
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java7
12 files changed, 47 insertions, 46 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
index 6cc34f7464..8d2b33cde6 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
@@ -76,13 +76,13 @@ public class CryptoUtils {
private static String byteArrayToHexString(byte[] b){
StringBuffer sb = new StringBuffer(b.length * 2);
- for (int i = 0; i < b.length; i++){
- int v = b[i] & 0xff;
+ for (byte aB : b) {
+ int v = aB & 0xff;
if (v < 16) {
- sb.append('0');
+ sb.append('0');
}
sb.append(Integer.toHexString(v));
- }
+ }
return sb.toString().toUpperCase();
}
diff --git a/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java b/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java
index 42cd190e95..55fe69bb9a 100644
--- a/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java
+++ b/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java
@@ -73,12 +73,12 @@ public final class CryptoUtils {
public static String byteArrayToHexString (byte[] b) {
StringBuffer sb = new StringBuffer (b.length * 2);
- for (int i = 0; i < b.length; i++) {
- int v = b[i] & 0xff;
+ for (byte aB : b) {
+ int v = aB & 0xff;
if (v < 16) {
- sb.append ('0');
+ sb.append('0');
}
- sb.append (Integer.toHexString (v));
+ sb.append(Integer.toHexString(v));
}
return sb.toString ().toUpperCase ();
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
index bcea8fd8d5..4e1468c4e9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
@@ -295,8 +295,8 @@ public class NetworkInfoHandler {
private String translateNetworkRequests (List <NetworkRequest> queryResponseList) {
NetworkRequests queryResponses = new NetworkRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getNetworkRequest ().add (queryResponseList.get (i));
+ for (NetworkRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getNetworkRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
index 981fee9fb6..79247deca8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
@@ -323,8 +323,8 @@ public class NetworkRequestHandler {
private String translateNetworkRequests (List <NetworkRequest> queryResponseList) {
NetworkRequests queryResponses = new NetworkRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getNetworkRequest ().add (queryResponseList.get (i));
+ for (NetworkRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getNetworkRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
index b01c6d6e2a..43f2d2afbb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
@@ -78,13 +78,13 @@ public class NetworkTypesHandler {
ObjectFactory beansObjectFactory = new ObjectFactory ();
NetworkTypes networkTypes = beansObjectFactory.createNetworkTypes ();
- for (int i = 0; i < networkResources.size (); i++) {
- NetworkType networkType = beansObjectFactory.createNetworkType ();
- NetworkResource vr = networkResources.get (i);
- networkType.setType (vr.getModelName());
- networkType.setDescription (vr.getDescription ());
- networkType.setId (String.valueOf (vr.getModelUUID()));
- networkTypes.getNetworkType ().add (networkType);
+ for (NetworkResource networkResource : networkResources) {
+ NetworkType networkType = beansObjectFactory.createNetworkType();
+ NetworkResource vr = networkResource;
+ networkType.setType(vr.getModelName());
+ networkType.setDescription(vr.getDescription());
+ networkType.setId(String.valueOf(vr.getModelUUID()));
+ networkTypes.getNetworkType().add(networkType);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
index 57720dcfba..df51a8f96a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
@@ -74,17 +74,17 @@ public class VfModuleModelNamesHandler {
ObjectFactory beansObjectFactory = new ObjectFactory ();
VfModuleModelNames vfModuleModelNames = beansObjectFactory.createVfModuleModelNames ();
- for (int i = 0; i < vfModules.size (); i++) {
- VfModuleModelName vfModuleModelName = beansObjectFactory.createVfModuleModelName ();
- VfModule vm = vfModules.get (i);
- vfModuleModelName.setModelName (vm.getModelName ());
- vfModuleModelName.setModelVersion (vm.getVersion ());
- vfModuleModelName.setModelInvariantUuid (vm.getModelInvariantUuid ());
+ for (VfModule vfModule : vfModules) {
+ VfModuleModelName vfModuleModelName = beansObjectFactory.createVfModuleModelName();
+ VfModule vm = vfModule;
+ vfModuleModelName.setModelName(vm.getModelName());
+ vfModuleModelName.setModelVersion(vm.getVersion());
+ vfModuleModelName.setModelInvariantUuid(vm.getModelInvariantUuid());
vfModuleModelName.setIsBase(vm.isBase());
- vfModuleModelName.setDescription (vm.getDescription ());
- vfModuleModelName.setId (String.valueOf (vm.getModelUUID()));
- vfModuleModelName.setAsdcServiceModelVersion(vm.getVersion ());
- vfModuleModelNames.getVfModuleModelName ().add (vfModuleModelName);
+ vfModuleModelName.setDescription(vm.getDescription());
+ vfModuleModelName.setId(String.valueOf(vm.getModelUUID()));
+ vfModuleModelName.setAsdcServiceModelVersion(vm.getVersion());
+ vfModuleModelNames.getVfModuleModelName().add(vfModuleModelName);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
index 7071ed50c3..a5e1f6f4e2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
@@ -332,8 +332,8 @@ public class VnfInfoHandler {
private String translateVnfRequests (List <VnfRequest> queryResponseList) {
VnfRequests queryResponses = new VnfRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getVnfRequest ().add (queryResponseList.get (i));
+ for (VnfRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getVnfRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
index a55c13baed..7a61c641ae 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
@@ -363,8 +363,8 @@ public class VnfRequestHandler {
private String translateVnfRequests (List <VnfRequest> queryResponseList) {
VnfRequests queryResponses = new VnfRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getVnfRequest ().add (queryResponseList.get (i));
+ for (VnfRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getVnfRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
index 44cf038ef8..3d87d131b3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
@@ -85,12 +85,12 @@ public class VnfTypesHandler {
ObjectFactory beansObjectFactory = new ObjectFactory ();
VnfTypes vnfTypes = beansObjectFactory.createVnfTypes ();
- for (int i = 0; i < vnfResources.size (); i++) {
- VnfType vnfType = beansObjectFactory.createVnfType ();
- VnfResource vr = vnfResources.get (i);
- vnfType.setDescription (vr.getDescription ());
- vnfType.setId (String.valueOf (vr.getModelUuid()));
- vnfTypes.getVnfType ().add (vnfType);
+ for (VnfResource vnfResource : vnfResources) {
+ VnfType vnfType = beansObjectFactory.createVnfType();
+ VnfResource vr = vnfResource;
+ vnfType.setDescription(vr.getDescription());
+ vnfType.setId(String.valueOf(vr.getModelUuid()));
+ vnfTypes.getVnfType().add(vnfType);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
index 6618fcfb00..3de945a275 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
@@ -314,8 +314,8 @@ public class VolumeInfoHandler {
private String translateVolumeRequests (List <VolumeRequest> queryResponseList) {
VolumeRequests queryResponses = new VolumeRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getVolumeRequest ().add (queryResponseList.get (i));
+ for (VolumeRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getVolumeRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
index 2c1f506943..3fa4a7a9e8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
@@ -346,8 +346,8 @@ public class VolumeRequestHandler {
private String translateVolumeRequests (List <VolumeRequest> queryResponseList) {
VolumeRequests queryResponses = new VolumeRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getVolumeRequest ().add (queryResponseList.get (i));
+ for (VolumeRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getVolumeRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index 98121d8490..d9448d06fa 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -38,6 +38,7 @@ import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.openecomp.mso.db.AbstractSessionFactoryManager;
+import org.openecomp.mso.requestsdb.RequestsDbConstant.Status;
import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
import org.openecomp.mso.logger.MsoLogger;
@@ -757,9 +758,9 @@ public class RequestsDatabase {
int resourceCount = lstResourceStatus.size();
int progress = 0;
boolean isFinished = true;
- for(int i = 0; i < resourceCount; i++) {
- progress = progress + Integer.valueOf(lstResourceStatus.get(i).getProgress()) / resourceCount;
- if(RequestsDbConstant.Status.PROCESSING.equals(lstResourceStatus.get(i).getStatus())) {
+ for (ResourceOperationStatus lstResourceStatu : lstResourceStatus) {
+ progress = progress + Integer.valueOf(lstResourceStatu.getProgress()) / resourceCount;
+ if (Status.PROCESSING.equals(lstResourceStatu.getStatus())) {
isFinished = false;
}
}