Skip to content

Commit

Permalink
Merge pull request #492 from asha15/customAttribute
Browse files Browse the repository at this point in the history
Add custom attributes to extensions management API
  • Loading branch information
sumedhe authored Oct 23, 2023
2 parents 0c06a04 + b76adc4 commit b077859
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public class ExtensionMgtConstants {

public static final String EXTENSION_MANAGEMENT_PREFIX = "EXT-";

public static final String KEY = "key";

public static final String VALUE = "value";

/**
* Enum for error messages.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.validation.constraints.*;


Expand All @@ -41,6 +42,8 @@ public class ExtensionListItem {
private Integer displayOrder;
private List<String> tags = null;

private List<Map<String, Object>> customAttributes = null;

private String category;
private String type;
private String self;
Expand Down Expand Up @@ -163,6 +166,32 @@ public ExtensionListItem addTagsItem(String tagsItem) {

/**
**/
public ExtensionListItem customAttributes(List<Map<String, Object>> customAttributes) {

this.customAttributes = customAttributes;
return this;
}

@ApiModelProperty(value = "")
@JsonProperty("customAttributes")
@Valid
public List<Map<String, Object>> getCustomAttributes() {
return customAttributes;
}
public void setCustomAttributes(List<Map<String, Object>> customAttributes) {
this.customAttributes = customAttributes;
}

public ExtensionListItem addCustomAttributesItem(Map<String, Object> customAttributesItem) {
if (this.customAttributes == null) {
this.customAttributes = new ArrayList<>();
}
this.customAttributes.add(customAttributesItem);
return this;
}

/**
**/
public ExtensionListItem category(String category) {

this.category = category;
Expand Down Expand Up @@ -233,14 +262,15 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.image, extensionListItem.image) &&
Objects.equals(this.displayOrder, extensionListItem.displayOrder) &&
Objects.equals(this.tags, extensionListItem.tags) &&
Objects.equals(this.customAttributes, extensionListItem.customAttributes) &&
Objects.equals(this.category, extensionListItem.category) &&
Objects.equals(this.type, extensionListItem.type) &&
Objects.equals(this.self, extensionListItem.self);
}

@Override
public int hashCode() {
return Objects.hash(id, name, description, image, displayOrder, tags, category, type, self);
return Objects.hash(id, name, description, image, displayOrder, tags, customAttributes, category, type, self);
}

@Override
Expand All @@ -255,6 +285,7 @@ public String toString() {
sb.append(" image: ").append(toIndentedString(image)).append("\n");
sb.append(" displayOrder: ").append(toIndentedString(displayOrder)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" customAttributes: ").append(toIndentedString(customAttributes)).append("\n");
sb.append(" category: ").append(toIndentedString(category)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" self: ").append(toIndentedString(self)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package org.wso2.carbon.identity.api.server.extension.management.v1.function;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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;
Expand All @@ -29,6 +31,8 @@
*/
public class ExtensionListItemBuilder implements Function<ExtensionInfo, ExtensionListItem> {

private static final Log log = LogFactory.getLog(ExtensionListItemBuilder.class);

@Override
public ExtensionListItem apply(ExtensionInfo extensionInfo) {

Expand All @@ -43,6 +47,9 @@ public ExtensionListItem apply(ExtensionInfo extensionInfo) {
extensionListItem.setType(extensionInfo.getType());
extensionListItem.setSelf(ExtensionMgtUtils.getExtensionInfoLocation(extensionInfo.getType(),
extensionInfo.getId()));
if (extensionInfo.getCustomAttributes() != null) {
extensionListItem.setCustomAttributes(extensionInfo.getCustomAttributes());
}
return extensionListItem;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@ components:
items:
type: string
example: 'OIDC'
customAttributes:
type: array
items:
type: object
additionalProperties: { }
category:
type: string
example: 'DEFAULT'
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
<maven.buildnumber.plugin.version>1.4</maven.buildnumber.plugin.version>
<org.apache.felix.annotations.version>1.2.4</org.apache.felix.annotations.version>
<identity.governance.version>1.8.62</identity.governance.version>
<carbon.identity.framework.version>5.25.416</carbon.identity.framework.version>
<carbon.identity.framework.version>5.25.424</carbon.identity.framework.version>
<maven.findbugsplugin.version>3.0.5</maven.findbugsplugin.version>
<identity.workflow.impl.bps.version>5.2.0</identity.workflow.impl.bps.version>
<maven.checkstyleplugin.excludes>**/gen/**/*</maven.checkstyleplugin.excludes>
Expand Down

0 comments on commit b077859

Please sign in to comment.