Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for template versioning in the application management API #634

Merged
merged 7 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ private ApplicationManagementConstants() {
public static final String ADVANCED_CONFIGURATIONS = "advancedConfigurations";
public static final String APPLICATION_ENABLED = "applicationEnabled";
public static final String TEMPLATE_ID = "templateId";
public static final String TEMPLATE_VERSION = "templateVersion";
public static final String NAME = "name";
public static final String CLIENT_ID = "clientId";
public static final String ISSUER = "issuer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
DilshanSenarath marked this conversation as resolved.
Show resolved Hide resolved
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -79,6 +79,7 @@ public static AccessEnum fromValue(String value) {
private String self;
private AdvancedApplicationConfiguration advancedConfigurations;
private String templateId;
private String templateVersion;
private AssociatedRolesConfig associatedRoles;
private Boolean applicationEnabled;

Expand Down Expand Up @@ -298,6 +299,25 @@ public void setTemplateId(String templateId) {
this.templateId = templateId;
}

/**
* Version of the template used to create the application.
**/
public ApplicationListItem templateVersion(String templateVersion) {

this.templateVersion = templateVersion;
return this;
}

@ApiModelProperty(example = "v1.0.0", value = "Version of the template used to create the application.")
@JsonProperty("templateVersion")
@Valid
public String getTemplateVersion() {
return templateVersion;
}
public void setTemplateVersion(String templateVersion) {
this.templateVersion = templateVersion;
}

/**
**/
public ApplicationListItem associatedRoles(AssociatedRolesConfig associatedRoles) {
Expand Down Expand Up @@ -358,13 +378,14 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.self, applicationListItem.self) &&
Objects.equals(this.advancedConfigurations, applicationListItem.advancedConfigurations) &&
Objects.equals(this.templateId, applicationListItem.templateId) &&
Objects.equals(this.templateVersion, applicationListItem.templateVersion) &&
Objects.equals(this.associatedRoles, applicationListItem.associatedRoles) &&
Objects.equals(this.applicationEnabled, applicationListItem.applicationEnabled);
}

@Override
public int hashCode() {
return Objects.hash(id, name, description, image, accessUrl, clientId, issuer, realm, access, self, advancedConfigurations, templateId, associatedRoles, applicationEnabled);
return Objects.hash(id, name, description, image, accessUrl, clientId, issuer, realm, access, self, advancedConfigurations, templateId, templateVersion, associatedRoles, applicationEnabled);
}

@Override
Expand All @@ -385,6 +406,7 @@ public String toString() {
sb.append(" self: ").append(toIndentedString(self)).append("\n");
sb.append(" advancedConfigurations: ").append(toIndentedString(advancedConfigurations)).append("\n");
sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n");
sb.append(" templateVersion: ").append(toIndentedString(templateVersion)).append("\n");
sb.append(" associatedRoles: ").append(toIndentedString(associatedRoles)).append("\n");
sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n");
sb.append("}");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -45,6 +45,7 @@ public class ApplicationModel {
private String accessUrl;
private String logoutReturnUrl;
private String templateId;
private String templateVersion;
private Boolean isManagementApp = false;
private Boolean isB2BSelfServiceApp = false;
private Boolean applicationEnabled = true;
Expand Down Expand Up @@ -183,6 +184,25 @@ public void setTemplateId(String templateId) {
this.templateId = templateId;
}

/**
* Version of the template used to create the application.
**/
public ApplicationModel templateVersion(String templateVersion) {

this.templateVersion = templateVersion;
return this;
}

@ApiModelProperty(example = "v1.0.0", value = "Version of the template used to create the application.")
@JsonProperty("templateVersion")
@Valid
public String getTemplateVersion() {
return templateVersion;
}
public void setTemplateVersion(String templateVersion) {
this.templateVersion = templateVersion;
}

/**
* Decides whether the application used to access System APIs
**/
Expand Down Expand Up @@ -367,6 +387,7 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.accessUrl, applicationModel.accessUrl) &&
Objects.equals(this.logoutReturnUrl, applicationModel.logoutReturnUrl) &&
Objects.equals(this.templateId, applicationModel.templateId) &&
Objects.equals(this.templateVersion, applicationModel.templateVersion) &&
Objects.equals(this.isManagementApp, applicationModel.isManagementApp) &&
Objects.equals(this.isB2BSelfServiceApp, applicationModel.isB2BSelfServiceApp) &&
Objects.equals(this.applicationEnabled, applicationModel.applicationEnabled) &&
Expand All @@ -380,7 +401,7 @@ public boolean equals(java.lang.Object o) {

@Override
public int hashCode() {
return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, isManagementApp, isB2BSelfServiceApp, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocolConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations);
return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, templateVersion, isManagementApp, isB2BSelfServiceApp, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocolConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations);
}

@Override
Expand All @@ -396,6 +417,7 @@ public String toString() {
sb.append(" accessUrl: ").append(toIndentedString(accessUrl)).append("\n");
sb.append(" logoutReturnUrl: ").append(toIndentedString(logoutReturnUrl)).append("\n");
sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n");
sb.append(" templateVersion: ").append(toIndentedString(templateVersion)).append("\n");
sb.append(" isManagementApp: ").append(toIndentedString(isManagementApp)).append("\n");
sb.append(" isB2BSelfServiceApp: ").append(toIndentedString(isB2BSelfServiceApp)).append("\n");
sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -43,6 +43,7 @@ public class ApplicationPatchModel {
private String accessUrl;
private String logoutReturnUrl;
private String templateId;
private String templateVersion;
private Boolean applicationEnabled;
private AssociatedRolesConfig associatedRoles;
private ClaimConfiguration claimConfiguration;
Expand Down Expand Up @@ -158,6 +159,25 @@ public void setTemplateId(String templateId) {
this.templateId = templateId;
}

/**
* Version of the template used to create the application.
**/
public ApplicationPatchModel templateVersion(String templateVersion) {

this.templateVersion = templateVersion;
return this;
}

@ApiModelProperty(example = "v1.0.0", value = "Version of the template used to create the application.")
@JsonProperty("templateVersion")
@Valid
public String getTemplateVersion() {
return templateVersion;
}
public void setTemplateVersion(String templateVersion) {
this.templateVersion = templateVersion;
}

/**
* Decides whether the application is enabled.
**/
Expand Down Expand Up @@ -285,6 +305,7 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.accessUrl, applicationPatchModel.accessUrl) &&
Objects.equals(this.logoutReturnUrl, applicationPatchModel.logoutReturnUrl) &&
Objects.equals(this.templateId, applicationPatchModel.templateId) &&
Objects.equals(this.templateVersion, applicationPatchModel.templateVersion) &&
Objects.equals(this.applicationEnabled, applicationPatchModel.applicationEnabled) &&
Objects.equals(this.associatedRoles, applicationPatchModel.associatedRoles) &&
Objects.equals(this.claimConfiguration, applicationPatchModel.claimConfiguration) &&
Expand All @@ -295,7 +316,7 @@ public boolean equals(java.lang.Object o) {

@Override
public int hashCode() {
return Objects.hash(name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, applicationEnabled, associatedRoles, claimConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations);
return Objects.hash(name, description, imageUrl, accessUrl, logoutReturnUrl, templateId, templateVersion, applicationEnabled, associatedRoles, claimConfiguration, authenticationSequence, advancedConfigurations, provisioningConfigurations);
}

@Override
Expand All @@ -310,6 +331,7 @@ public String toString() {
sb.append(" accessUrl: ").append(toIndentedString(accessUrl)).append("\n");
sb.append(" logoutReturnUrl: ").append(toIndentedString(logoutReturnUrl)).append("\n");
sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n");
sb.append(" templateVersion: ").append(toIndentedString(templateVersion)).append("\n");
sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n");
sb.append(" associatedRoles: ").append(toIndentedString(associatedRoles)).append("\n");
sb.append(" claimConfiguration: ").append(toIndentedString(claimConfiguration)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -50,6 +50,7 @@ public class ApplicationResponseModel {
private String issuer;
private String realm;
private String templateId;
private String templateVersion;
private Boolean isManagementApp;
private Boolean isB2BSelfServiceApp;
private Boolean applicationEnabled;
Expand Down Expand Up @@ -277,6 +278,25 @@ public void setTemplateId(String templateId) {
this.templateId = templateId;
}

/**
* Version of the template used to create the application.
**/
public ApplicationResponseModel templateVersion(String templateVersion) {

this.templateVersion = templateVersion;
return this;
}

@ApiModelProperty(example = "v1.0.0", value = "Version of the template used to create the application.")
@JsonProperty("templateVersion")
@Valid
public String getTemplateVersion() {
return templateVersion;
}
public void setTemplateVersion(String templateVersion) {
this.templateVersion = templateVersion;
}

/**
* Decides whether the application used to access System APIs
**/
Expand Down Expand Up @@ -490,6 +510,7 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.issuer, applicationResponseModel.issuer) &&
Objects.equals(this.realm, applicationResponseModel.realm) &&
Objects.equals(this.templateId, applicationResponseModel.templateId) &&
Objects.equals(this.templateVersion, applicationResponseModel.templateVersion) &&
Objects.equals(this.isManagementApp, applicationResponseModel.isManagementApp) &&
Objects.equals(this.isB2BSelfServiceApp, applicationResponseModel.isB2BSelfServiceApp) &&
Objects.equals(this.applicationEnabled, applicationResponseModel.applicationEnabled) &&
Expand All @@ -504,7 +525,7 @@ public boolean equals(java.lang.Object o) {

@Override
public int hashCode() {
return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, clientId, issuer, realm, templateId, isManagementApp, isB2BSelfServiceApp, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocols, authenticationSequence, advancedConfigurations, provisioningConfigurations, access);
return Objects.hash(id, name, description, imageUrl, accessUrl, logoutReturnUrl, clientId, issuer, realm, templateId, templateVersion, isManagementApp, isB2BSelfServiceApp, applicationEnabled, associatedRoles, claimConfiguration, inboundProtocols, authenticationSequence, advancedConfigurations, provisioningConfigurations, access);
}

@Override
Expand All @@ -523,6 +544,7 @@ public String toString() {
sb.append(" issuer: ").append(toIndentedString(issuer)).append("\n");
sb.append(" realm: ").append(toIndentedString(realm)).append("\n");
sb.append(" templateId: ").append(toIndentedString(templateId)).append("\n");
sb.append(" templateVersion: ").append(toIndentedString(templateVersion)).append("\n");
sb.append(" isManagementApp: ").append(toIndentedString(isManagementApp)).append("\n");
sb.append(" isB2BSelfServiceApp: ").append(toIndentedString(isB2BSelfServiceApp)).append("\n");
sb.append(" applicationEnabled: ").append(toIndentedString(applicationEnabled)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -481,7 +481,7 @@ public Response getAllApplicationTemplates( @Valid@ApiParam(value = "Maximum
@ApiResponse(code = 500, message = "Server Error", response = Error.class),
@ApiResponse(code = 501, message = "Not Implemented", response = Error.class)
})
public Response getAllApplications( @Valid @Min(1)@ApiParam(value = "Maximum number of records to return. ", defaultValue="30") @DefaultValue("30") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Number of records to skip for pagination. ", defaultValue="0") @DefaultValue("0") @QueryParam("offset") Integer offset, @Valid@ApiParam(value = "Condition to filter the retrieval of records. Supports 'sw', 'co', 'ew', and 'eq' operations with 'and', 'or' logical operators. Please note that 'and' and 'or' operators in filters follow the general precedence of logical operators ex: A and B or C and D = (A and B) or (C and D)). Currently supports only filtering based on the 'name', the 'clientId', and the 'issuer' attributes. /applications?filter=name+eq+user_portal <br> /applications?filter=name+co+prod+or+clientId+co+123 ") @QueryParam("filter") String filter, @Valid@ApiParam(value = "Define the order in which the retrieved records should be sorted. _This parameter is not supported yet._ ", allowableValues="ASC, DESC") @QueryParam("sortOrder") String sortOrder, @Valid@ApiParam(value = "Attribute by which the retrieved records should be sorted. _This parameter is not supported yet._ ") @QueryParam("sortBy") String sortBy, @Valid@ApiParam(value = "Specifies the required parameters in the response. Currently supports for only 'advancedConfigurations', 'templateId', 'clientId', and 'issuer' attributes. /applications?attributes=advancedConfigurations,templateId,clientId ") @QueryParam("attributes") String attributes) {
public Response getAllApplications( @Valid @Min(1)@ApiParam(value = "Maximum number of records to return. ", defaultValue="30") @DefaultValue("30") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Number of records to skip for pagination. ", defaultValue="0") @DefaultValue("0") @QueryParam("offset") Integer offset, @Valid@ApiParam(value = "Condition to filter the retrieval of records. Supports 'sw', 'co', 'ew', and 'eq' operations with 'and', 'or' logical operators. Please note that 'and' and 'or' operators in filters follow the general precedence of logical operators ex: A and B or C and D = (A and B) or (C and D)). Currently supports only filtering based on the 'name', the 'clientId', and the 'issuer' attributes. /applications?filter=name+eq+user_portal <br> /applications?filter=name+co+prod+or+clientId+co+123 ") @QueryParam("filter") String filter, @Valid@ApiParam(value = "Define the order in which the retrieved records should be sorted. _This parameter is not supported yet._ ", allowableValues="ASC, DESC") @QueryParam("sortOrder") String sortOrder, @Valid@ApiParam(value = "Attribute by which the retrieved records should be sorted. _This parameter is not supported yet._ ") @QueryParam("sortBy") String sortBy, @Valid@ApiParam(value = "Specifies the required parameters in the response. Currently supports for only 'advancedConfigurations', 'templateId', 'templateVersion', 'clientId', 'issuer', 'applicationEnabled' and 'associatedRoles.allowedAudience' attributes. /applications?attributes=advancedConfigurations,templateId,templateVersion,clientId,applicationEnabled,associatedRoles.allowedAudience ") @QueryParam("attributes") String attributes) {

return delegate.getAllApplications(limit, offset, filter, sortOrder, sortBy, attributes );
}
Expand Down
Loading
Loading