-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ab4c29
commit 6e511b9
Showing
14 changed files
with
455 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...er/src/main/java/org/wso2/identity/webhook/common/event/handler/model/EventAttribute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* 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 | ||
* 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.identity.webhook.common.event.handler.model; | ||
|
||
import org.json.simple.JSONObject; | ||
import org.wso2.identity.webhook.common.event.handler.constant.Constants; | ||
|
||
/** | ||
* Model class representing the event attributes. | ||
*/ | ||
public class EventAttribute { | ||
|
||
private boolean publishEnabled; | ||
private ResourceConfig properties; | ||
|
||
/** | ||
* Constructs event attribute with default configs. | ||
*/ | ||
public EventAttribute() { | ||
|
||
this.publishEnabled = false; | ||
this.properties = new ResourceConfig(new JSONObject()); | ||
} | ||
|
||
/** | ||
* Construct event attribute. | ||
* | ||
* @param publishEnabled Is publishing enabled. | ||
* @param properties Event properties. | ||
*/ | ||
public EventAttribute(boolean publishEnabled, ResourceConfig properties) { | ||
|
||
this.publishEnabled = publishEnabled; | ||
this.properties = properties; | ||
} | ||
|
||
public boolean isPublishEnabled() { | ||
|
||
return publishEnabled; | ||
} | ||
|
||
public void setPublishEnabled(boolean publishEnabled) { | ||
|
||
this.publishEnabled = publishEnabled; | ||
} | ||
|
||
public ResourceConfig getProperties() { | ||
|
||
return properties; | ||
} | ||
|
||
public void setProperties(ResourceConfig properties) { | ||
|
||
this.properties = properties; | ||
} | ||
|
||
/** | ||
* Get JSON string for the event attribute. | ||
* | ||
* @return JSON string. | ||
*/ | ||
public String toJSONString() { | ||
|
||
JSONObject jsonObject = new JSONObject(); | ||
jsonObject.put(Constants.EVENT_PUBLISHER_CONFIG_ATTRIBUTE_PUBLISH_ENABLED_KEY, publishEnabled); | ||
jsonObject.put(Constants.EVENT_PUBLISHER_CONFIG_ATTRIBUTE_PROPERTIES_KEY, properties.getConfigs()); | ||
|
||
return jsonObject.toJSONString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...er/src/main/java/org/wso2/identity/webhook/common/event/handler/model/ResourceConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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 | ||
* 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.identity.webhook.common.event.handler.model; | ||
|
||
import org.json.simple.JSONObject; | ||
|
||
/** | ||
* A wrapper class for JSONObject to hold resource configuration properties. | ||
*/ | ||
public class ResourceConfig { | ||
|
||
private JSONObject configs; | ||
|
||
/** | ||
* Constructor for Resource config . | ||
* | ||
* @param configs JSON object. | ||
*/ | ||
public ResourceConfig(JSONObject configs) { | ||
|
||
this.configs = configs; | ||
} | ||
|
||
public JSONObject getConfigs() { | ||
|
||
return configs; | ||
} | ||
|
||
public void setConfigs(JSONObject configs) { | ||
|
||
this.configs = configs; | ||
} | ||
} |
Oops, something went wrong.