Make use of lambda 97/34597/1
authorMunir Ahmad <munir.ahmad@bell.ca>
Wed, 7 Mar 2018 23:59:13 +0000 (18:59 -0500)
committerMunir Ahmad <munir.ahmad@bell.ca>
Wed, 7 Mar 2018 23:59:13 +0000 (18:59 -0500)
Change-Id: I482b874a3e7e686068450c7b5ddf45e2b8ae0d47
Issue-ID: SO-437
Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java

index 591db35..8c08d3e 100644 (file)
@@ -419,39 +419,34 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
                                 toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);\r
                         logger.debug("vfGroups:" + vfGroups.toString());\r
 \r
-                        vfGroups.sort(new Comparator<Group>() {\r
-\r
-                            @Override\r
-                            public int compare(Group group1,\r
-                                Group group2) {\r
-\r
-                                // Field name1Field = group1.class.getDeclaredField("name");\r
-                                // name1Field.setAccessible(true);\r
-                                String thisName = group1.getName(); // (String)\r
-                                // name1Field.get(group1);\r
-                                String thatName = group2.getName(); // (String)\r
-                                // name1Field.get(group2);\r
-\r
-                                Matcher m = lastDigit.matcher(thisName);\r
-                                Matcher m2 = lastDigit.matcher(thatName);\r
-\r
-                                String thisDigit = "0";\r
-                                String thatDigit = "0";\r
-                                if (m.find()) {\r
-                                    thisDigit = m.group();\r
-                                } else {\r
-                                    return -1;\r
-                                }\r
-                                if (m2.find()) {\r
-                                    thatDigit = m2.group();\r
-                                } else {\r
-                                    return 1;\r
-                                }\r
+                                               vfGroups.sort((group1, group2) -> {\r
+\r
+                                                       // Field name1Field = group1.class.getDeclaredField("name");\r
+                                                       // name1Field.setAccessible(true);\r
+                                                       String thisName = group1.getName(); // (String)\r
+                                                       // name1Field.get(group1);\r
+                                                       String thatName = group2.getName(); // (String)\r
+                                                       // name1Field.get(group2);\r
+\r
+                                                       Matcher m = lastDigit.matcher(thisName);\r
+                                                       Matcher m2 = lastDigit.matcher(thatName);\r
+\r
+                                                       String thisDigit = "0";\r
+                                                       String thatDigit = "0";\r
+                                                       if (m.find()) {\r
+                                                               thisDigit = m.group();\r
+                                                       } else {\r
+                                                               return -1;\r
+                                                       }\r
+                                                       if (m2.find()) {\r
+                                                               thatDigit = m2.group();\r
+                                                       } else {\r
+                                                               return 1;\r
+                                                       }\r
 \r
-                                return new Integer(thisDigit).compareTo(new Integer(thatDigit));\r
+                                                       return new Integer(thisDigit).compareTo(new Integer(thatDigit));\r
 \r
-                            }\r
-                        });\r
+                                               });\r
 \r
                         logger.debug("vfGroupsAfter:" + vfGroups.toString());\r
 \r
index c0a1f53..f9871b7 100644 (file)
@@ -43,19 +43,15 @@ public class NotificationLogging implements InvocationHandler {
        private static Map<Object, List<Method>> objectMethodsToLog = new HashMap<>();
 
        protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
-       
-       private static InvocationHandler handler = new InvocationHandler() {
-               @Override
-               public Object invoke(Object arg0, Method arg1, Object[] arg2)
-                               throws Throwable {
-                       List<Method> methods = objectMethodsToLog.get(arg0);
-                       if ((methods == null) || (methods.isEmpty())) {
-                               // Do nothing for now...
-                               return null;
-                       }
-                       methods.add(arg1);
-                       return arg1.invoke(arg0, arg2);
+
+       private static InvocationHandler handler = (arg0, arg1, arg2) -> {
+               List<Method> methods = objectMethodsToLog.get(arg0);
+               if ((methods == null) || (methods.isEmpty())) {
+                       // Do nothing for now...
+                       return null;
                }
+               methods.add(arg1);
+               return arg1.invoke(arg0, arg2);
        };
        
        public static InvocationHandler getHandler() {
index c346308..730c145 100644 (file)
@@ -321,14 +321,8 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
                }
 
                private void loadFromDB(DelegateExecution execution, ProcessEngineConfigurationImpl processEngineConfiguration) {
-                       Command<List<URNMapping>> command = new Command<List<URNMapping>>() {
-                               @SuppressWarnings("unchecked")
-                               @Override
-                               public List<URNMapping> execute(CommandContext commandContext) {
-                                       return (List<URNMapping>) commandContext.getDbSqlSession().selectList(
-                                               "mso.urnMapping.selectAll", null);
-                               }
-                       };
+                       Command<List<URNMapping>> command = commandContext -> (List<URNMapping>) commandContext.getDbSqlSession()
+                               .selectList("mso.urnMapping.selectAll", null);
 
                        CustomMyBatisSessionFactory sessionFactory = new CustomMyBatisSessionFactory();
                        sessionFactory.initFromProcessEngineConfiguration(processEngineConfiguration,