Add storeVisibilityEnabled flag to plugin device types

Bug#10494
commit 889cb5b82e

@ -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.pull.notification.PullNotificationSubscriber;
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;
/**
@ -65,4 +66,6 @@ public interface DeviceManagementService {
DeviceEnrollmentInvitationDetails getDeviceEnrollmentInvitationDetails();
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) {
/* Initializing Device Management Service Provider */
provider.init();
DeviceTypeMetaDefinition deviceTypeDefinition = null;
DeviceTypeMetaDefinition deviceTypeDefinition;
if (provider instanceof DeviceTypeDefinitionProvider) {
DeviceTypeServiceIdentifier deviceTypeIdentifier = new DeviceTypeServiceIdentifier(
provider.getType());
@ -102,6 +102,8 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
if (existingProvider != null) {
removeDeviceManagementProvider(provider);
}
} else {
deviceTypeDefinition = provider.getDeviceTypeMetaDefinition();
}
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.push.notification.PushNotificationConfig;
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 java.util.ArrayList;
@ -135,4 +136,9 @@ public class TestDeviceManagementService implements DeviceManagementService {
}
@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;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDetails;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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.push.notification.PushNotificationConfig;
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.extensions.device.type.template.config.ConfigProperties;
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 DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails;
private GeneralConfig generalConfig;
private DeviceTypeMetaDefinition deviceTypeMetaDefinition;
private boolean isRegistryBasedConfigs = false;
private boolean isScheduled = false;
private String notifierType;
@ -108,6 +111,8 @@ public class DeviceTypeManagerService implements DeviceManagementService {
this.setDeviceEnrollmentInvitationDetails(deviceTypeConfiguration);
this.licenseConfig = new License();
this.setLicenseConfig(deviceTypeConfiguration);
this.deviceTypeMetaDefinition = new DeviceTypeMetaDefinition();
this.setDeviceTypeMetaDefinition(deviceTypeConfiguration);
}
@Override
@ -261,6 +266,11 @@ public class DeviceTypeManagerService implements DeviceManagementService {
return licenseConfig;
}
@Override
public DeviceTypeMetaDefinition getDeviceTypeMetaDefinition() {
return deviceTypeMetaDefinition;
}
private void setProvisioningConfig(String tenantDomain, DeviceTypeConfiguration deviceTypeConfiguration) {
if (deviceTypeConfiguration.getProvisioningConfig() != null) {
boolean sharedWithAllTenants = deviceTypeConfiguration.getProvisioningConfig().isSharedWithAllTenants();
@ -388,4 +398,11 @@ public class DeviceTypeManagerService implements DeviceManagementService {
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;
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 javax.xml.bind.annotation.XmlElement;
@ -93,6 +94,8 @@ public class DeviceTypeConfiguration {
protected DeviceTypePlatformDetails deviceTypePlatformDetails;
@XmlElement(name = "DeviceEnrollmentInvitationDetails", required = true)
protected DeviceEnrollmentInvitationDetails deviceEnrollmentInvitationDetails;
@XmlElement(name = "DeviceTypeMetaDetails")
protected DeviceTypeMetaDetails deviceTypeMetaDetails;
public DeviceTypePlatformDetails getDeviceTypePlatformDetails() {
return deviceTypePlatformDetails;
@ -417,4 +420,12 @@ public class DeviceTypeConfiguration {
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.push.notification.PushNotificationConfig;
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 java.util.ArrayList;
@ -124,4 +125,9 @@ public class TypeXDeviceManagementService implements DeviceManagementService {
@Override
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.push.notification.PushNotificationConfig;
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 java.util.ArrayList;
@ -118,4 +119,9 @@ public class TypeXDeviceManagementService implements DeviceManagementService {
@Override
public License getLicenseConfig() { return null; }
@Override
public DeviceTypeMetaDefinition getDeviceTypeMetaDefinition() {
return null;
}
}

Loading…
Cancel
Save