revert-70aa11f8
geethkokila 9 years ago
commit c039adf4ea

@ -35,11 +35,6 @@ public class License {
private Date validTo; private Date validTo;
private String text; private String text;
public License() {
this.validTo = new Date();
this.validFrom = new Date();
}
@XmlElement(name = "Provider", required = true) @XmlElement(name = "Provider", required = true)
public String getProvider() { public String getProvider() {
return provider; return provider;

@ -36,6 +36,7 @@ import java.lang.String;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale; import java.util.Locale;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ -79,10 +80,10 @@ public class RegistryBasedLicenseManager implements LicenseManager {
return this.populateLicense(artifacts[0]); return this.populateLicense(artifacts[0]);
} catch (GovernanceException e) { } catch (GovernanceException e) {
throw new LicenseManagementException("Error occurred while retrieving license corresponding to " + throw new LicenseManagementException("Error occurred while retrieving license corresponding to " +
"device type '" + deviceType + "'"); "device type '" + deviceType + "'", e);
} catch (ParseException e) { } catch (ParseException e) {
throw new LicenseManagementException("Error occurred while parsing the ToDate/FromDate date string " + throw new LicenseManagementException("Error occurred while parsing the ToDate/FromDate date string " +
"of the license configured upon the device type '" + deviceType + "'"); "of the license configured upon the device type '" + deviceType + "'", e);
} }
} }
@ -115,10 +116,14 @@ public class RegistryBasedLicenseManager implements LicenseManager {
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.PROVIDER, license.getProvider()); artifact.setAttribute(DeviceManagementConstants.LicenseProperties.PROVIDER, license.getProvider());
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.LANGUAGE, license.getLanguage()); artifact.setAttribute(DeviceManagementConstants.LicenseProperties.LANGUAGE, license.getLanguage());
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.TEXT, license.getText()); artifact.setAttribute(DeviceManagementConstants.LicenseProperties.TEXT, license.getText());
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VALID_TO, Date validTo = license.getValidTo();
license.getValidTo().toString()); if (validTo != null) {
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VALID_FROM, artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VALID_TO, validTo.toString());
license.getValidFrom().toString()); }
Date validFrom = license.getValidFrom();
if (validFrom != null) {
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VALID_FROM, validFrom.toString());
}
artifactManager.addGenericArtifact(artifact); artifactManager.addGenericArtifact(artifact);
} catch (GovernanceException e) { } catch (GovernanceException e) {
throw new LicenseManagementException("Error occurred while adding license for device type " + throw new LicenseManagementException("Error occurred while adding license for device type " +

Loading…
Cancel
Save