From ee5676d8157c758085b9ce717b99aa11873a301d Mon Sep 17 00:00:00 2001 From: Shamalka Navod Date: Mon, 22 Feb 2021 01:43:35 +0000 Subject: [PATCH] Improve policy UI bean classes --- .../mgt/common/policy/mgt/ui/APIContent.java | 43 ++++++++ .../mgt/common/policy/mgt/ui/APITable.java | 34 +----- .../device/mgt/common/policy/mgt/ui/Card.java | 103 ++++++++++++++++++ 3 files changed, 150 insertions(+), 30 deletions(-) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/APIContent.java create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Card.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/APIContent.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/APIContent.java new file mode 100644 index 0000000000..5c0f412880 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/APIContent.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "APIContent") +public class APIContent { + + private String apiContentKey; + private Item item; + + @XmlElement(name = "APIContentKey") + public String getApiContentKey() { + return apiContentKey; + } + + public void setApiContentKey(String apiContentKey) { + this.apiContentKey = apiContentKey; + } + + @XmlElement(name = "Item") + public Item getItem() { return item; } + + public void setItem(Item item) { this.item = item; } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/APITable.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/APITable.java index 3a808f60c2..2f176b9ba6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/APITable.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/APITable.java @@ -18,9 +18,7 @@ package org.wso2.carbon.device.mgt.common.policy.mgt.ui; import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; @XmlRootElement(name = "APITable") public class APITable { @@ -28,9 +26,7 @@ public class APITable { private String url; private String payload; private String mainAttribute; - private String cardTitle; - private String cardKey; - private Modal modal; + private Card card; @XmlElement(name = "RequestMethod") public String getRequestMethod() { @@ -59,15 +55,6 @@ public class APITable { this.payload = payload; } - @XmlElement(name = "Modal") - public Modal getModal() { - return modal; - } - - public void setModal(Modal modal) { - this.modal = modal; - } - @XmlElement(name = "MainAttribute") public String getMainAttribute() { return mainAttribute; @@ -77,21 +64,8 @@ public class APITable { this.mainAttribute = mainAttribute; } - @XmlElement(name = "CardTitle") - public String getCardTitle() { - return cardTitle; - } - - public void setCardTitle(String cardTitle) { - this.cardTitle = cardTitle; - } + @XmlElement(name = "Card") + public Card getCard() { return card; } - @XmlElement(name = "CardKey") - public String getCardKey() { - return cardKey; - } - - public void setCardKey(String cardKey) { - this.cardKey = cardKey; - } + public void setCard(Card card) { this.card = card; } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Card.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Card.java new file mode 100644 index 0000000000..da1ebcc71e --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Card.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "Card") +public class Card { + + private String title; + private String key; + private List apiContents; + private APIContent apiContent; + private Item item; + private List items; + private List subContents; + + @XmlAttribute(name = "title", required = true) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + @XmlAttribute(name = "key", required = true) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + @XmlElementWrapper(name = "APIContents") + @XmlElement(name = "APIContent") + public List getApiContents() { + return apiContents; + } + + public void setApiContents(List apiContents) { + this.apiContents = apiContents; + } + + @XmlElement(name = "APIContent") + public APIContent getApiContent() { + return apiContent; + } + + public void setApiContent(APIContent apiContent) { + this.apiContent = apiContent; + } + + @XmlElement(name = "Item") + public Item getItem() { + return item; + } + + public void setItem(Item item) { + this.item = item; + } + + @XmlElementWrapper(name = "Items") + @XmlElement(name = "Item") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + @XmlElementWrapper(name = "SubContents") + @XmlElement(name = "SubContent") + public List getSubContents() { + return subContents; + } + + public void setSubContents(List subContents) { + this.subContents = subContents; + } +}