Skip to content

Commit

Permalink
refactor the code
Browse files Browse the repository at this point in the history
  • Loading branch information
asha15 committed Oct 22, 2023
1 parent 38858a7 commit 954eabb
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -51,14 +48,7 @@ public ExtensionListItem apply(ExtensionInfo extensionInfo) {
extensionListItem.setSelf(ExtensionMgtUtils.getExtensionInfoLocation(extensionInfo.getType(),
extensionInfo.getId()));
if (extensionInfo.getCustomAttributes() != null) {
for (Map<String, Object> customAttributeMap : extensionInfo.getCustomAttributes()) {
Map<String, Object> 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;
}
Expand Down

0 comments on commit 954eabb

Please sign in to comment.