forked from community/device-mgt-core
Generate Policy configuration UI from JSON See merge request entgra/carbon-device-mgt!427feature/appm-store/pbac
commit
3e3d9e9ba6
File diff suppressed because it is too large
Load Diff
@ -1,29 +1,32 @@
|
|||||||
.ant-tabs-content {
|
/*
|
||||||
/*height: 120px;*/
|
* Copyright (c) 2020, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
|
||||||
margin-top: -16px;
|
*
|
||||||
}
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
.ant-tabs-content > .ant-tabs-tabpane {
|
.tab-container > .ant-tabs > .ant-tabs-bar {
|
||||||
/*background: #000066;*/
|
border-color: #aaaaaa;
|
||||||
/*color: #ffffff;*/
|
|
||||||
/*padding: 16px;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tabs-bar {
|
.tab-container > .ant-tabs > .ant-tabs-bar .ant-tabs-tab {
|
||||||
border-color: #3498db;
|
height: 50px;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tabs-bar .ant-tabs-tab {
|
.tab-container > .ant-tabs > .ant-tabs-bar .ant-tabs-tab-active {
|
||||||
border-color: #3498db;
|
border-color: transparent;
|
||||||
background: transparent;
|
background: #4b92db;
|
||||||
/*color: #cc0000;*/
|
color: #fff;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tabs-bar .ant-tabs-tab-active {
|
|
||||||
|
|
||||||
/*border-color: #1b3bcc;*/
|
|
||||||
/*background: #3498db;*/
|
|
||||||
/*color: #cc0000;*/
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.ui.policy.mgt;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModel(
|
||||||
|
value = "Policy",
|
||||||
|
description = "This class carries all information related to a policies."
|
||||||
|
)
|
||||||
|
public class Policy implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -2884635400482180628L;
|
||||||
|
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "id",
|
||||||
|
value = "Policy Id.",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "name",
|
||||||
|
value = "A name that describes a policy.",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "description",
|
||||||
|
value = "Provides a description of the policy.",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "panels",
|
||||||
|
value = "Properties related to policy.",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
private List<DataPanels> panels;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DataPanels> getPanels() {
|
||||||
|
return panels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPanels(List<DataPanels> panels) {
|
||||||
|
this.panels = panels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DataPanels implements Serializable {
|
||||||
|
private Object panel;
|
||||||
|
|
||||||
|
public Object getPanel() {
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPanel(Object value) {
|
||||||
|
this.panel = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.ui.policy.mgt;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
|
||||||
|
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.Policy;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PolicyConfigurationManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Json which include Policies UI configuration details.
|
||||||
|
*/
|
||||||
|
List<Policy> getPolicies() throws DeviceManagementException;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
public class Buttons {
|
||||||
|
@XmlElement(name = "ButtonId", required = true)
|
||||||
|
protected String id;
|
||||||
|
|
||||||
|
@XmlElement(name = "ButtonLabel", required = true)
|
||||||
|
protected String name;
|
||||||
|
|
||||||
|
public String getButtonId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButtonId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getButtonLabel() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButtonLabel(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
public class Column {
|
||||||
|
@XmlElement(name = "Name", required = true)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@XmlAttribute(name = "type", required = true)
|
||||||
|
protected String type;
|
||||||
|
|
||||||
|
@XmlAttribute(name = "key", required = true)
|
||||||
|
protected String key;
|
||||||
|
|
||||||
|
@XmlElement(name = "Others")
|
||||||
|
protected OptionalData others;
|
||||||
|
|
||||||
|
public String getColumnName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumnName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColumnType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumnType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColumnKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumnKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OptionalData getOtherColumnData() {
|
||||||
|
return others;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getOtherColumnData(OptionalData others) {
|
||||||
|
this.others = others;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Java class for uiParams complex type.
|
||||||
|
*
|
||||||
|
* The following schema fragment specifies the expected content contained within this class.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* <xs:element name="Panel" maxOccurs="unbounded">
|
||||||
|
* <xs:complexType>
|
||||||
|
* <xs:sequence>
|
||||||
|
* <xs:element name="title" type="xs:string" />
|
||||||
|
* <xs:element name="description" type="xs:string" />
|
||||||
|
* <xs:element name="id" type="xs:string" />
|
||||||
|
* <xs:element name="panelItems">
|
||||||
|
* <xs:complexType>
|
||||||
|
* <xs:sequence>
|
||||||
|
* <xs:element name="value" type="xs:string" />
|
||||||
|
* </xs:sequence>
|
||||||
|
* </xs:complexType>
|
||||||
|
* </xs:element>
|
||||||
|
* </xs:sequence>
|
||||||
|
* <xs:attribute name="optional" type="xs:string" />
|
||||||
|
* </xs:complexType>
|
||||||
|
* </xs:element>
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class DataPanel {
|
||||||
|
|
||||||
|
@XmlAttribute(name = "id", required = true)
|
||||||
|
private String panelId;
|
||||||
|
|
||||||
|
@XmlElement(name = "Title", required = true)
|
||||||
|
protected String title;
|
||||||
|
|
||||||
|
@XmlElement(name = "Description", required = true)
|
||||||
|
protected String description;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "PanelItems")
|
||||||
|
@XmlElement(name = "PanelItem")
|
||||||
|
private List<PanelItem> panelItem;
|
||||||
|
|
||||||
|
public String getPaneId() {
|
||||||
|
return panelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPanelId(String panelId) {
|
||||||
|
this.panelId = panelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String value) {
|
||||||
|
this.description = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PanelItem> getPanelItemList() {
|
||||||
|
return panelItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPanelItemList(List<PanelItem> panelItem) {
|
||||||
|
this.panelItem = panelItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
public class Option {
|
||||||
|
@XmlElement(name = "OptionName", required = true)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@XmlElement(name = "OptionValue", required = true)
|
||||||
|
protected String value;
|
||||||
|
|
||||||
|
public String getOptionName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptionName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOptionValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptionValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,209 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class OptionalData {
|
||||||
|
@XmlElement(name = "Checked")
|
||||||
|
private boolean ischecked;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "Options")
|
||||||
|
@XmlElement(name = "Option")
|
||||||
|
private List<Option> option;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "RadioGroup")
|
||||||
|
@XmlElement(name = "Radio")
|
||||||
|
private List<Option> radio;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "SubPanels")
|
||||||
|
@XmlElement(name = "SubPanel")
|
||||||
|
private List<SubPanel> subPanel;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "Columns")
|
||||||
|
@XmlElement(name = "Column")
|
||||||
|
private List<Column> columns;
|
||||||
|
|
||||||
|
@XmlElement(name = "Placeholder")
|
||||||
|
private String placeholder;
|
||||||
|
|
||||||
|
@XmlElement(name = "InitialValue")
|
||||||
|
private String initialValue;
|
||||||
|
|
||||||
|
@XmlElement(name = "InitialDataIndex")
|
||||||
|
private String initialDataIndex;
|
||||||
|
|
||||||
|
@XmlElement(name = "inputType")
|
||||||
|
private String inputType;
|
||||||
|
|
||||||
|
@XmlElement(name = "DataSource")
|
||||||
|
private String dataSource;
|
||||||
|
|
||||||
|
@XmlElement(name = "Rules")
|
||||||
|
private ValidationRules rules;
|
||||||
|
|
||||||
|
@XmlElement(name = "Button")
|
||||||
|
private Buttons button;
|
||||||
|
|
||||||
|
@XmlElement(name = "RowCount")
|
||||||
|
private int row;
|
||||||
|
|
||||||
|
@XmlElement(name = "LabelDescription")
|
||||||
|
private String labelDescription;
|
||||||
|
|
||||||
|
@XmlElement(name = "StartOptionValue")
|
||||||
|
private int firstOptionValue;
|
||||||
|
|
||||||
|
@XmlElement(name = "LastOptionValue")
|
||||||
|
private int lastOptionValue;
|
||||||
|
|
||||||
|
@XmlElement(name = "ValueDifference")
|
||||||
|
private int valueDifference;
|
||||||
|
|
||||||
|
public boolean getChecked() {
|
||||||
|
return ischecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChecked(boolean hidden) {
|
||||||
|
this.ischecked = hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Option> getRadioGroup() {
|
||||||
|
return radio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadioGroup(List<Option> radio) {
|
||||||
|
this.radio = radio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Option> getOptions() {
|
||||||
|
return option;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptions(List<Option> option) {
|
||||||
|
this.option = option;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SubPanel> getSubPanels(){
|
||||||
|
return subPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubPanels(List<SubPanel> subPanel){
|
||||||
|
this.subPanel = subPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlaceholders(){
|
||||||
|
return placeholder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlaceholders(String placeholder){
|
||||||
|
this.placeholder = placeholder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInitialRadioValue(){
|
||||||
|
return initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInitialRadioValue(String initialValue){
|
||||||
|
this.initialValue = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDataSourceName(){
|
||||||
|
return dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataSourceName(String dataSource){
|
||||||
|
this.dataSource = dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInitialOptionValue(String initialDataIndex){
|
||||||
|
this.initialDataIndex = initialDataIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInitialOptionValue(){
|
||||||
|
return initialDataIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInputTypes(String inputType){
|
||||||
|
this.inputType = inputType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInputTypes(){
|
||||||
|
return inputType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Buttons getButtons(){
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButtons(Buttons button){
|
||||||
|
this.button = button;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidationRules getRule(){
|
||||||
|
return rules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRule(ValidationRules rules){
|
||||||
|
this.rules = rules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRowCount(){
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowCount(int row){
|
||||||
|
this.row = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabelDescriptions(String labelDescription){
|
||||||
|
this.labelDescription = labelDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabelDescriptions(){
|
||||||
|
return labelDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartOption(int firstOptionValue){
|
||||||
|
this.firstOptionValue = firstOptionValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStartOption(){
|
||||||
|
return firstOptionValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastOption(int lastOptionValue){
|
||||||
|
this.lastOptionValue = lastOptionValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLastOption(){
|
||||||
|
return lastOptionValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDifference(int valueDifference){
|
||||||
|
this.valueDifference = valueDifference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDifference(){
|
||||||
|
return valueDifference;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class PanelItem {
|
||||||
|
@XmlElement(name = "Label", required = true)
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
@XmlAttribute(name = "type", required = true)
|
||||||
|
protected String type;
|
||||||
|
|
||||||
|
@XmlElement(name = "Tooltip")
|
||||||
|
protected String tooltip;
|
||||||
|
|
||||||
|
@XmlElement(name = "ItemId")
|
||||||
|
protected String id;
|
||||||
|
|
||||||
|
@XmlElement(name = "Optional")
|
||||||
|
protected OptionalData optional;
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTooltip() {
|
||||||
|
return tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTooltip(String tooltip) {
|
||||||
|
this.tooltip = tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OptionalData getOptionalData() {
|
||||||
|
return optional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptionalData(OptionalData optional) {
|
||||||
|
this.optional = optional;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Java class for Feature complex type.
|
||||||
|
*
|
||||||
|
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* <xs:element name="Policy">
|
||||||
|
* <xs:complexType>
|
||||||
|
* <xs:sequence>
|
||||||
|
* <xs:element name="Name" type="xs:string" />
|
||||||
|
* <xs:element name="Description" type="xs:string" />
|
||||||
|
* </xs:sequence>
|
||||||
|
* </xs:complexType>
|
||||||
|
* </xs:element>
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@XmlType(name = "Policy", propOrder = {
|
||||||
|
"name",
|
||||||
|
"dataPanel"
|
||||||
|
})
|
||||||
|
public class Policy {
|
||||||
|
@XmlElement(name = "Name", required = true)
|
||||||
|
protected String name;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "Panels")
|
||||||
|
@XmlElement(name = "Panel")
|
||||||
|
private List<DataPanel> dataPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the name property.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* possible object is
|
||||||
|
* {@link String }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the name property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is
|
||||||
|
* {@link String }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setName(String value) {
|
||||||
|
this.name = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DataPanel> getPanels() {
|
||||||
|
return this.dataPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPanels(List<DataPanel> dataPanel) {
|
||||||
|
this.dataPanel = dataPanel;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Java class for Policies complex type.
|
||||||
|
*
|
||||||
|
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* <complexType name="Policies">
|
||||||
|
* <complexContent>
|
||||||
|
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||||
|
* <sequence>
|
||||||
|
* <element name="Policy" type="{}Policy"/>
|
||||||
|
* </sequence>
|
||||||
|
* </restriction>
|
||||||
|
* </complexContent>
|
||||||
|
* </complexType>
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@XmlType(name = "PolicyUIConfigurations", propOrder = {
|
||||||
|
"policy"
|
||||||
|
})
|
||||||
|
public class PolicyUIConfigurations {
|
||||||
|
|
||||||
|
@XmlElement(name = "Policy")
|
||||||
|
protected List<Policy> policy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the policy property.
|
||||||
|
*
|
||||||
|
* Objects of the following type(s) are allowed in the list
|
||||||
|
* {@link String }
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Policy> getPolicies() {
|
||||||
|
if (policy == null) {
|
||||||
|
policy = new ArrayList<Policy>();
|
||||||
|
}
|
||||||
|
return this.policy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPolicies(List<Policy> policies) {
|
||||||
|
this.policy = policies;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SubPanel {
|
||||||
|
@XmlElement(name = "PanelKey", required = true)
|
||||||
|
protected String id;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "PanelItems")
|
||||||
|
@XmlElement(name = "PanelItem")
|
||||||
|
private List<PanelItem> panelItem;
|
||||||
|
|
||||||
|
public String getPanelKey() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPanelKey(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PanelItem> getPanelItemList1() {
|
||||||
|
return panelItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPanelItemList1(List<PanelItem> panelItem) {
|
||||||
|
this.panelItem = panelItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
package org.wso2.carbon.device.mgt.extensions.device.type.template.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
public class ValidationRules {
|
||||||
|
@XmlElement(name = "Regex", required = true)
|
||||||
|
protected String regex;
|
||||||
|
|
||||||
|
@XmlElement(name = "ValidationMsg", required = true)
|
||||||
|
protected String validationMsg;
|
||||||
|
|
||||||
|
@XmlElement(name = "Required", required = true)
|
||||||
|
protected boolean required;
|
||||||
|
|
||||||
|
public String getRegexString(){
|
||||||
|
return regex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegexString(String regex){
|
||||||
|
this.regex = regex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValidationMessage(){
|
||||||
|
return validationMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValidationMessage(String validationMsg){
|
||||||
|
this.validationMsg = validationMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsRequired(){
|
||||||
|
return required;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsRequired(boolean required){
|
||||||
|
this.required = required;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, Entgra (pvt) Ltd. (http://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.extensions.device.type.template.policy.mgt;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.Policy;
|
||||||
|
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.PolicyConfigurationManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ConfigurationBasedPolicyManager implements PolicyConfigurationManager {
|
||||||
|
private List<Policy> policies = new ArrayList<>();
|
||||||
|
|
||||||
|
public ConfigurationBasedPolicyManager(List<org.wso2.carbon.device.mgt.extensions.device.type.template.config.Policy> policies){
|
||||||
|
policies.forEach(policy -> {
|
||||||
|
Policy policyConfiguration = new Policy();
|
||||||
|
policyConfiguration.setName(policy.getName());
|
||||||
|
if(policy.getPanels() != null){
|
||||||
|
List<Policy.DataPanels> panel = new ArrayList<>();
|
||||||
|
policy.getPanels().parallelStream().forEach(panelData -> {
|
||||||
|
Policy.DataPanels panelDataEntry = new Policy.DataPanels();
|
||||||
|
panelDataEntry.setPanel(panelData);
|
||||||
|
panel.add(panelDataEntry);
|
||||||
|
});
|
||||||
|
policyConfiguration.setPanels(panel);
|
||||||
|
}
|
||||||
|
this.policies.add(policyConfiguration);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Policy> getPolicies() {
|
||||||
|
return policies;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue