Add storeVisibilityEnabled flag to plugin device types

cloud-mgt-mails
Navod Zoysa 1 year ago
parent 8d92265eb3
commit e8dd6942ad

@ -26,6 +26,7 @@ import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License;
import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringManager; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringManager;
import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber; import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber;
import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails;
/** /**
@ -65,4 +66,6 @@ public interface DeviceManagementService {
DeviceEnrollmentInvitationDetails getDeviceEnrollmentInvitationDetails(); DeviceEnrollmentInvitationDetails getDeviceEnrollmentInvitationDetails();
License getLicenseConfig(); License getLicenseConfig();
DeviceTypeMetaDefinition getDeviceTypeMetaDefinition();
} }

@ -0,0 +1,43 @@
/*
* Copyright (c) 2018 - 2023, 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 io.entgra.device.mgt.core.device.mgt.common.type.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 = "DeviceTypeMetaDetails", propOrder = {
"storeVisibilityEnabled"
})
public class DeviceTypeMetaDetails {
@XmlElement(name = "storeVisibilityEnabled")
private boolean storeVisibilityEnabled;
public boolean isStoreVisibilityEnabled() {
return storeVisibilityEnabled;
}
public void setStoreVisibilityEnabled(boolean storeVisibilityEnabled) {
this.storeVisibilityEnabled = storeVisibilityEnabled;
}
}

@ -85,7 +85,7 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
if (isInitiated) { if (isInitiated) {
/* Initializing Device Management Service Provider */ /* Initializing Device Management Service Provider */
provider.init(); provider.init();
DeviceTypeMetaDefinition deviceTypeDefinition = null; DeviceTypeMetaDefinition deviceTypeDefinition;
if (provider instanceof DeviceTypeDefinitionProvider) { if (provider instanceof DeviceTypeDefinitionProvider) {
DeviceTypeServiceIdentifier deviceTypeIdentifier = new DeviceTypeServiceIdentifier( DeviceTypeServiceIdentifier deviceTypeIdentifier = new DeviceTypeServiceIdentifier(
provider.getType()); provider.getType());
@ -102,6 +102,8 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
if (existingProvider != null) { if (existingProvider != null) {
removeDeviceManagementProvider(provider); removeDeviceManagementProvider(provider);
} }
} else {
deviceTypeDefinition = provider.getDeviceTypeMetaDefinition();
} }
DeviceManagerUtil.registerDeviceType(deviceType, tenantId, isSharedWithAllTenants, deviceTypeDefinition); DeviceManagerUtil.registerDeviceType(deviceType, tenantId, isSharedWithAllTenants, deviceTypeDefinition);

@ -27,6 +27,7 @@ import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringMa
import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber; import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber;
import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig;
import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails;
import java.util.ArrayList; import java.util.ArrayList;
@ -135,4 +136,9 @@ public class TestDeviceManagementService implements DeviceManagementService {
} }
@Override public License getLicenseConfig() { return null; } @Override public License getLicenseConfig() { return null; }
@Override
public DeviceTypeMetaDefinition getDeviceTypeMetaDefinition() {
return null;
}
} }

@ -17,6 +17,7 @@
*/ */
package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDetails;
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.context.CarbonContext; import org.wso2.carbon.context.CarbonContext;
@ -38,6 +39,7 @@ import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringMa
import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber; import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber;
import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig;
import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails;
import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.ConfigProperties; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.ConfigProperties;
import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceStatusTaskConfiguration; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceStatusTaskConfiguration;
@ -81,6 +83,7 @@ public class DeviceTypeManagerService implements DeviceManagementService {
private DeviceTypePlatformDetails deviceTypePlatformDetails; private DeviceTypePlatformDetails deviceTypePlatformDetails;
private DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails; private DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails;
private GeneralConfig generalConfig; private GeneralConfig generalConfig;
private DeviceTypeMetaDefinition deviceTypeMetaDefinition;
private boolean isRegistryBasedConfigs = false; private boolean isRegistryBasedConfigs = false;
private boolean isScheduled = false; private boolean isScheduled = false;
private String notifierType; private String notifierType;
@ -108,6 +111,8 @@ public class DeviceTypeManagerService implements DeviceManagementService {
this.setDeviceEnrollmentInvitationDetails(deviceTypeConfiguration); this.setDeviceEnrollmentInvitationDetails(deviceTypeConfiguration);
this.licenseConfig = new License(); this.licenseConfig = new License();
this.setLicenseConfig(deviceTypeConfiguration); this.setLicenseConfig(deviceTypeConfiguration);
this.deviceTypeMetaDefinition = new DeviceTypeMetaDefinition();
this.setDeviceTypeMetaDefinition(deviceTypeConfiguration);
} }
@Override @Override
@ -261,6 +266,11 @@ public class DeviceTypeManagerService implements DeviceManagementService {
return licenseConfig; return licenseConfig;
} }
@Override
public DeviceTypeMetaDefinition getDeviceTypeMetaDefinition() {
return deviceTypeMetaDefinition;
}
private void setProvisioningConfig(String tenantDomain, DeviceTypeConfiguration deviceTypeConfiguration) { private void setProvisioningConfig(String tenantDomain, DeviceTypeConfiguration deviceTypeConfiguration) {
if (deviceTypeConfiguration.getProvisioningConfig() != null) { if (deviceTypeConfiguration.getProvisioningConfig() != null) {
boolean sharedWithAllTenants = deviceTypeConfiguration.getProvisioningConfig().isSharedWithAllTenants(); boolean sharedWithAllTenants = deviceTypeConfiguration.getProvisioningConfig().isSharedWithAllTenants();
@ -388,4 +398,11 @@ public class DeviceTypeManagerService implements DeviceManagementService {
licenseConfig.setText(license.getText()); licenseConfig.setText(license.getText());
} }
} }
public void setDeviceTypeMetaDefinition(DeviceTypeConfiguration deviceTypeConfiguration) {
DeviceTypeMetaDetails deviceTypeMetaDefinitions = deviceTypeConfiguration.getDeviceTypeMetaDetails();
if (deviceTypeMetaDefinitions != null) {
deviceTypeMetaDefinition.setStoreVisibilityEnabled(deviceTypeMetaDefinitions.isStoreVisibilityEnabled());
}
}
} }

@ -18,6 +18,7 @@
package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config;
import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails; import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDetails;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -93,6 +94,8 @@ public class DeviceTypeConfiguration {
protected DeviceTypePlatformDetails deviceTypePlatformDetails; protected DeviceTypePlatformDetails deviceTypePlatformDetails;
@XmlElement(name = "DeviceEnrollmentInvitationDetails", required = true) @XmlElement(name = "DeviceEnrollmentInvitationDetails", required = true)
protected DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails; protected DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails;
@XmlElement(name = "DeviceTypeMetaDetails")
protected DeviceTypeMetaDetails deviceTypeMetaDetails;
public DeviceTypePlatformDetails getDeviceTypePlatformDetails() { public DeviceTypePlatformDetails getDeviceTypePlatformDetails() {
return deviceTypePlatformDetails; return deviceTypePlatformDetails;
@ -417,4 +420,12 @@ public class DeviceTypeConfiguration {
DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails) { DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails) {
this.deviceEnrollmentInvitationDetails = deviceEnrollmentInvitationDetails; this.deviceEnrollmentInvitationDetails = deviceEnrollmentInvitationDetails;
} }
public DeviceTypeMetaDetails getDeviceTypeMetaDetails() {
return deviceTypeMetaDetails;
}
public void setDeviceTypeMetaDetails(DeviceTypeMetaDetails deviceTypeMetaDetails) {
this.deviceTypeMetaDetails = deviceTypeMetaDetails;
}
} }

@ -33,6 +33,7 @@ import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringMa
import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber; import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber;
import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig;
import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails;
import java.util.ArrayList; import java.util.ArrayList;
@ -124,4 +125,9 @@ public class TypeXDeviceManagementService implements DeviceManagementService {
@Override @Override
public License getLicenseConfig() { return null; } public License getLicenseConfig() { return null; }
@Override
public DeviceTypeMetaDefinition getDeviceTypeMetaDefinition() {
return null;
}
} }

@ -27,6 +27,7 @@ import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringMa
import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber; import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber;
import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig;
import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails;
import java.util.ArrayList; import java.util.ArrayList;
@ -118,4 +119,9 @@ public class TypeXDeviceManagementService implements DeviceManagementService {
@Override @Override
public License getLicenseConfig() { return null; } public License getLicenseConfig() { return null; }
@Override
public DeviceTypeMetaDefinition getDeviceTypeMetaDefinition() {
return null;
}
} }

Loading…
Cancel
Save