Merge branch 'master' into 'master'

Generate Policy configuration UI from JSON

See merge request entgra/carbon-device-mgt!427
feature/appm-store/pbac
Dharmakeerthi Lasantha 5 years ago
commit 3e3d9e9ba6

@ -21,6 +21,7 @@
"rc-viewer": "0.0.9", "rc-viewer": "0.0.9",
"react-bootstrap": "^1.0.0-beta.12", "react-bootstrap": "^1.0.0-beta.12",
"react-highlight-words": "^0.16.0", "react-highlight-words": "^0.16.0",
"react-icons": "^3.8.0",
"react-image-viewer-zoom": "^1.0.36", "react-image-viewer-zoom": "^1.0.36",
"react-infinite-scroller": "^1.2.4", "react-infinite-scroller": "^1.2.4",
"react-leaflet": "^2.4.0", "react-leaflet": "^2.4.0",

@ -1,3 +1,21 @@
/*
* 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.
*/
import React from 'react'; import React from 'react';
import { Form, Row, Col, Card, Steps } from 'antd'; import { Form, Row, Col, Card, Steps } from 'antd';
import { withConfigContext } from '../../context/ConfigContext'; import { withConfigContext } from '../../context/ConfigContext';

@ -1,3 +1,21 @@
/*
* 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.
*/
import React from 'react'; import React from 'react';
import { Button, Divider, message, notification } from 'antd'; import { Button, Divider, message, notification } from 'antd';
import TimeAgo from 'javascript-time-ago/modules/JavascriptTimeAgo'; import TimeAgo from 'javascript-time-ago/modules/JavascriptTimeAgo';

