diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/invitation/mgt/DeviceEnrollmentInvitationDetails.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/invitation/mgt/DeviceEnrollmentInvitationDetails.java new file mode 100644 index 0000000000..3882d47293 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/invitation/mgt/DeviceEnrollmentInvitationDetails.java @@ -0,0 +1,25 @@ +package org.wso2.carbon.device.mgt.common.invitation.mgt; + +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.List; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "DeviceEnrollmentInvitationDetails", propOrder = { + "enrollmentDetails" +}) +public class DeviceEnrollmentInvitationDetails { + + @XmlElement(name = "EnrollmentDetails") + private List enrollmentDetails; + + public List getEnrollmentDetails() { + return enrollmentDetails; + } + + public void setEnrollmentDetails(List enrollmentDetails) { + this.enrollmentDetails = enrollmentDetails; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/invitation/mgt/EnrollmentDetails.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/invitation/mgt/EnrollmentDetails.java new file mode 100644 index 0000000000..905022440b --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/invitation/mgt/EnrollmentDetails.java @@ -0,0 +1,36 @@ +package org.wso2.carbon.device.mgt.common.invitation.mgt; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "EnrollmentDetails", propOrder = { + "enrollmentType", + "enrollmentSteps" +}) +public class EnrollmentDetails { + + @XmlElement(name = "EnrollmentType") + private String enrollmentType; + + @XmlElement(name = "EnrollmentSteps") + private String enrollmentSteps; + + public String getEnrollmentType() { + return enrollmentType; + } + + public void setEnrollmentType(String enrollmentType) { + this.enrollmentType = enrollmentType; + } + + public String getEnrollmentSteps() { + return enrollmentSteps; + } + + public void setEnrollmentSteps(String enrollmentSteps) { + this.enrollmentSteps = enrollmentSteps; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagementService.java index 25303cf966..e6f33f85de 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagementService.java @@ -38,6 +38,7 @@ import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.general.GeneralConfig; +import org.wso2.carbon.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; @@ -77,4 +78,6 @@ public interface DeviceManagementService { DeviceTypePlatformDetails getDeviceTypePlatformDetails(); + DeviceEnrollmentInvitationDetails getDeviceEnrollmentInvitationDetails(); + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java index 67b79bfeb4..5896039d99 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java @@ -48,6 +48,7 @@ import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.general.GeneralConfig; +import org.wso2.carbon.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; @@ -92,6 +93,7 @@ public class DeviceTypeManagerService implements DeviceManagementService { private PullNotificationSubscriber pullNotificationSubscriber; private final DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig; private DeviceTypePlatformDetails deviceTypePlatformDetails; + private DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails; private GeneralConfig generalConfig; private boolean isRegistryBasedConfigs = false; private boolean isScheduled = false; @@ -116,6 +118,8 @@ public class DeviceTypeManagerService implements DeviceManagementService { this.setPolicyMonitoringManager(deviceTypeConfiguration.getPolicyMonitoring()); this.setPullNotificationSubscriber(deviceTypeConfiguration.getPullNotificationSubscriberConfig()); this.setGeneralConfig(deviceTypeConfiguration); + this.deviceEnrollmentInvitationDetails = new DeviceEnrollmentInvitationDetails(); + this.setDeviceEnrollmentInvitationDetails(deviceTypeConfiguration); } @Override @@ -259,6 +263,11 @@ public class DeviceTypeManagerService implements DeviceManagementService { return generalConfig; } + @Override + public DeviceEnrollmentInvitationDetails getDeviceEnrollmentInvitationDetails() { + return deviceEnrollmentInvitationDetails; + } + private void setProvisioningConfig(String tenantDomain, DeviceTypeConfiguration deviceTypeConfiguration) { if (deviceTypeConfiguration.getProvisioningConfig() != null) { boolean sharedWithAllTenants = deviceTypeConfiguration.getProvisioningConfig().isSharedWithAllTenants(); @@ -354,4 +363,13 @@ public class DeviceTypeManagerService implements DeviceManagementService { deviceTypePlatformDetails.setDeviceTypePlatformVersion(deviceTypeVersions.getDeviceTypePlatformVersion()); } } + + public void setDeviceEnrollmentInvitationDetails(DeviceTypeConfiguration deviceTypeConfiguration) { + DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetailsFromConfig = deviceTypeConfiguration + .getDeviceEnrollmentInvitationDetails(); + if (deviceEnrollmentInvitationDetailsFromConfig != null) { + deviceEnrollmentInvitationDetails.setEnrollmentDetails( + deviceEnrollmentInvitationDetailsFromConfig.getEnrollmentDetails()); + } + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/DeviceTypeConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/DeviceTypeConfiguration.java index f1c470829e..098baec3e3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/DeviceTypeConfiguration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/DeviceTypeConfiguration.java @@ -34,6 +34,7 @@ */ package org.wso2.carbon.device.mgt.extensions.device.type.template.config; +import org.wso2.carbon.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails; import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypePlatformDetails; import javax.xml.bind.annotation.XmlElement; @@ -107,6 +108,8 @@ public class DeviceTypeConfiguration { protected List operations; @XmlElement(name = "DeviceTypePlatformDetails", required = true) protected DeviceTypePlatformDetails deviceTypePlatformDetails; + @XmlElement(name = "DeviceEnrollmentInvitationDetails", required = true) + protected DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails; public DeviceTypePlatformDetails getDeviceTypePlatformDetails() { return deviceTypePlatformDetails; @@ -414,4 +417,21 @@ public class DeviceTypeConfiguration { public void setStartupOperations(List startupOperations) { this.startupOperations = startupOperations; } + + /** + * Gets the value of device enrollment invitation details which has enrollment steps of enrollment types + * @return device enrollment invitation details + */ + public DeviceEnrollmentInvitationDetails getDeviceEnrollmentInvitationDetails() { + return deviceEnrollmentInvitationDetails; + } + + /** + * Sets the value of device enrollment invitation details from the relevant device type xml file + * @param deviceEnrollmentInvitationDetails {@link DeviceEnrollmentInvitationDetails} object + */ + public void setDeviceEnrollmentInvitationDetails( + DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails) { + this.deviceEnrollmentInvitationDetails = deviceEnrollmentInvitationDetails; + } }