From 954eabb5e5c50e74ae7b87696c05d59543cfe9c8 Mon Sep 17 00:00:00 2001 From: asha15 <165079T@uom.lk> Date: Sun, 22 Oct 2023 23:38:54 +0530 Subject: [PATCH] refactor the code --- .../v1/function/ExtensionListItemBuilder.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.extension.management/org.wso2.carbon.identity.api.server.extension.management.v1/src/main/java/org/wso2/carbon/identity/api/server/extension/management/v1/function/ExtensionListItemBuilder.java b/components/org.wso2.carbon.identity.api.server.extension.management/org.wso2.carbon.identity.api.server.extension.management.v1/src/main/java/org/wso2/carbon/identity/api/server/extension/management/v1/function/ExtensionListItemBuilder.java index 84a8196365..31b047466e 100644 --- a/components/org.wso2.carbon.identity.api.server.extension.management/org.wso2.carbon.identity.api.server.extension.management.v1/src/main/java/org/wso2/carbon/identity/api/server/extension/management/v1/function/ExtensionListItemBuilder.java +++ b/components/org.wso2.carbon.identity.api.server.extension.management/org.wso2.carbon.identity.api.server.extension.management.v1/src/main/java/org/wso2/carbon/identity/api/server/extension/management/v1/function/ExtensionListItemBuilder.java @@ -20,13 +20,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.identity.api.server.extension.management.common.utils.ExtensionMgtConstants; import org.wso2.carbon.identity.api.server.extension.management.common.utils.ExtensionMgtUtils; import org.wso2.carbon.identity.api.server.extension.management.v1.model.ExtensionListItem; import org.wso2.carbon.identity.extension.mgt.model.ExtensionInfo; -import java.util.HashMap; -import java.util.Map; import java.util.function.Function; /** @@ -51,14 +48,7 @@ public ExtensionListItem apply(ExtensionInfo extensionInfo) { extensionListItem.setSelf(ExtensionMgtUtils.getExtensionInfoLocation(extensionInfo.getType(), extensionInfo.getId())); if (extensionInfo.getCustomAttributes() != null) { - for (Map customAttributeMap : extensionInfo.getCustomAttributes()) { - Map customAttribute = new HashMap<>(); - customAttribute.put(ExtensionMgtConstants.KEY, - customAttributeMap.get(ExtensionMgtConstants.KEY)); - customAttribute.put(ExtensionMgtConstants.VALUE, - customAttributeMap.get(ExtensionMgtConstants.VALUE).toString()); - extensionListItem.addCustomAttributesItem(customAttribute); - } + extensionListItem.setCustomAttributes(extensionInfo.getCustomAttributes()); } return extensionListItem; }