diff --git a/common-controller/internal/utils/event_utils.go b/common-controller/internal/utils/event_utils.go index f6a157311..092765c4b 100644 --- a/common-controller/internal/utils/event_utils.go +++ b/common-controller/internal/utils/event_utils.go @@ -194,6 +194,7 @@ func sendApplicationKeyMappingEvent(applicationUUID string, applicationSpec cpv1 ApplicationIdentifier: env.AppID, KeyType: env.KeyType, EnvID: env.EnvID, + Organization: applicationSpec.Organization, }, } sendEvent(&event) diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java index a326faaf3..33c132e65 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java @@ -308,10 +308,11 @@ public void addApplicationMapping(org.wso2.apk.enforcer.discovery.subscription.A resolvedApplicationMapping.setUuid(applicationMapping.getUuid()); resolvedApplicationMapping.setApplicationUUID(applicationMapping.getApplicationRef()); resolvedApplicationMapping.setSubscriptionUUID(applicationMapping.getSubscriptionRef()); - if (applicationMappingMap.containsKey(resolvedApplicationMapping.getUuid())) { - applicationMappingMap.replace(resolvedApplicationMapping.getUuid(), resolvedApplicationMapping); + resolvedApplicationMapping.setOrganization(applicationMapping.getOrganization()); + if (applicationMappingMap.containsKey(resolvedApplicationMapping.getCacheKey())) { + applicationMappingMap.replace(resolvedApplicationMapping.getCacheKey(), resolvedApplicationMapping); } else { - applicationMappingMap.put(resolvedApplicationMapping.getUuid(), resolvedApplicationMapping); + applicationMappingMap.put(resolvedApplicationMapping.getCacheKey(), resolvedApplicationMapping); } } @@ -342,7 +343,8 @@ public void removeApplicationMapping(org.wso2.apk.enforcer.discovery.subscriptio resolvedApplicationMapping.setUuid(applicationMapping.getUuid()); resolvedApplicationMapping.setApplicationUUID(applicationMapping.getApplicationRef()); resolvedApplicationMapping.setSubscriptionUUID(applicationMapping.getSubscriptionRef()); - applicationMappingMap.remove(resolvedApplicationMapping.getUuid()); + resolvedApplicationMapping.setOrganization(applicationMapping.getOrganization()); + applicationMappingMap.remove(resolvedApplicationMapping.getCacheKey()); } @Override