diff options
author | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2018-07-23 12:10:41 +0200 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-08-09 18:01:41 +0000 |
commit | 5008b80497d3256b724d54e0b26ad398f050571e (patch) | |
tree | 2cba735259e1ff33d6d5b647d10de253403152c2 /appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org | |
parent | dc87c8cea2a6b6f68a8d7521db325fec4319b71a (diff) |
Improve LicenseManagerImpl implementation
- Use STAX API for XML processing instead of parsing it manually
- Rearrange code for clarity and testing
- Adjust JUnits accordingly
Issue-ID: APPC-1024
Change-Id: I9d655b581adb401b0c20bc29eda6a2bce1f2ef89
Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Diffstat (limited to 'appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org')
2 files changed, 54 insertions, 12 deletions
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/onap/appc/licmgr/objects/LicenseModel.java b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/onap/appc/licmgr/objects/LicenseModel.java index 070acdfd4..51257378e 100644 --- a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/onap/appc/licmgr/objects/LicenseModel.java +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/onap/appc/licmgr/objects/LicenseModel.java @@ -6,6 +6,8 @@ * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= + * Modifications Copyright (C) 2018 Nokia + * ============================================================================= * Licensed 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 @@ -23,25 +25,20 @@ package org.onap.appc.licmgr.objects; -public class LicenseModel { +public final class LicenseModel { - private String entitlementPoolUuid; + private final String entitlementPoolUuid; + private final String licenseKeyGroupUuid; - private String licenseKeyGroupUuid; + public LicenseModel(String entitlementPoolUuid, String licenseKeyGroupUuid){ + this.entitlementPoolUuid = entitlementPoolUuid; + this.licenseKeyGroupUuid = licenseKeyGroupUuid; + } public String getEntitlementPoolUuid() { return entitlementPoolUuid; } - - public void setEntitlementPoolUuid(String entitlementPoolUuid) { - this.entitlementPoolUuid = entitlementPoolUuid; - } - public String getLicenseKeyGroupUuid() { return licenseKeyGroupUuid; } - - public void setLicenseKeyGroupUuid(String licenseKeyGroupUuid) { - this.licenseKeyGroupUuid = licenseKeyGroupUuid; - } } diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/onap/appc/licmgr/objects/LicenseModelBuilder.java b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/onap/appc/licmgr/objects/LicenseModelBuilder.java new file mode 100644 index 000000000..44f8a1383 --- /dev/null +++ b/appc-dispatcher/appc-license-manager/appc-license-manager-api/src/main/java/org/onap/appc/licmgr/objects/LicenseModelBuilder.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2018 Nokia + * ============================================================================= + * Licensed 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. + * + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.licmgr.objects; + +public class LicenseModelBuilder { + private String entitlementPoolUuid; + private String licenseKeyGroupUuid; + + public LicenseModelBuilder setEntitlementPoolUuid(String entitlementPoolUuid){ + this.entitlementPoolUuid = entitlementPoolUuid; + return this; + } + + public LicenseModelBuilder setLicenseKeyGroupUuid(String licenseKeyGroupUuid){ + this.licenseKeyGroupUuid = licenseKeyGroupUuid; + return this; + } + + public boolean isReady() { + return entitlementPoolUuid != null && licenseKeyGroupUuid != null; + } + + public LicenseModel build(){ + return new LicenseModel(entitlementPoolUuid, licenseKeyGroupUuid); + } +} |