From 6435e1cc0b94e1441f12b9af4996720aa0a19ee3 Mon Sep 17 00:00:00 2001 From: Malith-19 Date: Fri, 3 Oct 2025 12:07:21 +0530 Subject: [PATCH 1/3] Add operation scope modal. --- core/org.wso2.carbon.utils/pom.xml | 3 +- .../OperationScopeValidationContext.java | 8 ++-- .../carbon/context/model/OperationScope.java | 48 +++++++++++++++++++ 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScope.java diff --git a/core/org.wso2.carbon.utils/pom.xml b/core/org.wso2.carbon.utils/pom.xml index b2d1ca6d5c8..36f2e99fa88 100644 --- a/core/org.wso2.carbon.utils/pom.xml +++ b/core/org.wso2.carbon.utils/pom.xml @@ -278,7 +278,8 @@ org.wso2.carbon.keystore.persistence.model, org.wso2.carbon.utils.*, org.wso2.carbon.context, - !org.wso2.carbon.context.internal + !org.wso2.carbon.context.internal, + org.wso2.carbon.context.model org.wso2.carbon.context.internal.CarbonContextActivator diff --git a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/OperationScopeValidationContext.java b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/OperationScopeValidationContext.java index 75505b1eef2..440d6baf642 100644 --- a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/OperationScopeValidationContext.java +++ b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/OperationScopeValidationContext.java @@ -18,6 +18,8 @@ package org.wso2.carbon.context; +import org.wso2.carbon.context.model.OperationScope; + import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -33,7 +35,7 @@ public class OperationScopeValidationContext { private String apiIdentifier; private boolean validationRequired; private List validatedScopes; - private Map operationScopeMap = new ConcurrentHashMap<>(); + private Map operationScopeMap = new ConcurrentHashMap<>(); public String getApiIdentifier() { @@ -65,12 +67,12 @@ public void setValidatedScopes(List validatedScopes) { this.validatedScopes = validatedScopes; } - public Map getOperationScopeMap() { + public Map getOperationScopeMap() { return operationScopeMap; } - public void setOperationScopeMap(Map operationScopeMap) { + public void setOperationScopeMap(Map operationScopeMap) { this.operationScopeMap = operationScopeMap; } diff --git a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScope.java b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScope.java new file mode 100644 index 00000000000..d9c0c9d787b --- /dev/null +++ b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScope.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2025, 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.context.model; + +/** + * Model class to hold operation scope details. + */ +public class OperationScope { + + private boolean isMandatory; + private String scope; + + public boolean getIsMandatory() { + + return isMandatory; + } + + public void setIsMandatory(boolean isMandatory) { + + this.isMandatory = isMandatory; + } + + public String getScope() { + + return scope; + } + + public void setScope(String scope) { + + this.scope = scope; + } + +} From 0659fe1e880543a799c0df44f8105d420f54018c Mon Sep 17 00:00:00 2001 From: Malith-19 Date: Tue, 7 Oct 2025 17:01:41 +0530 Subject: [PATCH 2/3] Update the model as operation scope set. --- .../OperationScopeValidationContext.java | 14 +++--- .../context/model/OperationScopeSet.java | 50 +++++++++++++++++++ 2 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScopeSet.java diff --git a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/OperationScopeValidationContext.java b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/OperationScopeValidationContext.java index 440d6baf642..6b2869a7d79 100644 --- a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/OperationScopeValidationContext.java +++ b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/OperationScopeValidationContext.java @@ -18,11 +18,9 @@ package org.wso2.carbon.context; -import org.wso2.carbon.context.model.OperationScope; +import org.wso2.carbon.context.model.OperationScopeSet; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; /** * This class holds the context for validating operation scopes. @@ -35,7 +33,7 @@ public class OperationScopeValidationContext { private String apiIdentifier; private boolean validationRequired; private List validatedScopes; - private Map operationScopeMap = new ConcurrentHashMap<>(); + private OperationScopeSet operationScopeSet; public String getApiIdentifier() { @@ -67,13 +65,13 @@ public void setValidatedScopes(List validatedScopes) { this.validatedScopes = validatedScopes; } - public Map getOperationScopeMap() { + public OperationScopeSet getOperationScopeSet() { - return operationScopeMap; + return operationScopeSet; } - public void setOperationScopeMap(Map operationScopeMap) { + public void setOperationScopeSet(OperationScopeSet operationScopeSet) { - this.operationScopeMap = operationScopeMap; + this.operationScopeSet = operationScopeSet; } } diff --git a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScopeSet.java b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScopeSet.java new file mode 100644 index 00000000000..3985a7e9f10 --- /dev/null +++ b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScopeSet.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025, 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.context.model; + +import java.util.Map; + +/** + * Model class to hold operation scope details. + */ +public class OperationScopeSet { + + private boolean isMandatory; + private Map operationScopeMap; + + public boolean getIsMandatory() { + + return isMandatory; + } + + public void setIsMandatory(boolean isMandatory) { + + this.isMandatory = isMandatory; + } + + public Map getOperationScopeMap() { + + return operationScopeMap; + } + + public void setOperationScopeMap(Map operationScopeMap) { + + this.operationScopeMap = operationScopeMap; + } + +} From 5aca11d5adddfb70031ff90f63001b2bd39fc942 Mon Sep 17 00:00:00 2001 From: Malith-19 Date: Tue, 7 Oct 2025 18:13:22 +0530 Subject: [PATCH 3/3] Remove the operationScope model. --- .../carbon/context/model/OperationScope.java | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScope.java diff --git a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScope.java b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScope.java deleted file mode 100644 index d9c0c9d787b..00000000000 --- a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/model/OperationScope.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2025, 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 - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.wso2.carbon.context.model; - -/** - * Model class to hold operation scope details. - */ -public class OperationScope { - - private boolean isMandatory; - private String scope; - - public boolean getIsMandatory() { - - return isMandatory; - } - - public void setIsMandatory(boolean isMandatory) { - - this.isMandatory = isMandatory; - } - - public String getScope() { - - return scope; - } - - public void setScope(String scope) { - - this.scope = scope; - } - -}