@ -1,8 +1,36 @@
/*
* 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.
*/
import React from 'react'; import React from 'react';
import { Button, Form, Row, Col, Card, Steps } from 'antd'; import {
Button,
Form,
Row,
Col,
Card,
Steps,
message,
notification,
} from 'antd';
import { withConfigContext } from '../../context/ConfigContext'; import { withConfigContext } from '../../context/ConfigContext';
import SelectPlatform from './SelectPlatform'; import SelectPlatform from './SelectPlatform';
import ConfigureProfile from './ConfigureProfile'; import ConfigureProfile from './ConfigureProfile';
import axios from 'axios';
const { Step } = Steps; const { Step } = Steps;
class AddPolicy extends React.Component { class AddPolicy extends React.Component {
@ -10,34 +38,67 @@ class AddPolicy extends React.Component {
super(props); super(props);
this.config = this.props.context; this.config = this.props.context;
this.state = { this.state = {
isAddDeviceModalVisible: false, currentStepIndex: 0,
current: 0, isLoading: false,
policyUIConfigurationsList: [],
}; };
} }
onClickType = () => { getPolicyConfigJson = type => {
this.setState({ this.setState({ isLoading: true });
current: 1,
}); let apiUrl =
window.location.origin +
this.config.serverConfig.invoker.uri +
this.config.serverConfig.invoker.deviceMgt +
'/device-types/' +
type +
'/ui-policy-configurations';
// send request to the invokers
axios
.get(apiUrl)
.then(res => {
if (res.status === 200) {
this.setState({
isLoading: false,
policyUIConfigurationsList: JSON.parse(res.data.data),
currentStepIndex: 1,
});
}
})
.catch(error => {
if (error.hasOwnProperty('response') && error.response.status === 401) {
// todo display a popop with error
message.error('You are not logged in');
window.location.href = window.location.origin + '/entgra/login';
} else {
notification.error({
message: 'There was a problem',
duration: 0,
description: 'Error occurred while trying to load Policy details.',
});
}
this.setState({ isLoading: false });
});
}; };
next() { onHandleNext = () => {
const current = this.state.current + 1; const currentStepIndex = this.state.currentStepIndex + 1;
this.setState({ current }); this.setState({ currentStepIndex });
} };
prev() { onHandlePrev = () => {
const current = this.state.current - 1; const currentStepIndex = this.state.currentStepIndex - 1;
this.setState({ current }); this.setState({ currentStepIndex });
} };
render() { render() {
const { current } = this.state; const { currentStepIndex, policyUIConfigurationsList } = this.state;
return ( return (
<div> <div>
<Row> <Row>
<Col span={20} offset={2}> <Col span={20} offset={2}>
<Steps style={{ minHeight: 32 }} current={current}> <Steps style={{ minHeight: 32 }} current={currentStepIndex}>
<Step key="Platform" title="Select a Platform" /> <Step key="Platform" title="Select a Platform" />
<Step key="ProfileConfigure" title="Configure profile" /> <Step key="ProfileConfigure" title="Configure profile" />
<Step key="PolicyType" title="Select policy type" /> <Step key="PolicyType" title="Select policy type" />
@ -48,31 +109,50 @@ class AddPolicy extends React.Component {
</Col> </Col>
<Col span={16} offset={4}> <Col span={16} offset={4}>
<Card style={{ marginTop: 24 }}> <Card style={{ marginTop: 24 }}>
<div style={{ display: current === 0 ? 'unset' : 'none' }}> <div
<SelectPlatform onClickType={this.onClickType} /> style={{ display: currentStepIndex === 0 ? 'unset' : 'none' }}
>
<SelectPlatform
getPolicyConfigJson={this.getPolicyConfigJson}
/>
</div> </div>
<div style={{ display: current === 1 ? 'unset' : 'none' }}> <div
<ConfigureProfile /> style={{ display: currentStepIndex === 1 ? 'unset' : 'none' }}
>
<ConfigureProfile
policyUIConfigurationsList={policyUIConfigurationsList}
/>
</div> </div>
<div style={{ display: current === 2 ? 'unset' : 'none' }}></div> <div
<div style={{ display: current === 3 ? 'unset' : 'none' }}></div> style={{ display: currentStepIndex === 2 ? 'unset' : 'none' }}
<div style={{ display: current === 4 ? 'unset' : 'none' }}></div> ></div>
<div style={{ display: current === 5 ? 'unset' : 'none' }}></div> <div
style={{ display: currentStepIndex === 3 ? 'unset' : 'none' }}
></div>
<div
style={{ display: currentStepIndex === 4 ? 'unset' : 'none' }}
></div>
<div
style={{ display: currentStepIndex === 5 ? 'unset' : 'none' }}
></div>
</Card> </Card>
</Col> </Col>
<Col span={16} offset={4}> <Col span={16} offset={4}>
<div style={{ marginTop: 24 }}> <div style={{ marginTop: 24 }}>
{current > 0 && ( {currentStepIndex > 0 && (
<Button style={{ marginRight: 8 }} onClick={() => this.prev()}> <Button
style={{ marginRight: 8 }}
onClick={() => this.onHandlePrev()}
>
Previous Previous
</Button> </Button>
)} )}
{current < 5 && current > 0 && ( {currentStepIndex > 0 && currentStepIndex < 5 && (
<Button type="primary" onClick={() => this.next()}> <Button type="primary" onClick={() => this.onHandleNext()}>
Next Next
</Button> </Button>
)} )}
{current === 5 && <Button type="primary">Done</Button>} {currentStepIndex === 5 && <Button type="primary">Done</Button>}
</div> </div>
</Col> </Col>
</Row> </Row>

@ -1,3 +1,21 @@
/*
* 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.
*/
import React from 'react'; import React from 'react';
import { import {
Tabs, Tabs,
@ -7,67 +25,343 @@ import {
Input, Input,
Typography, Typography,
Form, Form,
Collapse,
Checkbox, Checkbox,
Select, Select,
Tooltip, Tooltip,
Icon, Icon,
Table,
Alert, Alert,
Upload, Upload,
Popconfirm,
Button, Button,
Radio, Radio,
} from 'antd'; } from 'antd';
import { withConfigContext } from '../../context/ConfigContext'; import { withConfigContext } from '../../context/ConfigContext';
import '../../pages/Dashboard/Policies/policies.css'; import '../../pages/Dashboard/Policies/policies.css';
import jsonResponse from './configuration'; import moment from 'moment';
const { Title, Paragraph } = Typography; const { Text, Title, Paragraph } = Typography;
const { TabPane } = Tabs; const { TabPane } = Tabs;
const { Option } = Select; const { Option } = Select;
const { TextArea } = Input; const { TextArea } = Input;
const policyConfigurationsList = jsonResponse.PolicyConfigurations;
class ConfigureProfile extends React.Component { class ConfigureProfile extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.config = this.props.context; this.config = this.props.context;
this.policies = policyConfigurationsList.androidPolicy.Policy;
this.state = { this.state = {
loading: false,
isDisplayMain: 'none', isDisplayMain: 'none',
activeKeys: [], activePanelKeys: [],
activeSubPanelKeys: [],
count: 0,
dataArray: [],
customInputDataArray: [],
inputTableDataSources: {},
addPolicyForms: null,
}; };
} }
componentDidMount() {} componentDidMount() {}
onChange = e => { // convert time from 24h format to 12h format
console.log(`checked = ${e.target.id}`); timeConverter = time => {
time = time
.toString()
.match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [time];
if (time.length > 1) {
time = time.slice(1);
time[5] = +time[0] < 12 ? ' AM' : ' PM';
time[0] = +time[0] % 12 || 12;
}
return time.join('');
}; };
onChecked = (e, i) => { // get Option value from start Time, end Time and time difference between 2 values
if (e) { getOptionForTimeSelectors = (startTimeValue, endTimeValue, timeIncrement) => {
this.setState({ let timeOptions = [];
isDisplayMain: 'block', let time = new Date(
moment()
.startOf('day')
.format('YYYY/MM/DD'),
);
let tempValue = startTimeValue;
time.setMinutes(time.getMinutes() + tempValue);
let startOption = (
<Option value={String(tempValue)}>
{this.timeConverter(
`${String(time)
.split(' ')[4]
.substring(0, 5)}`,
)}
</Option>
);
timeOptions.push(startOption);
while (tempValue !== endTimeValue) {
time = new Date(
moment()
.startOf('day')
.format('YYYY/MM/DD'),
);
tempValue += timeIncrement;
if (tempValue > 1440) {
tempValue = 0;
continue;
}
time.setMinutes(time.getMinutes() + tempValue);
let option = (
<Option value={String(tempValue)}>
{this.timeConverter(
`${String(time)
.split(' ')[4]
.substring(0, 5)}`,
)}
</Option>
);
timeOptions.push(option);
}
return timeOptions;
};
// handle items which handle from radio buttons
handleRadioPanel = (e, subPanel) => {
{
subPanel.map((panel, i) => {
if (panel.value === e.target.value) {
document.getElementById(panel.value).style.display = 'block';
} else {
document.getElementById(panel.value).style.display = 'none';
}
}); });
} else { }
this.setState({ };
isDisplayMain: 'none',
// handle items which handle from select options
handleSelectedPanel = (e, subPanel) => {
{
subPanel.map((panel, i) => {
if (panel.id === e) {
document.getElementById(panel.id).style.display = 'block';
} else {
document.getElementById(panel.id).style.display = 'none';
}
}); });
} }
}; };
onClickSwitch = e => {}; // handle items which handle from checkbox
handleSubPanel = e => {
if (e.target.checked) {
let joined = this.state.activeSubPanelKeys.concat(e.target.id);
this.setState({ activeSubPanelKeys: joined });
} else {
let index = this.state.activeSubPanelKeys.indexOf(e.target.id);
if (index !== -1) {
this.state.activeSubPanelKeys.splice(index, 1);
let removed = this.state.activeSubPanelKeys;
this.setState({ activeSubPanelKeys: removed });
}
}
};
// handle Switch on off button
handleMainPanel = (e, ref) => {
if (e) {
let joined = this.state.activePanelKeys.concat(ref);
this.setState({ activePanelKeys: joined });
} else {
let index = this.state.activePanelKeys.indexOf(ref);
if (index !== -1) {
this.state.activePanelKeys.splice(index, 1);
let removed = this.state.activePanelKeys;
this.setState({ activePanelKeys: removed });
}
}
};
handleCustomInputTable = event => {
const { count, customInputDataArray } = this.state;
const newData = [
{
key: count,
CERT_NAME: `${event.file.name}`,
},
];
this.setState({
customInputDataArray: [...customInputDataArray, newData],
count: count + 1,
});
};
handleAdd = array => {
const { count, inputTableDataSources } = this.state;
const newData = [
{
key: count,
},
];
inputTableDataSources[array].push(newData);
Object.defineProperty(inputTableDataSources, array, {
value: inputTableDataSources[array],
});
this.setState({
inputTableDataSources,
count: count + 1,
});
};
getColumns = ({ getFieldDecorator }, arr) => {
const columnArray = [];
const actionColumn = [
{
title: '',
dataIndex: 'operation',
render: (name, row) => (
<Form.Item>
<Popconfirm title="Sure to delete?">
<a>
<Text type="danger">
<Icon type="delete" />
</Text>
</a>
</Popconfirm>
</Form.Item>
),
},
];
Object.values(arr).map((columnData, c) => {
if (columnData.type === 'input') {
const column = {
title: `${columnData.name}`,
dataIndex: `${columnData.key}`,
key: `${columnData.key}`,
render: (name, row, i) => (
<Form.Item>
{getFieldDecorator(`${columnData.key}${i}`, {})(
<Input
type={columnData.others.inputType}
placeholder={columnData.others.placeholder}
/>,
)}
</Form.Item>
),
};
columnArray.push(column);
} else if (columnData.type === 'upload') {
const column = {
title: `${columnData.name}`,
dataIndex: `${columnData.key}`,
key: `${columnData.key}`,
render: (name, row, i) => (
<Form.Item>
{getFieldDecorator(`${columnData.key}${i}`, {})(
<Upload>
<Button>
<Icon type="upload" /> Choose file
</Button>
</Upload>,
)}
</Form.Item>
),
};
columnArray.push(column);
} else if (columnData.type === 'select') {
const column = {
title: `${columnData.name}`,
dataIndex: `${columnData.key}`,
key: `${columnData.key}`,
render: (name, row, i) => (
<Form.Item>
{getFieldDecorator(`${columnData.key}${i}`, {
initialValue: columnData.others.initialDataIndex,
})(
<Select>
{columnData.others.option.map((option, i) => {
return (
<Option key={i} value={option.key}>
{option.value}
</Option>
);
})}
</Select>,
)}
</Form.Item>
),
};
columnArray.push(column);
}
});
const columns = columnArray.concat(actionColumn);
return columns;
};
// generate form items
getPanelItems = panel => { getPanelItems = panel => {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
return panel.map((item, k) => { return panel.map((item, k) => {
switch (item._type) { switch (item.type) {
case 'select': case 'select':
if (item.optional.hasOwnProperty('subPanel')) {
return (
<div>
<Form.Item
key={k}
label={
<span>
{item.label}&nbsp;
<Tooltip title={item.tooltip} placement="right">
<Icon type="question-circle-o" />
</Tooltip>
</span>
}
style={{ display: 'block' }}
>
{getFieldDecorator(`${item.id}`, {
initialValue: `${item.optional.option[0].name}`,
})(
<Select
onChange={e =>
this.handleSelectedPanel(e, item.optional.subPanel)
}
>
{item.optional.option.map((option, i) => {
return (
<Option key={i} value={option.value}>
{option.name}
</Option>
);
})}
</Select>,
)}
</Form.Item>
<div className={'sub-panel-container'}>
{item.optional.subPanel.map((panel, i) => {
return (
<div
id={panel.id}
key={i}
style={
panel.id === item.optional.initialDataIndex
? { display: 'block' }
: { display: 'none' }
}
>
{this.getPanelItems(panel.panelItem)}
</div>
);
})}
</div>
</div>
);
}
return ( return (
<Form.Item <Form.Item
key={k} key={k}
label={ label={
<span> <span>
{item.Label}&nbsp; {item.label}&nbsp;
<Tooltip title={item.tooltip} placement="right"> <Tooltip title={item.tooltip} placement="right">
<Icon type="question-circle-o" /> <Icon type="question-circle-o" />
</Tooltip> </Tooltip>
@ -75,24 +369,56 @@ class ConfigureProfile extends React.Component {
} }
style={{ display: 'block' }} style={{ display: 'block' }}
> >
{getFieldDecorator(`${item._id}`, { {getFieldDecorator(`${item.id}`, {
initialValue: `${item.Optional.Option[0]}`, initialValue: `${item.optional.option[0].name}`,
})( })(
<Select> <Select>
{item.Optional.Option.map(option => { {item.optional.option.map((option, i) => {
return <Option key={option}>{option}</Option>; return (
<Option key={i} value={option.value}>
{option.name}
</Option>
);
})} })}
</Select>, </Select>,
)} )}
</Form.Item> </Form.Item>
); );
case 'timeSelector':
return (
<Form.Item
key={k}
label={
<span>
{item.label}&nbsp;
<Tooltip title={item.tooltip} placement="right">
<Icon type="question-circle-o" />
</Tooltip>
</span>
}
style={{ display: 'block' }}
>
{getFieldDecorator(`${item.id}`, {
// valuePropName: 'option',
initialValue: item.optional.initialDataIndex,
})(
<Select>
{this.getOptionForTimeSelectors(
item.optional.firstOptionValue,
item.optional.lastOptionValue,
item.optional.valueDifference,
)}
</Select>,
)}
</Form.Item>
);
case 'input': case 'input':
return ( return (
<Form.Item <Form.Item
key={k} key={k}
label={ label={
<span> <span>
{item.Label}&nbsp; {item.label}&nbsp;
<Tooltip title={item.tooltip} placement="right"> <Tooltip title={item.tooltip} placement="right">
<Icon type="question-circle-o" /> <Icon type="question-circle-o" />
</Tooltip> </Tooltip>
@ -100,29 +426,71 @@ class ConfigureProfile extends React.Component {
} }
style={{ display: 'block' }} style={{ display: 'block' }}
> >
{getFieldDecorator(`${item._id}`, { {getFieldDecorator(`${item.id}`, {
rules: [ rules: [
{ {
pattern: new RegExp(`${item.Optional.rules.regex}`), pattern: new RegExp(`${item.optional.rules.regex}`),
message: `${item.Optional.rules.validationMsg}`, message: `${item.optional.rules.validationMsg}`,
}, },
], ],
})(<Input placeholder={item.Optional.Placeholder} />)} })(<Input placeholder={item.optional.placeholder} />)}
</Form.Item> </Form.Item>
); );
case 'checkbox': case 'checkbox':
if (item.optional.hasOwnProperty('subPanel')) {
return (
<div key={k}>
<Collapse
bordered={false}
activeKey={this.state.activeSubPanelKeys}
>
<Collapse.Panel
key={item.id}
showArrow={false}
style={{ border: 0 }}
header={
<Form.Item key={k}>
{getFieldDecorator(`${item.id}`, {
valuePropName: 'checked',
initialValue: item.optional.ischecked,
})(
<Checkbox onChange={this.handleSubPanel}>
<span>
{item.label}&nbsp;
<Tooltip title={item.tooltip} placement="right">
<Icon type="question-circle-o" />
</Tooltip>
</span>
</Checkbox>,
)}
</Form.Item>
}
>
<div>
<div>
{item.optional.subPanel.map((panel, i) => {
return (
<div key={i}>
{this.getPanelItems(panel.panelItem)}
</div>
);
})}
</div>
</div>
</Collapse.Panel>
</Collapse>
</div>
);
}
return ( return (
<Form.Item key={k}> <Form.Item key={k}>
{getFieldDecorator(`${item._id}`, { {getFieldDecorator(`${item.id}`, {
valuePropName: 'checked', valuePropName: 'checked',
initialValue: `${item.Optional.checked}`, initialValue: item.optional.ischecked,
})( })(
<Checkbox <Checkbox>
// checked={item.Optional.checked}
onChange={this.onChange}
>
<span> <span>
{item.Label}&nbsp; {item.label}&nbsp;
<Tooltip title={item.tooltip} placement="right"> <Tooltip title={item.tooltip} placement="right">
<Icon type="question-circle-o" /> <Icon type="question-circle-o" />
</Tooltip> </Tooltip>
@ -131,13 +499,14 @@ class ConfigureProfile extends React.Component {
)} )}
</Form.Item> </Form.Item>
); );
case 'textArea': case 'textArea':
return ( return (
<Form.Item <Form.Item
key={k} key={k}
label={ label={
<span> <span>
{item.Label}&nbsp; {item.label}&nbsp;
<Tooltip title={item.tooltip} placement="right"> <Tooltip title={item.tooltip} placement="right">
<Icon type="question-circle-o" /> <Icon type="question-circle-o" />
</Tooltip> </Tooltip>
@ -145,56 +514,81 @@ class ConfigureProfile extends React.Component {
} }
style={{ display: 'block' }} style={{ display: 'block' }}
> >
{getFieldDecorator(`${item._id}`, {})( {getFieldDecorator(`${item.id}`, {})(
<TextArea <TextArea
placeholder={item.Optional.Placeholder} placeholder={item.optional.placeholder}
rows={item.Optional.Row} rows={item.optional.row}
/>, />,
)} )}
</Form.Item> </Form.Item>
); );
case 'radioGroup': case 'radioGroup':
return ( return (
<Form.Item <div>
key={k} <Form.Item
label={ key={k}
<span> label={
{item.Label}&nbsp; <span>
<Tooltip title={item.tooltip} placement="right"> {item.label}&nbsp;
<Icon type="question-circle-o" /> <Tooltip title={item.tooltip} placement="right">
</Tooltip> <Icon type="question-circle-o" />
</span> </Tooltip>
} </span>
style={{ display: 'block' }} }
> style={{ display: 'block' }}
{getFieldDecorator(`${item._id}`, {})( >
<Radio.Group> {getFieldDecorator(`${item.id}`, {
{item.Optional.Radio.map(option => { initialValue: `${item.optional.initialValue}`,
return ( })(
<Radio key={option} value={option}> <Radio.Group
{option} onChange={e =>
</Radio> this.handleRadioPanel(e, item.optional.radio)
); }
})} >
</Radio.Group>, {item.optional.radio.map((option, i) => {
)} return (
</Form.Item> <Radio key={i} value={option.value}>
{option.name}
</Radio>
);
})}
</Radio.Group>,
)}
</Form.Item>
<div className={'sub-panel-container'}>
{item.optional.subPanel.map((panel, i) => {
return (
<div
key={i}
id={panel.id}
style={
panel.id === item.optional.initialValue
? { display: 'block' }
: { display: 'none' }
}
>
{this.getPanelItems(panel.panelItem)}
</div>
);
})}
</div>
</div>
); );
case 'title': case 'title':
return ( return (
<Title key={k} level={4}> <Title key={k} level={4}>
{item.Label}{' '} {item.label}{' '}
</Title> </Title>
); );
case 'paragraph': case 'paragraph':
return ( return (
<Paragraph key={k} style={{ marginTop: 20 }}> <Paragraph key={k} style={{ marginTop: 20 }}>
{item.Label}{' '} {item.label}{' '}
</Paragraph> </Paragraph>
); );
case 'alert': case 'alert':
return ( return (
<Alert key={k} description={item.Label} type="warning" showIcon /> <Alert key={k} description={item.label} type="warning" showIcon />
); );
case 'upload': case 'upload':
return ( return (
@ -202,7 +596,7 @@ class ConfigureProfile extends React.Component {
key={k} key={k}
label={ label={
<span> <span>
{item.Label}&nbsp; {item.label}&nbsp;
<Tooltip title={item.tooltip} placement="right"> <Tooltip title={item.tooltip} placement="right">
<Icon type="question-circle-o" /> <Icon type="question-circle-o" />
</Tooltip> </Tooltip>
@ -218,6 +612,57 @@ class ConfigureProfile extends React.Component {
)} )}
</Form.Item> </Form.Item>
); );
case 'inputTable':
if (
!(`${item.optional.dataSource}` in this.state.inputTableDataSources)
) {
Object.defineProperty(
this.state.inputTableDataSources,
`${item.optional.dataSource}`,
{ value: [], writable: true },
);
}
return (
<div key={k}>
<Button
onClick={() => this.handleAdd(item.optional.dataSource)}
type="primary"
style={{ marginBottom: 16 }}
>
<Icon type="plus-circle" />
{item.optional.button.name}
</Button>
<Table
id={item.id}
dataSource={
this.state.inputTableDataSources[item.optional.dataSource]
}
columns={this.getColumns(
{ getFieldDecorator },
item.optional.columns,
)}
/>
</div>
);
case 'customInputTable':
return (
<div key={k}>
<Upload onChange={this.handleCustomInputTable}>
<Button type="primary" style={{ marginBottom: 16 }}>
<Icon type="plus-circle" />
{item.optional.button.name}
</Button>
</Upload>
<Table
id={item.id}
dataSource={this.state.customInputDataArray}
columns={this.getColumns(
{ getFieldDecorator },
item.optional.columns,
)}
/>
</div>
);
default: default:
return null; return null;
} }
@ -225,36 +670,58 @@ class ConfigureProfile extends React.Component {
}; };
render() { render() {
const { policyUIConfigurationsList } = this.props;
return ( return (
<div> <div className="tab-container">
{/* <div>*/}
{/* <Select style={{ width: 200 }}>*/}
{/* {this.getOptionForTimeSelectors(1440, 1410, 30)}*/}
{/* </Select>*/}
{/* </div>*/}
<Tabs tabPosition={'left'} size={'large'}> <Tabs tabPosition={'left'} size={'large'}>
{this.policies.map((element, i) => { {policyUIConfigurationsList.map((element, i) => {
return ( return (
<TabPane tab={element.Name} key={i}> <TabPane tab={<span>{element.name}</span>} key={i}>
{/* <div style={{ height: 800, overflowY: "scroll"}}>*/} {Object.values(element.panels).map((panel, j) => {
{Object.values(element.Panel).map((panel, j) => { panel = panel.panel;
return ( return (
<div key={j}> <div key={j}>
<div> <Collapse
<Row> bordered={false}
<Col offset={0} span={14}> activeKey={this.state.activePanelKeys}
<Title level={4}>{panel.title} </Title> >
</Col> <Collapse.Panel
<Col offset={8} span={1}> key={panel.panelId}
<Switch showArrow={false}
checkedChildren="ON" style={{ border: 0 }}
unCheckedChildren="OFF" header={
id={i} <div>
onClick={this.onClickSwitch} <Row>
onChange={this.onChecked} <Col offset={0} span={14}>
/> <Title level={4}> {panel.title} </Title>
</Col> </Col>
</Row> <Col offset={8} span={1}>
<Row>{panel.description}</Row> <Switch
</div> checkedChildren="ON"
<div style={{ display: `${this.state.isDisplayMain}` }}> unCheckedChildren="OFF"
<Form>{this.getPanelItems(panel.PanelItem)}</Form> onChange={e =>
</div> this.handleMainPanel(
e,
`${panel.panelId}`,
)
}
/>
</Col>
</Row>
<Row>{panel.description}</Row>
</div>
}
>
<div>
<Form>{this.getPanelItems(panel.panelItem)}</Form>
</div>
</Collapse.Panel>
</Collapse>
</div> </div>
); );
})} })}

@ -24,12 +24,11 @@ import TimeAgo from 'javascript-time-ago';
import en from 'javascript-time-ago/locale/en'; import en from 'javascript-time-ago/locale/en';
import { withConfigContext } from '../../context/ConfigContext'; import { withConfigContext } from '../../context/ConfigContext';
let apiUrl;
class SelectPlatform extends React.Component { class SelectPlatform extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
TimeAgo.addLocale(en); TimeAgo.addLocale(en);
this.config = this.props.context;
this.state = { this.state = {
data: [], data: [],
pagination: {}, pagination: {},
@ -42,20 +41,18 @@ class SelectPlatform extends React.Component {
this.fetchUsers(); this.fetchUsers();
} }
onClickCard = data => { onClickCard = (e, type) => {
console.log(data); this.props.getPolicyConfigJson(type);
this.props.onClickType();
}; };
// fetch data from api // fetch data from api
fetchUsers = (params = {}) => { fetchUsers = (params = {}) => {
const config = this.props.context;
this.setState({ loading: true }); this.setState({ loading: true });
apiUrl = let apiUrl =
window.location.origin + window.location.origin +
config.serverConfig.invoker.uri + this.config.serverConfig.invoker.uri +
config.serverConfig.invoker.deviceMgt + this.config.serverConfig.invoker.deviceMgt +
'/device-types'; '/device-types';
// send request to the invokerss // send request to the invokerss
@ -108,26 +105,28 @@ class SelectPlatform extends React.Component {
const { Meta } = Card; const { Meta } = Card;
const itemCard = data.map(data => ( const itemCard = data.map(data => (
<Col span={5} key={data.id}> <Col span={5} key={data.id}>
<Card <a>
size="default" <Card
style={{ width: 150 }} size="default"
bordered={true} style={{ width: 150 }}
onClick={this.onClickCard} bordered={true}
cover={ onClick={e => this.onClickCard(e, data.name)}
<Icon cover={
type="android" <Icon
key="device-types" type="android"
style={{ key="device-types"
color: '#ffffff', style={{
backgroundColor: '#4b92db', color: '#ffffff',
fontSize: '100px', backgroundColor: '#4b92db',
padding: '20px', fontSize: '100px',
}} padding: '20px',
/> }}
} />
> }
<Meta title={data.name} /> >
</Card> <Meta title={data.name} />
</Card>
</a>
</Col> </Col>
)); ));
return ( return (

@ -1,3 +1,21 @@
/*
* 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.
*/
import React from 'react'; import React from 'react';
import { import {
Button, Button,

@ -1,3 +1,21 @@
/*
* 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.
*/
import React from 'react'; import React from 'react';
import { import {
Button, Button,

@ -1,3 +1,21 @@
/*
* 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.
*/
import React from 'react'; import React from 'react';
import { import {
Button, Button,

@ -1,3 +1,21 @@
/*
* 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.
*/
import React from 'react'; import React from 'react';
import { import {
Button, Button,

@ -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
.ant-tabs-content > .ant-tabs-tabpane { * in compliance with the License.
/*background: #000066;*/ * You may obtain a copy of the License at
/*color: #ffffff;*/ *
/*padding: 16px;*/ * 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-bar { .tab-container > .ant-tabs > .ant-tabs-bar {
border-color: #3498db; border-color: #aaaaaa;
} }
.ant-tabs-bar .ant-tabs-tab { .tab-container > .ant-tabs > .ant-tabs-bar .ant-tabs-tab {
border-color: #3498db; height: 50px;
background: transparent; margin: 0;
/*color: #cc0000;*/
} }
.ant-tabs-bar .ant-tabs-tab-active { .tab-container > .ant-tabs > .ant-tabs-bar .ant-tabs-tab-active {
border-color: transparent;
/*border-color: #1b3bcc;*/ background: #4b92db;
/*background: #3498db;*/ color: #fff;
/*color: #cc0000;*/
} }

@ -100,6 +100,12 @@ import javax.ws.rs.core.Response;
description = "Get Config Details of a Device Type", description = "Get Config Details of a Device Type",
key = "perm:device-types:configs", key = "perm:device-types:configs",
permissions = {"/device-mgt/device-type/config/view"} permissions = {"/device-mgt/device-type/config/view"}
),
@Scope(
name = "Getting Details of Policies",
description = "Getting Details of Policies",
key = "perm:policies:get-details",
permissions = {"/device-mgt/policies/view"}
) )
} }
) )
@ -321,6 +327,67 @@ public interface DeviceTypeManagementService {
@HeaderParam("If-Modified-Since") @HeaderParam("If-Modified-Since")
String ifModifiedSince); String ifModifiedSince);
@GET
@Path("/{type}/ui-policy-configurations")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get Policy details of a Device Type",
notes = "Get the json object to generate policy configuration form from xml in plugin",
tags = "Device Type Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:get-details")
})
}
)
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched the policy configurations.",
response = DeviceTypeList.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description =
"Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests."),
}
),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request.",
response = ErrorResponse.class),
@ApiResponse(
code = 404,
message = "Not Found. \n Policy Configurations data for the specified device type was not found.",
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the " +
"list of supported device types.",
response = ErrorResponse.class)
}
)
Response getPolicies(
@ApiParam(
name = "type",
value = "The device type name, such as ios, android, windows or fire-alarm.",
required = true)
@PathParam("type")
@Size(min = 2, max = 45)
String type
);
@GET @GET
@Path("/{type}/configs") @Path("/{type}/configs")
@ApiOperation( @ApiOperation(

@ -38,9 +38,11 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.PolicyConfigurationManager;
import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceTypeNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceTypeNotFoundException;
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManager; import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
@ -130,6 +132,46 @@ public class DeviceTypeManagementServiceImpl implements DeviceTypeManagementServ
} }
} }
@GET
@Override
@Path("/{type}/ui-policy-configurations")
public Response getPolicies(@PathParam("type") @Size(min = 2, max = 45) String type){
List<Policy> policies;
DeviceManagementProviderService dms;
try {
if (StringUtils.isEmpty(type)) {
String msg = "Device Type cannot be empty.";
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
dms = DeviceMgtAPIUtils.getDeviceManagementService();
PolicyConfigurationManager pm = dms.getPolicyUIConfigurationManager(type);
if (pm == null) {
String msg = "No policy manager is registered with the given device type '" + type + "'";
log.error(msg);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
policies = pm.getPolicies();
} catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving the [" + type + "] policy details.";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
} catch (DeviceTypeNotFoundException e) {
String msg = "No device type found with name '" + type + "'";
log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(
new ErrorResponse.ErrorResponseBuilder()
.setMessage(msg).build()).build();
}
return Response.status(Response.Status.OK).entity(policies).build();
}
@GET @GET
@Override @Override
@Path("/{type}/features") @Path("/{type}/features")

@ -38,6 +38,7 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.PolicyConfigurationManager;
import java.util.List; import java.util.List;
@ -53,6 +54,13 @@ public interface DeviceManager {
*/ */
FeatureManager getFeatureManager(); FeatureManager getFeatureManager();
/**
* Method to return policy manager implementation associated with a particular platform-specific plugin.
*
* @return Returns an instance of policy configuration manager
*/
PolicyConfigurationManager getPolicyUIConfigurationManager();
/** /**
* Method to save platform specific Configuration. * Method to save platform specific Configuration.
* @param configuration - A Platform configuration object which needs to save * @param configuration - A Platform configuration object which needs to save

@ -16,14 +16,13 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.common.policy.mgt; package org.wso2.carbon.device.mgt.common.policy.mgt;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData; import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData;
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
public interface PolicyMonitoringManager { public interface PolicyMonitoringManager {
NonComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object response) NonComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object response)

@ -2,7 +2,7 @@ package org.wso2.carbon.device.mgt.common.type.mgt;
import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.InitialOperationConfig; import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.ui.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
@ -12,6 +12,7 @@ public class DeviceTypeMetaDefinition {
private List<String> properties; private List<String> properties;
private List<Feature> features; private List<Feature> features;
private List<Policy> policies;
private boolean claimable; private boolean claimable;
private PushNotificationConfig pushNotificationConfig; private PushNotificationConfig pushNotificationConfig;
private boolean policyMonitoringEnabled; private boolean policyMonitoringEnabled;
@ -44,6 +45,14 @@ public class DeviceTypeMetaDefinition {
this.features = features; this.features = features;
} }
public List<Policy> getPolicies() {
return policies;
}
public void setPolicies(List<Policy> policies) {
this.policies = policies;
}
public boolean isClaimable() { public boolean isClaimable() {
return claimable; return claimable;
} }

@ -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;
}

@ -36,21 +36,21 @@
package org.wso2.carbon.device.mgt.core.service; package org.wso2.carbon.device.mgt.core.service;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceTransferRequest; import org.wso2.carbon.device.mgt.common.DeviceTransferRequest;
import org.wso2.carbon.device.mgt.common.MonitoringOperation;
import org.wso2.carbon.device.mgt.common.StartupOperationConfig;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceTypeNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceTypeNotFoundException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.MonitoringOperation;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.exceptions.UnauthorizedDeviceAccessException; import org.wso2.carbon.device.mgt.common.exceptions.UnauthorizedDeviceAccessException;
import org.wso2.carbon.device.mgt.common.exceptions.UserNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.UserNotFoundException;
import org.wso2.carbon.device.mgt.common.StartupOperationConfig;
import org.wso2.carbon.device.mgt.common.configuration.mgt.AmbiguousConfigurationException; import org.wso2.carbon.device.mgt.common.configuration.mgt.AmbiguousConfigurationException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.DeviceConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.DeviceConfiguration;
@ -65,6 +65,7 @@ import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationExecutionFailedException; import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationExecutionFailedException;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy; import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.PolicyConfigurationManager;
import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import org.wso2.carbon.device.mgt.core.dto.DeviceTypeVersion; import org.wso2.carbon.device.mgt.core.dto.DeviceTypeVersion;
import org.wso2.carbon.device.mgt.core.geo.GeoCluster; import org.wso2.carbon.device.mgt.core.geo.GeoCluster;
@ -570,6 +571,15 @@ public interface DeviceManagementProviderService {
FeatureManager getFeatureManager(String deviceType) throws DeviceTypeNotFoundException; FeatureManager getFeatureManager(String deviceType) throws DeviceTypeNotFoundException;
/**
* Proxy method to get the UI configurations of Policies.
*
* @param deviceType Device platform
* @return Policies UI configurations of the particular device type.
* @throws DeviceTypeNotFoundException If device type is not registered.
*/
PolicyConfigurationManager getPolicyUIConfigurationManager(String deviceType) throws DeviceTypeNotFoundException;
/** /**
* Proxy method to get the tenant configuration of a given platform. * Proxy method to get the tenant configuration of a given platform.
* *

@ -48,28 +48,28 @@ import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.DeviceEnrollmentInfoNotification; import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.MonitoringOperation;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.StartupOperationConfig;
import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
import org.wso2.carbon.device.mgt.common.DeviceTransferRequest; import org.wso2.carbon.device.mgt.common.DeviceTransferRequest;
import org.wso2.carbon.device.mgt.common.DevicePropertyNotification;
import org.wso2.carbon.device.mgt.common.DeviceEnrollmentInfoNotification;
import org.wso2.carbon.device.mgt.common.DeviceNotification;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException;
import org.wso2.carbon.device.mgt.common.DeviceNotification;
import org.wso2.carbon.device.mgt.common.DevicePropertyNotification;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceTypeNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceTypeNotFoundException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.MonitoringOperation;
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.exceptions.TransactionManagementException; import org.wso2.carbon.device.mgt.common.exceptions.TransactionManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.UnauthorizedDeviceAccessException; import org.wso2.carbon.device.mgt.common.exceptions.UnauthorizedDeviceAccessException;
import org.wso2.carbon.device.mgt.common.exceptions.UserNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.UserNotFoundException;
import org.wso2.carbon.device.mgt.common.StartupOperationConfig;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.configuration.mgt.AmbiguousConfigurationException; import org.wso2.carbon.device.mgt.common.configuration.mgt.AmbiguousConfigurationException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
@ -101,6 +101,7 @@ import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypePlatformDetails; import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypePlatformDetails;
import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypePlatformVersion; import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypePlatformVersion;
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.PolicyConfigurationManager;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository; import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository;
import org.wso2.carbon.device.mgt.core.cache.DeviceCacheKey; import org.wso2.carbon.device.mgt.core.cache.DeviceCacheKey;
@ -218,6 +219,17 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
return deviceManager.getFeatureManager(); return deviceManager.getFeatureManager();
} }
@Override
public PolicyConfigurationManager getPolicyUIConfigurationManager(String deviceType) throws DeviceTypeNotFoundException {
DeviceManager deviceManager = this.getDeviceManager(deviceType);
if (deviceManager == null) {
String msg = "Device type '" + deviceType + "' not found.";
log.error(msg);
throw new DeviceTypeNotFoundException(msg);
}
return deviceManager.getPolicyUIConfigurationManager();
}
@Override @Override
public boolean enrollDevice(Device device) throws DeviceManagementException { public boolean enrollDevice(Device device) throws DeviceManagementException {
if (device == null) { if (device == null) {

@ -15,11 +15,17 @@
*/ */
package org.wso2.carbon.device.mgt.core; package org.wso2.carbon.device.mgt.core;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.PolicyConfigurationManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -27,7 +33,6 @@ import java.util.List;
public class TestDeviceManager implements DeviceManager { public class TestDeviceManager implements DeviceManager {
public TestDeviceManager() { public TestDeviceManager() {
} }
@Override @Override
@ -35,6 +40,11 @@ public class TestDeviceManager implements DeviceManager {
return null; return null;
} }
@Override
public PolicyConfigurationManager getPolicyUIConfigurationManager() {
return null;
}
@Override @Override
public boolean saveConfiguration(PlatformConfiguration configuration) public boolean saveConfiguration(PlatformConfiguration configuration)
throws DeviceManagementException { throws DeviceManagementException {

@ -40,27 +40,30 @@ import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager; import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DataSource; import org.wso2.carbon.device.mgt.common.ui.policy.mgt.PolicyConfigurationManager;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceDetails;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Feature; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceDetails;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Table; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DataSource;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.TableConfig; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.TableConfig;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Table;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Feature;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Policy;
import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceDAODefinition; import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceDAODefinition;
import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOManager; import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOManager;
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException; import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException;
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException; import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException;
import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypePluginExtensionException; import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypePluginExtensionException;
import org.wso2.carbon.device.mgt.extensions.device.type.template.feature.ConfigurationBasedFeatureManager; import org.wso2.carbon.device.mgt.extensions.device.type.template.feature.ConfigurationBasedFeatureManager;
import org.wso2.carbon.device.mgt.extensions.device.type.template.policy.mgt.ConfigurationBasedPolicyManager;
import org.wso2.carbon.device.mgt.extensions.device.type.template.util.DeviceTypePluginConstants; import org.wso2.carbon.device.mgt.extensions.device.type.template.util.DeviceTypePluginConstants;
import org.wso2.carbon.device.mgt.extensions.device.type.template.util.DeviceTypeUtils; import org.wso2.carbon.device.mgt.extensions.device.type.template.util.DeviceTypeUtils;
import org.wso2.carbon.device.mgt.extensions.license.mgt.registry.RegistryBasedLicenseManager; import org.wso2.carbon.device.mgt.extensions.license.mgt.registry.RegistryBasedLicenseManager;
@ -103,6 +106,7 @@ public class DeviceTypeManager implements DeviceManager {
+ "mobile"; + "mobile";
private FeatureManager featureManager; private FeatureManager featureManager;
private PolicyConfigurationManager policyManager;
public DeviceTypeManager(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier, public DeviceTypeManager(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier,
DeviceTypeConfiguration deviceTypeConfiguration) { DeviceTypeConfiguration deviceTypeConfiguration) {
@ -112,6 +116,12 @@ public class DeviceTypeManager implements DeviceManager {
List<Feature> features = deviceTypeConfiguration.getFeatures().getFeature(); List<Feature> features = deviceTypeConfiguration.getFeatures().getFeature();
featureManager = new ConfigurationBasedFeatureManager(features); featureManager = new ConfigurationBasedFeatureManager(features);
} }
if (deviceTypeConfiguration.getPolicyUIConfigurations() != null && deviceTypeConfiguration.getPolicyUIConfigurations().
getPolicies() != null) {
List<Policy> policies = deviceTypeConfiguration.getPolicyUIConfigurations().getPolicies();
policyManager = new ConfigurationBasedPolicyManager(policies);
}
if (deviceTypeConfiguration.getDeviceAuthorizationConfig() != null) { if (deviceTypeConfiguration.getDeviceAuthorizationConfig() != null) {
requiredDeviceTypeAuthorization = deviceTypeConfiguration.getDeviceAuthorizationConfig(). requiredDeviceTypeAuthorization = deviceTypeConfiguration.getDeviceAuthorizationConfig().
isAuthorizationRequired(); isAuthorizationRequired();
@ -252,6 +262,11 @@ public class DeviceTypeManager implements DeviceManager {
return featureManager; return featureManager;
} }
@Override
public PolicyConfigurationManager getPolicyUIConfigurationManager(){
return policyManager;
}
@Override @Override
public boolean saveConfiguration(PlatformConfiguration tenantConfiguration) public boolean saveConfiguration(PlatformConfiguration tenantConfiguration)
throws DeviceManagementException { throws DeviceManagementException {

@ -24,18 +24,19 @@ import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypeDefinitionProvider; import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypeDefinitionProvider;
import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypeMetaDefinition;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Claimable; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Claimable;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.ConfigProperties;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceDetails; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceDetails;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Properties;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Features; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Features;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.License; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PolicyUIConfigurations;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Policy;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PolicyMonitoring; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PolicyMonitoring;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Properties;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Property;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.ProvisioningConfig; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.ProvisioningConfig;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PullNotificationSubscriberConfig;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PushNotificationProvider; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PushNotificationProvider;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.ConfigProperties;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Property;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PullNotificationSubscriberConfig;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -98,6 +99,25 @@ public class HTTPDeviceTypeManagerService extends DeviceTypeManagerService imple
deviceTypeConfiguration.setFeatures(features); deviceTypeConfiguration.setFeatures(features);
} }
if (deviceTypeMetaDefinition.getPolicies() != null && !deviceTypeMetaDefinition.getPolicies().isEmpty()) {
PolicyUIConfigurations policyUIConfigurations = new PolicyUIConfigurations();
List<org.wso2.carbon.device.mgt.extensions.device.type.template.config.Policy> policyList
= new ArrayList<>();
deviceTypeMetaDefinition.getPolicies().forEach(policy -> {
Policy policyUIconfig = new Policy();
if(policy.getName() != null){
policyUIconfig.setName(policy.getName());
List<String> panelValues = new ArrayList<>();
policy.getPanels().forEach(panelData ->{
panelValues.add(panelData.getPanel().toString());
});
policyList.add(policyUIconfig);
}
});
policyUIConfigurations.addPolicies(policyList);
deviceTypeConfiguration.setPolicyUIConfigurations(policyUIConfigurations);
}
deviceTypeConfiguration.setName(deviceTypeName); deviceTypeConfiguration.setName(deviceTypeName);
//TODO: Add it to the license management service. //TODO: Add it to the license management service.
// if (deviceTypeMetaDefinition.getLicense() != null) { // if (deviceTypeMetaDefinition.getLicense() != null) {

@ -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;
}
}

@ -57,6 +57,7 @@ import java.util.List;
* &lt;sequence> * &lt;sequence>
* &lt;element name="DeviceDetails" type="{}DeviceDetails"/> * &lt;element name="DeviceDetails" type="{}DeviceDetails"/>
* &lt;element name="Features" type="{}Features"/> * &lt;element name="Features" type="{}Features"/>
* &lt;element name="PolicyUIConfigurations" type="{}PolicyUIConfigurations"/>
* &lt;element name="ProvisioningConfig" type="{}ProvisioningConfig"/> * &lt;element name="ProvisioningConfig" type="{}ProvisioningConfig"/>
* &lt;element name="PushNotificationProviderConfig" type="{}PushNotificationProviderConfig"/> * &lt;element name="PushNotificationProviderConfig" type="{}PushNotificationProviderConfig"/>
* &lt;element name="License" type="{}License"/> * &lt;element name="License" type="{}License"/>
@ -81,6 +82,8 @@ public class DeviceTypeConfiguration {
protected Claimable claimable; protected Claimable claimable;
@XmlElement(name = "Features", required = true) @XmlElement(name = "Features", required = true)
protected Features features; protected Features features;
@XmlElement(name = "PolicyUIConfigurations", required = true)
protected PolicyUIConfigurations policies;
@XmlElement(name = "ProvisioningConfig", required = true) @XmlElement(name = "ProvisioningConfig", required = true)
protected ProvisioningConfig provisioningConfig; protected ProvisioningConfig provisioningConfig;
@XmlElement(name = "PushNotificationProviderConfig", required = true) @XmlElement(name = "PushNotificationProviderConfig", required = true)
@ -256,6 +259,25 @@ public class DeviceTypeConfiguration {
this.features = value; this.features = value;
} }
/**
* Gets the value of the policies property.
*
* @return possible object is
* {@link PolicyUIConfigurations }
*/
public PolicyUIConfigurations getPolicyUIConfigurations() {
return policies;
}
/**
* Sets the value of the features property.
*
* @param value allowed object is
* {@link PolicyUIConfigurations }
*/
public void setPolicyUIConfigurations(PolicyUIConfigurations value) {
this.policies = value;
}
/** /**
* Gets the value of the provisioningConfig property. * Gets the value of the provisioningConfig property.
* *

@ -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;
}
}

@ -22,6 +22,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;

@ -34,15 +34,16 @@
*/ */
package org.wso2.carbon.policy.mgt.core.mock; package org.wso2.carbon.policy.mgt.core.mock;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.ui.policy.mgt.PolicyConfigurationManager;
import java.util.List; import java.util.List;
@ -53,6 +54,11 @@ public class TypeXDeviceManager implements DeviceManager {
return null; return null;
} }
@Override
public PolicyConfigurationManager getPolicyUIConfigurationManager() {
return null;
}
@Override @Override
public boolean saveConfiguration(PlatformConfiguration configuration) public boolean saveConfiguration(PlatformConfiguration configuration)
throws DeviceManagementException { throws DeviceManagementException {

Loading…
Cancel
Save