diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java index 7d26890f80d..69f95923e85 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java @@ -69,6 +69,7 @@ public final class DeviceManagementConstants { public static final String VALID_TO = "overview_validityTo"; public static final String TEXT = "overview_license"; public static final String LICENSE_REGISTRY_KEY = "license"; + public static final String ARTIFACT_NAME = "name"; } public static final class NotificationProperties { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 5ef446da40d..b96b3d4b5fe 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -71,7 +71,8 @@ org.wso2.carbon.registry.core.exceptions, org.wso2.carbon.registry.core.session, javax.xml.bind, - org.wso2.carbon.utils + org.wso2.carbon.utils, + org.apache.commons.logging diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/registry/RegistryBasedLicenseManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/registry/RegistryBasedLicenseManager.java index 60528675b4b..7eb9f200a13 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/registry/RegistryBasedLicenseManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/registry/RegistryBasedLicenseManager.java @@ -69,7 +69,7 @@ public class RegistryBasedLicenseManager implements LicenseManager { GenericArtifact artifact = this.getGenericArtifact(deviceType, languageCode); if (artifact == null) { if (log.isDebugEnabled()) { - log.debug("Generic artifact is null for '" + deviceType + "' device type, Hence license does not " + + log.debug("Generic artifact is null for '" + deviceType + "' device type. Hence license does not " + "have content"); } return null; @@ -109,7 +109,10 @@ public class RegistryBasedLicenseManager implements LicenseManager { try { GenericArtifact artifact = this.getGenericArtifact(deviceType, license.getLanguage()); if (artifact != null) { - + if (log.isDebugEnabled()) { + log.debug("Generic artifact is null for '" + deviceType + "' device type. Hence license does not " + + "have content"); + } return; } artifact = artifactManager.newGovernanceArtifact(new QName("http://www.wso2.com", deviceType)); @@ -118,7 +121,7 @@ public class RegistryBasedLicenseManager implements LicenseManager { artifact.setAttribute(DeviceManagementConstants.LicenseProperties.PROVIDER, license.getProvider()); artifact.setAttribute(DeviceManagementConstants.LicenseProperties.LANGUAGE, license.getLanguage()); artifact.setAttribute(DeviceManagementConstants.LicenseProperties.TEXT, license.getText()); - artifact.setAttribute("name", license.getName()); + artifact.setAttribute(DeviceManagementConstants.LicenseProperties.ARTIFACT_NAME, license.getName()); Date validTo = license.getValidTo(); if (validTo != null) { artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VALID_TO, validTo.toString()); @@ -147,7 +150,7 @@ public class RegistryBasedLicenseManager implements LicenseManager { equalsIgnoreCase(deviceType) && attributeLangVal.equalsIgnoreCase(languageCode)); } }); - return (artifacts == null || artifacts.length < 1) ? null : artifacts[0]; + return (artifacts == null || artifacts.length == 0) ? null : artifacts[0]; } }