shwstppr commented on code in PR #11303:
URL: https://github.com/apache/cloudstack/pull/11303#discussion_r2235236252


##########
framework/extensions/src/main/java/org/apache/cloudstack/framework/extensions/manager/ExtensionsManagerImpl.java:
##########
@@ -1478,6 +1478,45 @@ public String 
handleExtensionServerCommands(ExtensionServerActionBaseCommand com
         return GsonHelper.getGson().toJson(answers);
     }
 
+    @Override
+    public Pair<Boolean, ExtensionResourceMap> 
extensionResourceMapDetailsNeedUpdate(long resourceId,
+                     ExtensionResourceMap.ResourceType resourceType, 
Map<String, String> externalDetails) {
+        if (MapUtils.isEmpty(externalDetails)) {
+            return new Pair<>(false, null);
+        }
+        ExtensionResourceMapVO extensionResourceMapVO =
+                extensionResourceMapDao.findByResourceIdAndType(resourceId, 
resourceType);
+        if (extensionResourceMapVO == null) {
+            return new Pair<>(true, null);
+        }
+        Map<String, String> mapDetails =
+                
extensionResourceMapDetailsDao.listDetailsKeyPairs(extensionResourceMapVO.getId());
+        if (MapUtils.isEmpty(mapDetails) || mapDetails.size() != 
externalDetails.size()) {
+            return new Pair<>(true, extensionResourceMapVO);
+        }
+        for (Map.Entry<String, String> entry : externalDetails.entrySet()) {
+            String key = entry.getKey();
+            String value = entry.getValue();
+            if (!value.equals(mapDetails.get(key))) {
+                return new Pair<>(true, extensionResourceMapVO);
+            }
+        }
+        return new Pair<>(false, extensionResourceMapVO);
+    }
+
+    @Override
+    public void updateExtensionResourceMapDetails(long extensionResourceMapId, 
Map<String, String> details) {
+        if (MapUtils.isEmpty(details)) {

Review Comment:
   @harikrishna-patnala with a Map parameter we can not consider that case. We 
may have to add another parameter cleanupexternaldetails or something similar. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to