Implement retrieval of DeviceEnrollmentInvitationDetails from device type xml files

revert-70ac1926
Saad Sahibjan 4 years ago
parent d97de23ece
commit d2ab4c6710

@ -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> enrollmentDetails;
public List<EnrollmentDetails> getEnrollmentDetails() {
return enrollmentDetails;
}
public void setEnrollmentDetails(List<EnrollmentDetails> enrollmentDetails) {
this.enrollmentDetails = enrollmentDetails;
}
}

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

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

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

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

Loading…
Cancel
Save