summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java90
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/ActivityLog.java55
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/services/ActivityLogImpl.java65
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/ApplicationConfiguration.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java4
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/pom.xml58
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/Conflicts.java61
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictInfoToDto.java14
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDto.java134
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapDtoToConflictResolution.java15
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDto.java22
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/services/ConflictsImpl.java62
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/pom.xml22
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictDto.java24
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictInfoDto.java33
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictResolutionDto.java27
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ItemVersionConflictDto.java29
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/pom.xml35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/HealthCheck.java10
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java81
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/pom.xml68
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/ItemPermissions.java53
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/mapping/MapItemPermissionsToItemPermissionsDto.java20
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services/ItemPermissionsImpl.java52
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/pom.xml24
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/main/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsDto.java27
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/main/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsRequestDto.java32
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/pom.xml (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/pom.xml)18
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/pom.xml)47
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java88
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapActivityLogEntityToDto.java (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/mapping/MapActivityLogEntityToActivityLogDto.java)27
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapItemToDto.java15
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapRevisionToDto.java15
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapVersionToDto.java20
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java270
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/pom.xml34
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/src/main/java/org/openecomp/sdcrests/activitylog/types/ActivityLogDto.java)86
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityStatus.java (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/src/main/java/org/openecomp/sdcrests/activitylog/types/ActivityStatus.java)2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java13
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java22
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java40
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java43
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionRequestDto.java14
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java13
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionAction.java (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspCreationDto.java)24
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionActionRequestDto.java52
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java94
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java24
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/pom.xml (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/pom.xml)15
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml161
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/java/org/openecomp/server/listeners/OnboardingAppStartupListener.java (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToGetFileDataStructureResponseDto.java)35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/resources/keyfile.txt27
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/beans-services.xml67
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/jetty-web.xml8
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/spring-mapper-servlet.xml12
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/web.xml81
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/pom.xml56
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsStatusToDto.java64
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsToDto.java57
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/Notifications.java94
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/impl/NotificationsImpl.java117
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/pom.xml23
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDto.java91
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationResponseStatus.java (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToVspCreationDto.java)18
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDto.java61
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatus.java65
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/pom.xml24
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml32
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java45
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml23
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml13
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml34
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/common/RestConstants.java4
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/common/types/VersionDto.java34
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/EchoMapMapping.java14
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/EchoMapping.java8
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java4
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml17
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPoolLimits.java46
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java33
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java124
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDto.java (renamed from openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/src/main/java/org/openecomp/sdcrests/activitylog/types/ActivityType.java)39
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java64
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java113
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java20
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java16
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java116
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java16
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java348
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml24
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupEntityDto.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementEntityDto.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/MultiChoiceOrOtherDto.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelActionRequestDto.java21
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelEntityDto.java49
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencies.java87
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencyModels.java50
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java10
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Compute.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/DeploymentFlavors.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Images.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java3
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java36
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProductsForSwaggerFileUpload.java7
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VspEntities.java21
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToCreationDto.java16
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToDto.java18
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToDto.java17
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDto.java1
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDto.java18
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireToQuestionnaireDto.java21
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java33
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java83
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItem.java16
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java13
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDto.java53
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependenciesImpl.java119
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependencyModelsImpl.java78
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentMonitoringUploadsImpl.java23
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImpl.java77
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java45
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImpl.java88
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImpl.java43
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImpl.java85
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImpl.java24
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java60
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java71
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java36
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java582
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VspItemProperty.java7
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml5
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyCreationDto.java13
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyResponseDto.java41
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/FileDataStructureDto.java69
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/OnboardingMethod.java6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/QuestionnaireDto.java30
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VendorSoftwareProductAction.java3
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VersionSoftwareProductActionRequestDto.java11
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java36
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java63
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspRequestDto.java16
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/IsValidJson.java16
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/StringValidator.java4
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/ValidateString.java12
158 files changed, 4877 insertions, 1811 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java
index 5dc79ebdfe..5a7232bdd6 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java
@@ -26,7 +26,6 @@ import io.swagger.annotations.ApiOperation;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.springframework.validation.annotation.Validated;
-import java.io.InputStream;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.HeaderParam;
@@ -38,6 +37,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import java.io.InputStream;
@Path("/workflow/v1.0/actions")
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java
index 875b51548e..b186852bfd 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java
@@ -31,7 +31,11 @@ import org.openecomp.sdc.action.errors.ActionErrorConstants;
import org.openecomp.sdc.action.errors.ActionException;
import org.openecomp.sdc.action.logging.CategoryLogLevel;
import org.openecomp.sdc.action.logging.StatusCode;
-import org.openecomp.sdc.action.types.*;
+import org.openecomp.sdc.action.types.Action;
+import org.openecomp.sdc.action.types.ActionArtifact;
+import org.openecomp.sdc.action.types.ActionArtifactProtection;
+import org.openecomp.sdc.action.types.ActionRequest;
+import org.openecomp.sdc.action.types.OpenEcompComponent;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdcrests.action.rest.Actions;
@@ -53,11 +57,85 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.*;
-
-import static org.openecomp.sdc.action.ActionConstants.*;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.*;
-import static org.openecomp.sdc.action.util.ActionUtil.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.openecomp.sdc.action.ActionConstants.ACTION_REQUEST_PARAM_NAME;
+import static org.openecomp.sdc.action.ActionConstants.ACTION_REQUEST_PARAM_SUPPORTED_MODELS;
+import static org.openecomp.sdc.action.ActionConstants.ARTIFACT_FILE;
+import static org.openecomp.sdc.action.ActionConstants.ARTIFACT_NAME;
+import static org.openecomp.sdc.action.ActionConstants.BE_FQDN;
+import static org.openecomp.sdc.action.ActionConstants.CATEGORY_LOG_LEVEL;
+import static org.openecomp.sdc.action.ActionConstants.CLIENT_IP;
+import static org.openecomp.sdc.action.ActionConstants.ERROR_DESCRIPTION;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NAME;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NONE;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_VENDOR;
+import static org.openecomp.sdc.action.ActionConstants.INSTANCE_UUID;
+import static org.openecomp.sdc.action.ActionConstants.LOCAL_ADDR;
+import static org.openecomp.sdc.action.ActionConstants.MAX_ACTION_ARTIFACT_SIZE;
+import static org.openecomp.sdc.action.ActionConstants.MDC_ASDC_INSTANCE_UUID;
+import static org.openecomp.sdc.action.ActionConstants.PARTNER_NAME;
+import static org.openecomp.sdc.action.ActionConstants.REMOTE_HOST;
+import static org.openecomp.sdc.action.ActionConstants.REQUEST_EMPTY_BODY;
+import static org.openecomp.sdc.action.ActionConstants.REQUEST_ID;
+import static org.openecomp.sdc.action.ActionConstants.REQUEST_TYPE_CREATE_ACTION;
+import static org.openecomp.sdc.action.ActionConstants.REQUEST_TYPE_UPDATE_ACTION;
+import static org.openecomp.sdc.action.ActionConstants.REQUEST_TYPE_VERSION_ACTION;
+import static org.openecomp.sdc.action.ActionConstants.SERVICE_INSTANCE_ID;
+import static org.openecomp.sdc.action.ActionConstants.SERVICE_METRIC_BEGIN_TIMESTAMP;
+import static org.openecomp.sdc.action.ActionConstants.SERVICE_NAME;
+import static org.openecomp.sdc.action.ActionConstants.STATUS;
+import static org.openecomp.sdc.action.ActionConstants.STATUS_CODE;
+import static org.openecomp.sdc.action.ActionConstants.SUPPORTED_COMPONENTS_ID;
+import static org.openecomp.sdc.action.ActionConstants.SUPPORTED_MODELS_VERSION_ID;
+import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY;
+import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_API;
+import static org.openecomp.sdc.action.ActionConstants.TARGET_SERVICE_NAME;
+import static org.openecomp.sdc.action.ActionConstants.TIMESTAMP;
+import static org.openecomp.sdc.action.ActionConstants.UPDATED_BY;
+import static org.openecomp.sdc.action.ActionConstants.X_OPEN_ECOMP_INSTANCE_ID_HEADER_PARAM;
+import static org.openecomp.sdc.action.ActionConstants.X_OPEN_ECOMP_REQUEST_ID_HEADER_PARAM;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_CHECKSUM_ERROR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_INVALID_NAME;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_INVALID_NAME_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_INVALID_PROTECTION_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_READ_FILE_ERROR;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_TOO_BIG_ERROR;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_TOO_BIG_ERROR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_FILTER_MULTIPLE_QUERY_PARAM_NOT_SUPPORTED;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_INSTANCE_ID_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_PARAM_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_REQUEST_BODY_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_REQUEST_ID_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_SEARCH_CRITERIA;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_MULT_SEARCH_CRITERIA;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_ARTIFACT_CHECKSUM_ERROR;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_ARTIFACT_INVALID_PROTECTION_VALUE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_ARTIFACT_OPERATION_ALLOWED;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_BODY_EMPTY;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_CONTENT_TYPE_INVALID;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_FILTER_PARAM_INVALID;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_INVALID_GENERIC_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_INVALID_NAME;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_MISSING_MANDATORY_PARAM;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_OPEN_ECOMP_INSTANCE_ID_INVALID;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_OPEN_ECOMP_REQUEST_ID_INVALID;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UNSUPPORTED_OPERATION;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE;
+import static org.openecomp.sdc.action.util.ActionUtil.actionErrorLogProcessor;
+import static org.openecomp.sdc.action.util.ActionUtil.actionLogPostProcessor;
+import static org.openecomp.sdc.action.util.ActionUtil.getUtcDateStringFromTimestamp;
/**
* Implements various CRUD API that can be performed on Action
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/ActivityLog.java b/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/ActivityLog.java
deleted file mode 100644
index be4cc1bbf5..0000000000
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/ActivityLog.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.openecomp.sdcrests.activitylog.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.openecomp.sdcrests.activitylog.types.ActivityLogDto;
-import org.springframework.validation.annotation.Validated;
-
-import javax.validation.constraints.NotNull;
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
-
-@Path("/v1.0/activity-logs")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-@Api(value = "Item Activity Log")
-@Validated
-public interface ActivityLog {
-
- @GET
- @Path("/{itemId}/versions/{versionId}")
- @ApiOperation(value = "List actions log of item",
- response = ActivityLogDto.class,
- responseContainer = "List")
- Response getActivityLog(@ApiParam("Item Id") @PathParam("itemId") String itemId,
- @ApiParam("Version Id") @PathParam("versionId") String versionId,
- @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
- String user);
-
-}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/services/ActivityLogImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/services/ActivityLogImpl.java
deleted file mode 100644
index c42d72b7a5..0000000000
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/services/ActivityLogImpl.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.openecomp.sdcrests.activitylog.rest.services;
-
-import org.openecomp.sdc.activityLog.ActivityLogManager;
-import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
-import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
-import org.openecomp.sdc.logging.context.MdcUtil;
-import org.openecomp.sdc.logging.types.LoggerServiceName;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdcrests.activitylog.rest.ActivityLog;
-import org.openecomp.sdcrests.activitylog.rest.mapping.MapActivityLogEntityToActivityLogDto;
-import org.openecomp.sdcrests.activitylog.types.ActivityLogDto;
-import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Named;
-import javax.ws.rs.core.Response;
-import java.util.Collection;
-
-@Named
-@Service("activityLog")
-@Scope(value = "prototype")
-public class ActivityLogImpl implements ActivityLog {
-
- private ActivityLogManager activityLogManager =
- ActivityLogManagerFactory.getInstance().createInterface();
-
-
- @Override
- public Response getActivityLog(String vspId, String versionId, String user) {
- MdcUtil.initMdc(LoggerServiceName.Get_List_Activity_Log.toString());
-
- Collection<ActivityLogEntity> activityLogs =
- activityLogManager.listActivityLogs(vspId, Version.valueOf(versionId), user);
-
- MapActivityLogEntityToActivityLogDto mapper = new MapActivityLogEntityToActivityLogDto();
- GenericCollectionWrapper<ActivityLogDto> results = new GenericCollectionWrapper<>();
- for (ActivityLogEntity activityLog : activityLogs) {
- results.add(mapper.applyMapping(activityLog, ActivityLogDto.class));
- }
-
- return Response.ok(results).build();
- }
-}
-
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/ApplicationConfiguration.java b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/ApplicationConfiguration.java
index 6c95a14319..6042060480 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/ApplicationConfiguration.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/ApplicationConfiguration.java
@@ -26,7 +26,6 @@ import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.openecomp.sdcrests.applicationconfiguration.types.ConfigurationDataDto;
import org.springframework.validation.annotation.Validated;
-import java.io.InputStream;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -36,6 +35,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import java.io.InputStream;
@Path("/v1.0/application-configuration")
@Produces(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java
index c7f3f2598c..27557e1d56 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java
@@ -38,10 +38,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.io.InputStream;
-import java.util.Collection;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.io.InputStream;
+import java.util.Collection;
/**
* Created by Talio on 8/8/2016.
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/pom.xml
new file mode 100644
index 0000000000..534aea1a73
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>conflict-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>conflict-rest-services</artifactId>
+
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-common-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+ <!-- CXF -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-conflict-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>conflict-rest-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.onboarding</groupId>
+ <artifactId>vendor-software-products-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.onboarding</groupId>
+ <artifactId>vendor-license-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/Conflicts.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/Conflicts.java
new file mode 100644
index 0000000000..396c4ee5d2
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/Conflicts.java
@@ -0,0 +1,61 @@
+package org.openecomp.sdcrests.conflict.rest;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdcrests.common.RestConstants;
+import org.openecomp.sdcrests.conflict.types.ConflictDto;
+import org.openecomp.sdcrests.conflict.types.ConflictResolutionDto;
+import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("/v1.0/items/{itemId}/versions/{versionId}/conflicts")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Item Version Conflicts")
+@Validated
+public interface Conflicts {
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "item version conflicts",
+ notes = "Item version private copy conflicts against its public copy",
+ response = ItemVersionConflictDto.class)
+ Response getConflict(@ApiParam("Item Id") @PathParam("itemId") String itemId,
+ @ApiParam("Version Id") @PathParam("versionId") String versionId,
+ @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{conflictId}")
+ @ApiOperation(value = "Gets item version conflict",
+ notes = "Gets an item version private copy conflict against its public copy",
+ response = ConflictDto.class)
+ Response getConflict(@ApiParam("Item Id") @PathParam("itemId") String itemId,
+ @ApiParam("Version Id") @PathParam("versionId") String versionId,
+ @ApiParam("Version Id") @PathParam("conflictId") String conflictId,
+ @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{conflictId}")
+ @ApiOperation(value = "Resolves item version conflict",
+ notes = "Resolves an item version private copy conflict against its public copy")
+ Response resolveConflict(ConflictResolutionDto conflictResolution,
+ @ApiParam("Item Id") @PathParam("itemId") String itemId,
+ @ApiParam("Version Id") @PathParam("versionId") String versionId,
+ @ApiParam("Version Id") @PathParam("conflictId") String conflictId,
+ @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictInfoToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictInfoToDto.java
new file mode 100644
index 0000000000..e80ef5653d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictInfoToDto.java
@@ -0,0 +1,14 @@
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+import org.openecomp.conflicts.types.ConflictInfo;
+import org.openecomp.sdcrests.conflict.types.ConflictInfoDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapConflictInfoToDto extends MappingBase<ConflictInfo, ConflictInfoDto> {
+ @Override
+ public void doMapping(ConflictInfo source, ConflictInfoDto target) {
+ target.setId(source.getId());
+ target.setType(source.getType());
+ target.setName(source.getName());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDto.java
new file mode 100644
index 0000000000..83a0f52155
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDto.java
@@ -0,0 +1,134 @@
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+import org.openecomp.conflicts.types.Conflict;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.datatypes.model.ElementType;
+import org.openecomp.sdcrests.conflict.types.ConflictDto;
+import org.openecomp.sdcrests.mapping.EchoMapMapping;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapEntitlementPoolEntityToEntitlementPoolEntityDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapFeatureGroupEntityToFeatureGroupDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseAgreementEntityToLicenseAgreementDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitEntityToLimitDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVendorLicenseModelEntityToDto;
+import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModel;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.FileDataStructureDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentDependencyModelEntityToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentEntityToComponentDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComputeEntityToVspComputeDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapDeploymentFlavorEntityToDeploymentFlavorDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapFilesDataStructureToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapImageEntityToImageDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNetworkEntityToNetworkDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNicEntityToNicDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapProcessEntityToProcessEntityDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireToQuestionnaireDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapVspDetailsToDto;
+
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MapConflictToDto extends MappingBase<Conflict, ConflictDto> {
+
+ @Override
+ public void doMapping(Conflict source, ConflictDto target) {
+ target.setId(source.getId());
+ target.setType(source.getType());
+ target.setName(source.getName());
+
+ Map.Entry<MappingBase, Class> mapperToTargetClass = getMapper(source.getType());
+ target.setTheirs(map(mapperToTargetClass, source.getTheirs()));
+ target.setYours(map(mapperToTargetClass, source.getYours()));
+ }
+
+ private Map map(Map.Entry<MappingBase, Class> mapperToTargetClass, Object object) {
+ return JsonUtil
+ .json2Object(JsonUtil.object2Json(
+ mapperToTargetClass.getKey().applyMapping(object, mapperToTargetClass.getValue())),
+ Map.class);
+ }
+
+ private Map.Entry<MappingBase, Class> getMapper(ElementType type) {
+ switch (type) {
+ case VendorLicenseModel:
+ return new AbstractMap.SimpleEntry<>(new MapVendorLicenseModelEntityToDto(),
+ VendorLicenseModelEntityDto.class);
+ case LicenseAgreement:
+ return new AbstractMap.SimpleEntry<>(
+ new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto(),
+ LicenseAgreementDescriptorDto.class);
+ case FeatureGroup:
+ return new AbstractMap.SimpleEntry<>(new MapFeatureGroupEntityToFeatureGroupDescriptorDto(),
+ FeatureGroupDescriptorDto.class);
+ case LicenseKeyGroup:
+ return new AbstractMap.SimpleEntry<>(
+ new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(), LicenseKeyGroupEntityDto
+ .class);
+ case EntitlementPool:
+ return new AbstractMap.SimpleEntry<>(
+ new MapEntitlementPoolEntityToEntitlementPoolEntityDto(), EntitlementPoolEntityDto
+ .class);
+ case Limit:
+ return new AbstractMap.SimpleEntry<>(new MapLimitEntityToLimitDto(), LimitEntityDto.class);
+ case VendorSoftwareProduct:
+ return new AbstractMap.SimpleEntry<>(new MapVspDetailsToDto(), VspDetailsDto.class);
+ case Network:
+ return new AbstractMap.SimpleEntry<>(new MapNetworkEntityToNetworkDto(), NetworkDto.class);
+ case Component:
+ return new AbstractMap.SimpleEntry<>(new MapComponentEntityToComponentDto(),
+ ComponentDto.class);
+ case ComponentDependencies:
+ return new AbstractMap.SimpleEntry<>(new MapComponentDependencyModelEntityToDto(),
+ ComponentDependencyModel.class);
+ case Nic:
+ return new AbstractMap.SimpleEntry<>(new MapNicEntityToNicDto(), NicDto.class);
+ case Process:
+ return new AbstractMap.SimpleEntry<>(new MapProcessEntityToProcessEntityDto(),
+ ProcessEntityDto.class);
+ case DeploymentFlavor:
+ return new AbstractMap.SimpleEntry<>(new MapDeploymentFlavorEntityToDeploymentFlavorDto(),
+ DeploymentFlavorDto.class);
+ case Compute:
+ return new AbstractMap.SimpleEntry<>(new MapComputeEntityToVspComputeDto(),
+ VspComputeDto.class);
+ case Image:
+ return new AbstractMap.SimpleEntry<>(new MapImageEntityToImageDto(), ImageDto.class);
+ case VSPQuestionnaire:
+ case NicQuestionnaire:
+ case ComponentQuestionnaire:
+ case ImageQuestionnaire:
+ case ComputeQuestionnaire:
+ return new AbstractMap.SimpleEntry<>(new MapQuestionnaireToQuestionnaireDto(),
+ QuestionnaireDto.class);
+ case SNMP_POLL:
+ case SNMP_TRAP:
+ case VES_EVENTS:
+ case OrchestrationTemplateCandidate:
+ return new AbstractMap.SimpleEntry<>(new MapFilesDataStructureToDto(),
+ FileDataStructureDto.class);
+ case ServiceModel:
+ case NetworkPackage:
+ return new AbstractMap.SimpleEntry<>(new EchoMapMapping(), HashMap.class);
+ case itemVersion:
+ return new AbstractMap.SimpleEntry<>(new EchoMapMapping(), HashMap.class);
+ }
+ throw new RuntimeException("Get conflict does not support element type: " + type.name());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapDtoToConflictResolution.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapDtoToConflictResolution.java
new file mode 100644
index 0000000000..1a03a6b15e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapDtoToConflictResolution.java
@@ -0,0 +1,15 @@
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+import org.openecomp.conflicts.types.ConflictResolution;
+import org.openecomp.sdcrests.conflict.types.ConflictResolutionDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapDtoToConflictResolution
+ extends MappingBase<ConflictResolutionDto, ConflictResolution> {
+
+ @Override
+ public void doMapping(ConflictResolutionDto source, ConflictResolution target) {
+ target.setResolution(source.getResolution());
+ target.setOtherResolution(source.getOtherResolution());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDto.java
new file mode 100644
index 0000000000..fb5d013aba
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDto.java
@@ -0,0 +1,22 @@
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+
+import org.openecomp.conflicts.types.ItemVersionConflict;
+import org.openecomp.sdcrests.conflict.types.ConflictDto;
+import org.openecomp.sdcrests.conflict.types.ConflictInfoDto;
+import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapItemVersionConflictToDto
+ extends MappingBase<ItemVersionConflict, ItemVersionConflictDto> {
+
+ @Override
+ public void doMapping(ItemVersionConflict source, ItemVersionConflictDto target) {
+ target
+ .setConflict(new MapConflictToDto().applyMapping(source.getVersionConflict(), ConflictDto.class));
+
+ MapConflictInfoToDto conflictInfoMapper = new MapConflictInfoToDto();
+ source.getElementConflicts().forEach(conflictInfo -> target
+ .addConflictInfo(conflictInfoMapper.applyMapping(conflictInfo, ConflictInfoDto.class)));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/services/ConflictsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/services/ConflictsImpl.java
new file mode 100644
index 0000000000..fda12ef4c6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/main/java/org/openecomp/sdcrests/conflict/rest/services/ConflictsImpl.java
@@ -0,0 +1,62 @@
+package org.openecomp.sdcrests.conflict.rest.services;
+
+import org.openecomp.conflicts.types.Conflict;
+import org.openecomp.conflicts.types.ConflictResolution;
+import org.openecomp.conflicts.types.ItemVersionConflict;
+import org.openecomp.sdc.conflicts.ConflictsManager;
+import org.openecomp.sdc.conflicts.ConflictsManagerFactory;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.conflict.rest.Conflicts;
+import org.openecomp.sdcrests.conflict.rest.mapping.MapConflictToDto;
+import org.openecomp.sdcrests.conflict.rest.mapping.MapDtoToConflictResolution;
+import org.openecomp.sdcrests.conflict.rest.mapping.MapItemVersionConflictToDto;
+import org.openecomp.sdcrests.conflict.types.ConflictDto;
+import org.openecomp.sdcrests.conflict.types.ConflictResolutionDto;
+import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+@Named
+@Service("conflicts")
+@Scope(value = "prototype")
+public class ConflictsImpl implements Conflicts {
+
+ @Override
+ public Response getConflict(String itemId, String versionId, String user) {
+
+ ConflictsManager conflictsManager = ConflictsManagerFactory.getInstance().createInterface();
+ ItemVersionConflict itemVersionConflict = conflictsManager.getConflict
+ (itemId, new Version(versionId));
+ ItemVersionConflictDto result = (new MapItemVersionConflictToDto()).applyMapping
+ (itemVersionConflict, ItemVersionConflictDto.class);
+ return Response.ok(result).build();
+ }
+
+ @Override
+ public Response getConflict(String itemId, String versionId, String conflictId, String user) {
+ ConflictsManager conflictsManager = ConflictsManagerFactory.getInstance().createInterface();
+ Conflict conflict = conflictsManager.getConflict(itemId, new Version(versionId), conflictId);
+
+ ConflictDto result = new MapConflictToDto().applyMapping(conflict, ConflictDto.class);
+
+ return Response.ok(result).build();
+
+ }
+
+ @Override
+ public Response resolveConflict(ConflictResolutionDto conflictResolution, String itemId,
+ String versionId, String conflictId, String user) {
+ ConflictsManager conflictsManager = ConflictsManagerFactory.getInstance().createInterface();
+
+ Version version = new Version(versionId);
+ conflictsManager.resolveConflict(itemId, version, conflictId,
+ new MapDtoToConflictResolution()
+ .applyMapping(conflictResolution, ConflictResolution.class));
+ conflictsManager.finalizeMerge(itemId, version);
+
+ return Response.ok().build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/pom.xml
new file mode 100644
index 0000000000..e0169332c8
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/pom.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>conflict-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>conflict-rest-types</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-conflict-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictDto.java
new file mode 100644
index 0000000000..47f0abd794
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictDto.java
@@ -0,0 +1,24 @@
+package org.openecomp.sdcrests.conflict.types;
+
+import java.util.Map;
+
+public class ConflictDto extends ConflictInfoDto {
+ private Map<String, Object> yours;
+ private Map<String, Object> theirs;
+
+ public Map<String, Object> getYours() {
+ return yours;
+ }
+
+ public void setYours(Map<String, Object> yours) {
+ this.yours = yours;
+ }
+
+ public Map<String, Object> getTheirs() {
+ return theirs;
+ }
+
+ public void setTheirs(Map<String, Object> theirs) {
+ this.theirs = theirs;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictInfoDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictInfoDto.java
new file mode 100644
index 0000000000..e2e842a74e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictInfoDto.java
@@ -0,0 +1,33 @@
+package org.openecomp.sdcrests.conflict.types;
+
+import org.openecomp.sdc.datatypes.model.ElementType;
+
+public class ConflictInfoDto {
+ private String id;
+ private ElementType type;
+ private String name;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ElementType getType() {
+ return type;
+ }
+
+ public void setType(ElementType type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictResolutionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictResolutionDto.java
new file mode 100644
index 0000000000..1aaf18f859
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ConflictResolutionDto.java
@@ -0,0 +1,27 @@
+package org.openecomp.sdcrests.conflict.types;
+
+import org.openecomp.conflicts.types.Resolution;
+
+import java.util.Map;
+
+public class ConflictResolutionDto {
+ private Resolution resolution;
+ // sits in lower level...
+ private Map<String, Object> otherResolution;
+
+ public Resolution getResolution() {
+ return resolution;
+ }
+
+ public void setResolution(Resolution resolution) {
+ this.resolution = resolution;
+ }
+
+ public Map<String, Object> getOtherResolution() {
+ return otherResolution;
+ }
+
+ public void setOtherResolution(Map<String, Object> otherResolution) {
+ this.otherResolution = otherResolution;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ItemVersionConflictDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ItemVersionConflictDto.java
new file mode 100644
index 0000000000..3dbfcf03cf
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/main/java/org/openecomp/sdcrests/conflict/types/ItemVersionConflictDto.java
@@ -0,0 +1,29 @@
+package org.openecomp.sdcrests.conflict.types;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class ItemVersionConflictDto{
+ private ConflictDto conflict;
+ private Collection<ConflictInfoDto> conflictInfoList = new ArrayList<>();
+
+ public ConflictDto getConflict() {
+ return conflict;
+ }
+
+ public void setConflict(ConflictDto conflict) {
+ this.conflict = conflict;
+ }
+
+ public Collection<ConflictInfoDto> getConflictInfoList() {
+ return conflictInfoList;
+ }
+
+ public void setConflictInfoList(Collection<ConflictInfoDto> conflictInfoList) {
+ this.conflictInfoList = conflictInfoList;
+ }
+
+ public void addConflictInfo(ConflictInfoDto conflictInfo){
+ conflictInfoList.add(conflictInfo);
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/pom.xml
new file mode 100644
index 0000000000..d29b22a680
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-conflict-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-common-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-rest-webapp</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>conflict-rest</artifactId>
+
+ <packaging>pom</packaging>
+
+
+ <modules>
+ <module>conflict-rest-services</module>
+ <module>conflict-rest-types</module>
+ </modules>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/HealthCheck.java b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/HealthCheck.java
index 446a80e3cc..4be72a5999 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/HealthCheck.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/HealthCheck.java
@@ -39,10 +39,10 @@ import javax.ws.rs.core.Response;
@Validated
public interface HealthCheck {
- @GET
- @ApiOperation(value = "Perform health check",
- response = HealthInfoDtos.class,
- responseContainer = "List")
- Response checkHealth( );
+ @GET
+ @ApiOperation(value = "Perform health check",
+ response = HealthInfoDtos.class,
+ responseContainer = "List")
+ Response checkHealth();
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java
index 38858c0e7c..5bdc034673 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java
@@ -21,6 +21,7 @@
package org.openecomp.sdcrests.health.rest.services;
import org.apache.cxf.jaxrs.impl.ResponseBuilderImpl;
+import org.openecomp.sdc.common.session.SessionContextProviderFactory;
import org.openecomp.sdc.health.HealthCheckManager;
import org.openecomp.sdc.health.HealthCheckManagerFactory;
import org.openecomp.sdc.health.data.HealthCheckResult;
@@ -35,58 +36,60 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.util.Arrays;
-import java.util.Collection;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.util.Arrays;
+import java.util.Collection;
@Named
@Service("healthCheck")
@Scope(value = "prototype")
public class HealthCheckImpl implements org.openecomp.sdcrests.health.rest.HealthCheck {
- private HealthCheckManager healthCheckManager;
- private static final Logger logger = LoggerFactory.getLogger(HealthCheckImpl.class);
+ private HealthCheckManager healthCheckManager;
+ private static final Logger logger = LoggerFactory.getLogger(HealthCheckImpl.class);
- public HealthCheckImpl() {
- try {
- healthCheckManager = HealthCheckManagerFactory.getInstance().createInterface();
- } catch (Exception e){
- logger.error(e.getMessage(),e);
- }
+ public HealthCheckImpl() {
+ try {
+ healthCheckManager = HealthCheckManagerFactory.getInstance().createInterface();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
}
+ }
- @Override
- public Response checkHealth() {
- HealthCheckResult healthCheckResult = new HealthCheckResult();
+ @Override
+ public Response checkHealth() {
+ HealthCheckResult healthCheckResult = new HealthCheckResult();
+ SessionContextProviderFactory.getInstance().createInterface().create("public");
- try {
- MdcUtil.initMdc(LoggerServiceName.Health_check.toString());
- Collection<HealthInfo> healthInfos = healthCheckManager.checkHealth();
- healthCheckResult.setComponentsInfo(healthInfos);
- boolean someIsDown = healthInfos.stream()
- .anyMatch(healthInfo -> healthInfo.getHealthCheckStatus().equals(HealthCheckStatus.DOWN));
- healthInfos.stream().
- filter(healthInfo -> healthInfo.getHealthCheckComponent()
- .equals(org.openecomp.sdc.health.data.MonitoredModules.BE)).
- findFirst().ifPresent(healthInfo -> healthCheckResult.setSdcVersion(healthInfo.getVersion()));
- if (someIsDown) {
- Response.ResponseBuilder responseBuilder = new ResponseBuilderImpl();
- return responseBuilder.entity(healthCheckResult).status(500).build();
- }
- return Response.ok(healthCheckResult).build();
- } catch (Exception ex) {
- logger.error("Health check failed", ex);
- Response.ResponseBuilder responseBuilder = new ResponseBuilderImpl();
- GenericCollectionWrapper<HealthInfoDtos> results = new GenericCollectionWrapper<>();
- HealthInfo healthInfo = new HealthInfo(org.openecomp.sdc.health.data.MonitoredModules.BE ,
- HealthCheckStatus.DOWN,
- "", "Failed to perform Health Check");
- Collection<HealthInfo> healthInfos = Arrays.asList(healthInfo);
- healthCheckResult.setComponentsInfo(healthInfos);
- return responseBuilder.entity(healthCheckResult).status(500).build();
- }
+ try {
+ MdcUtil.initMdc(LoggerServiceName.Health_check.toString());
+ Collection<HealthInfo> healthInfos = healthCheckManager.checkHealth();
+ healthCheckResult.setComponentsInfo(healthInfos);
+ boolean someIsDown = healthInfos.stream()
+ .anyMatch(healthInfo -> healthInfo.getHealthCheckStatus().equals(HealthCheckStatus.DOWN));
+ healthInfos.stream().
+ filter(healthInfo -> healthInfo.getHealthCheckComponent()
+ .equals(org.openecomp.sdc.health.data.MonitoredModules.BE)).
+ findFirst()
+ .ifPresent(healthInfo -> healthCheckResult.setSdcVersion(healthInfo.getVersion()));
+ if (someIsDown) {
+ Response.ResponseBuilder responseBuilder = new ResponseBuilderImpl();
+ return responseBuilder.entity(healthCheckResult).status(500).build();
+ }
+ return Response.ok(healthCheckResult).build();
+ } catch (Exception ex) {
+ logger.error("Health check failed", ex);
+ Response.ResponseBuilder responseBuilder = new ResponseBuilderImpl();
+ GenericCollectionWrapper<HealthInfoDtos> results = new GenericCollectionWrapper<>();
+ HealthInfo healthInfo = new HealthInfo(org.openecomp.sdc.health.data.MonitoredModules.BE,
+ HealthCheckStatus.DOWN,
+ "", "Failed to perform Health Check");
+ Collection<HealthInfo> healthInfos = Arrays.asList(healthInfo);
+ healthCheckResult.setComponentsInfo(healthInfos);
+ return responseBuilder.entity(healthCheckResult).status(500).build();
}
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/pom.xml
new file mode 100644
index 0000000000..cec27da833
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-permissions-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>item-permissions-rest-services</artifactId>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-permissions-rest-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-common-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-item-permissions-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+
+
+ <!--<dependency>-->
+ <!--<groupId>javax.ws.rs</groupId>-->
+ <!--<artifactId>javax.ws.rs-api</artifactId>-->
+ <!--<version>${ws.rs.version}</version>-->
+ <!--</dependency>-->
+
+ <!--<dependency>-->
+ <!--<groupId>org.apache.cxf</groupId>-->
+ <!--<artifactId>cxf-rt-frontend-jaxrs</artifactId>-->
+ <!--<version>${cxf.version}</version>-->
+ <!--</dependency>-->
+
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-models</artifactId>
+ <version>RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/ItemPermissions.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/ItemPermissions.java
new file mode 100644
index 0000000000..e73595c67b
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/ItemPermissions.java
@@ -0,0 +1,53 @@
+package org.openecomp.sdcrests.itempermissions.rest;
+
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsDto;
+import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsRequestDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+/**
+ * Created by ayalaben on 6/18/2017.
+ */
+@Path("/v1.0/items/{itemId}/permissions")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Item Permissions")
+@Validated
+public interface ItemPermissions {
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List users permissions assigned on item",
+ response = ItemPermissionsDto.class,
+ responseContainer = "List")
+
+ Response list(@PathParam("itemId") String itemId,
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{permission}")
+ @ApiOperation(value = "Update useres permission on item")
+ Response updatePermissions(@Valid ItemPermissionsRequestDto request,
+ @PathParam("itemId") String itemId,
+ @PathParam("permission") String permission,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/mapping/MapItemPermissionsToItemPermissionsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/mapping/MapItemPermissionsToItemPermissionsDto.java
new file mode 100644
index 0000000000..88c3d4d74e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/mapping/MapItemPermissionsToItemPermissionsDto.java
@@ -0,0 +1,20 @@
+package org.openecomp.sdcrests.itempermissions.rest.mapping;
+
+import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity;
+import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+/**
+ * Created by ayalaben on 6/18/2017.
+ */
+
+public class MapItemPermissionsToItemPermissionsDto extends
+ MappingBase<ItemPermissionsEntity, ItemPermissionsDto> {
+
+
+ @Override
+ public void doMapping(ItemPermissionsEntity source, ItemPermissionsDto target) {
+ target.setUserId(source.getUserId());
+ target.setPermission(source.getPermission());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services/ItemPermissionsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services/ItemPermissionsImpl.java
new file mode 100644
index 0000000000..4fe93c20ac
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services/ItemPermissionsImpl.java
@@ -0,0 +1,52 @@
+//package org.openecomp.sdcrests.itempermissions.rest.mapping.mapping.services;
+package org.openecomp.sdcrests.itempermissions.rest.services;
+
+
+import org.openecomp.sdc.itempermissions.ItemPermissionsManager;
+import org.openecomp.sdc.itempermissions.ItemPermissionsManagerFactory;
+import org.openecomp.sdcrests.itempermissions.rest.ItemPermissions;
+import org.openecomp.sdcrests.itempermissions.rest.mapping.MapItemPermissionsToItemPermissionsDto;
+import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsDto;
+import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsRequestDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+/**
+ * Created by ayalaben on 6/18/2017.
+ */
+
+@Named
+@Service("itemPermissions")
+@Scope(value = "prototype")
+public class ItemPermissionsImpl implements ItemPermissions {
+
+ private ItemPermissionsManager itemPermissionsManager =
+ ItemPermissionsManagerFactory.getInstance().createInterface();
+
+ @Override
+ public Response list(String itemId, String user) {
+
+ GenericCollectionWrapper<ItemPermissionsDto> results = new GenericCollectionWrapper<>();
+ MapItemPermissionsToItemPermissionsDto mapper = new MapItemPermissionsToItemPermissionsDto();
+
+ itemPermissionsManager.listItemPermissions(itemId)
+ .forEach(itemPermission -> results.add(mapper.applyMapping
+ (itemPermission, ItemPermissionsDto.class)));
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response updatePermissions(ItemPermissionsRequestDto request, String itemId,
+ String permission, String user) {
+
+ itemPermissionsManager.updateItemPermissions(itemId,permission,request.getAddedUsersIds(),
+ request.getRemovedUsersIds());
+
+ return Response.ok().build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/pom.xml
new file mode 100644
index 0000000000..49f1f2b6d3
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-permissions-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>item-permissions-rest-types</artifactId>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/main/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/main/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsDto.java
new file mode 100644
index 0000000000..d7f0b9f259
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/main/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsDto.java
@@ -0,0 +1,27 @@
+package org.openecomp.sdcrests.itempermissions.types;
+
+/**
+ * Created by ayalaben on 6/18/2017.
+ */
+public class ItemPermissionsDto {
+
+ private String userId;
+ private String permission;
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String id) {
+ this.userId = id;
+ }
+
+ public String getPermission() {
+ return permission;
+ }
+
+ public void setPermission(String permission) {
+ this.permission = permission;
+ }
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/main/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/main/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsRequestDto.java
new file mode 100644
index 0000000000..82a960c7fd
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/main/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsRequestDto.java
@@ -0,0 +1,32 @@
+package org.openecomp.sdcrests.itempermissions.types;
+
+import io.swagger.annotations.ApiModel;
+
+import java.util.Set;
+
+/**
+ * Created by ayalaben on 6/20/2017.
+ */
+
+@ApiModel(value = "ItemPermissionsRequest")
+public class ItemPermissionsRequestDto {
+
+ private Set<String> addedUsersIds;
+ private Set<String> removedUsersIds;
+
+ public Set<String> getAddedUsersIds() {
+ return addedUsersIds;
+ }
+
+ public void setAddedUsersIds(Set<String> addedUsersIds) {
+ this.addedUsersIds = addedUsersIds;
+ }
+
+ public Set<String> getRemovedUsersIds() {
+ return removedUsersIds;
+ }
+
+ public void setRemovedUsersIds(Set<String> removedUsersIds) {
+ this.removedUsersIds = removedUsersIds;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/pom.xml
index 0b3c83c610..f89fb0760a 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/pom.xml
@@ -4,19 +4,21 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>activity-log-rest</artifactId>
- <packaging>pom</packaging>
-
<parent>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-rest-webapp</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-permissions-rest</artifactId>
+
+ <packaging>pom</packaging>
+
+
<modules>
- <module>activity-log-rest-services</module>
- <module>activity-log-rest-types</module>
+ <module>item-permissions-rest-types</module>
+ <module>item-permissions-rest-services</module>
</modules>
-
-</project>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml
index 10685dbac0..6b96a4d328 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml
@@ -4,40 +4,23 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>activity-log-rest-services</artifactId>
-
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>activity-log-rest</artifactId>
+ <artifactId>item-rest</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
- <dependencies>
-
+ <artifactId>item-rest-services</artifactId>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>${ws.rs.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.framework.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <version>1</version>
- </dependency>
+ <dependencies>
<dependency>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-activity-log-manager</artifactId>
+ <artifactId>openecomp-sdc-item-permissions-manager</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>activity-log-rest-types</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-rest-types</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -45,14 +28,28 @@
<artifactId>openecomp-sdc-common-rest</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
<!-- CXF -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-conflict-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
</dependencies>
-</project>
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java
new file mode 100644
index 0000000000..7d7b0854d9
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java
@@ -0,0 +1,88 @@
+package org.openecomp.sdcrests.item.rest;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdcrests.item.types.ActivityLogDto;
+import org.openecomp.sdcrests.item.types.RevisionDto;
+import org.openecomp.sdcrests.item.types.VersionActionRequestDto;
+import org.openecomp.sdcrests.item.types.VersionDto;
+import org.openecomp.sdcrests.item.types.VersionRequestDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+@Path("/v1.0/items/{itemId}/versions")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Item Versions")
+@Validated
+public interface Versions {
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "Lists item versions",
+ response = VersionDto.class,
+ responseContainer = "List")
+ Response list(@PathParam("itemId") String itemId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/{versionId}")
+ @ApiOperation(value = "Creates a new item version")
+ Response create(VersionRequestDto request,
+ @PathParam("itemId") String itemId,
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{versionId}")
+ @ApiOperation(value = "Gets item version", response = VersionDto.class)
+ Response get(@PathParam("itemId") String itemId,
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{versionId}/activity-logs")
+ @ApiOperation(value = "Gets item version activity log",
+ response = ActivityLogDto.class,
+ responseContainer = "List")
+ Response getActivityLog(@ApiParam("Item Id") @PathParam("itemId") String itemId,
+ @ApiParam("Version Id") @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{versionId}/revisions")
+ @ApiOperation(value = "Gets item version revisions", response = RevisionDto.class,
+ responseContainer = "List")
+ Response listRevisions(@PathParam("itemId") String itemId,
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{versionId}/actions")
+ @ApiOperation(value = "Acts on item version")
+ Response actOn(VersionActionRequestDto request,
+ @PathParam("itemId") String itemId,
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/mapping/MapActivityLogEntityToActivityLogDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapActivityLogEntityToDto.java
index 023dedf12c..307b555720 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/mapping/MapActivityLogEntityToActivityLogDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapActivityLogEntityToDto.java
@@ -18,23 +18,24 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdcrests.activitylog.rest.mapping;
+package org.openecomp.sdcrests.item.rest.mapping;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
-import org.openecomp.sdcrests.activitylog.types.ActivityLogDto;
-import org.openecomp.sdcrests.activitylog.types.ActivityStatus;
+import org.openecomp.sdcrests.item.types.ActivityLogDto;
+import org.openecomp.sdcrests.item.types.ActivityStatus;
import org.openecomp.sdcrests.mapping.MappingBase;
-public class MapActivityLogEntityToActivityLogDto extends MappingBase<ActivityLogEntity, ActivityLogDto> {
+public class MapActivityLogEntityToDto
+ extends MappingBase<ActivityLogEntity, ActivityLogDto> {
- @Override
- public void doMapping(ActivityLogEntity source, ActivityLogDto target) {
- target.setId(source.getId());
- target.setTimestamp(source.getTimestamp());
- target.setType(source.getType());
- target.setComment(source.getComment());
- target.setUser(source.getUser());
- target.setStatus(new ActivityStatus(source.isSuccess(), source.getMessage()));
- }
+ @Override
+ public void doMapping(ActivityLogEntity source, ActivityLogDto target) {
+ target.setId(source.getId());
+ target.setTimestamp(source.getTimestamp());
+ target.setType(source.getType().name());
+ target.setComment(source.getComment());
+ target.setUser(source.getUser());
+ target.setStatus(new ActivityStatus(source.isSuccess(), source.getMessage()));
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapItemToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapItemToDto.java
new file mode 100644
index 0000000000..26bd58d950
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapItemToDto.java
@@ -0,0 +1,15 @@
+package org.openecomp.sdcrests.item.rest.mapping;
+
+import org.openecomp.sdc.versioning.types.Item;
+import org.openecomp.sdcrests.item.types.ItemDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapItemToDto extends MappingBase<Item, ItemDto> {
+ @Override
+ public void doMapping(Item source, ItemDto target) {
+ target.setId(source.getId());
+ target.setType(source.getType());
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapRevisionToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapRevisionToDto.java
new file mode 100644
index 0000000000..861f571c5f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapRevisionToDto.java
@@ -0,0 +1,15 @@
+package org.openecomp.sdcrests.item.rest.mapping;
+
+import org.openecomp.sdc.versioning.dao.types.Revision;
+import org.openecomp.sdcrests.item.types.RevisionDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapRevisionToDto extends MappingBase<Revision, RevisionDto> {
+ @Override
+ public void doMapping(Revision source, RevisionDto target) {
+ target.setId(source.getId());
+ target.setMessage(source.getMessage());
+ target.setUser(source.getUser());
+ target.setTime(source.getTime());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapVersionToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapVersionToDto.java
new file mode 100644
index 0000000000..5fbd9a9e8d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/mapping/MapVersionToDto.java
@@ -0,0 +1,20 @@
+package org.openecomp.sdcrests.item.rest.mapping;
+
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.item.types.VersionDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+
+public class MapVersionToDto extends MappingBase<Version, VersionDto> {
+ @Override
+ public void doMapping(Version source, VersionDto target) {
+ target.setId(source.getId());
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ target.setBaseId(source.getBaseId());
+ target.setStatus(source.getStatus());
+ target.setState(source.getState());
+ target.setCreationTime(source.getCreationTime());
+ target.setModificationTime(source.getModificationTime());
+ target.setAdditionalInfo(source.getAdditionalInfo());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java
new file mode 100644
index 0000000000..466734208d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java
@@ -0,0 +1,270 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.sdcrests.item.rest.services;
+
+import org.openecomp.sdc.activitylog.ActivityLogManager;
+import org.openecomp.sdc.activitylog.ActivityLogManagerFactory;
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.activitylog.dao.type.ActivityType;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.conflicts.ConflictsManager;
+import org.openecomp.sdc.conflicts.ConflictsManagerFactory;
+import org.openecomp.sdc.itempermissions.ItemPermissionsManager;
+import org.openecomp.sdc.itempermissions.ItemPermissionsManagerFactory;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.logging.context.MdcUtil;
+import org.openecomp.sdc.logging.types.LoggerServiceName;
+import org.openecomp.sdc.notification.dtos.Event;
+import org.openecomp.sdc.notification.factories.NotificationPropagationManagerFactory;
+import org.openecomp.sdc.notification.services.NotificationPropagationManager;
+import org.openecomp.sdc.versioning.ItemManager;
+import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.VersioningManager;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
+import org.openecomp.sdc.versioning.dao.types.SynchronizationState;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.errors.RevisionIdNotFoundErrorBuilder;
+import org.openecomp.sdc.versioning.types.NotificationEventTypes;
+import org.openecomp.sdcrests.item.rest.Versions;
+import org.openecomp.sdcrests.item.rest.mapping.MapActivityLogEntityToDto;
+import org.openecomp.sdcrests.item.rest.mapping.MapRevisionToDto;
+import org.openecomp.sdcrests.item.rest.mapping.MapVersionToDto;
+import org.openecomp.sdcrests.item.types.ActivityLogDto;
+import org.openecomp.sdcrests.item.types.CommitRequestDto;
+import org.openecomp.sdcrests.item.types.RevisionDto;
+import org.openecomp.sdcrests.item.types.RevisionRequestDto;
+import org.openecomp.sdcrests.item.types.VersionActionRequestDto;
+import org.openecomp.sdcrests.item.types.VersionDto;
+import org.openecomp.sdcrests.item.types.VersionRequestDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_NAME;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.SUBMIT_DESCRIPTION;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_NAME;
+
+@Named
+@Service("versions")
+@Scope(value = "prototype")
+public class VersionsImpl implements Versions {
+
+ private static final String COMMIT_ITEM_ACTION = "Commit_Item";
+ private static final Logger LOGGER = LoggerFactory.getLogger(VersionsImpl.class);
+
+ private ItemPermissionsManager permissionsManager =
+ ItemPermissionsManagerFactory.getInstance().createInterface();
+ private ItemManager itemManager =
+ ItemManagerFactory.getInstance().createInterface();
+ private VersioningManager versioningManager =
+ VersioningManagerFactory.getInstance().createInterface();
+ private ConflictsManager conflictsManager =
+ ConflictsManagerFactory.getInstance().createInterface();
+ private ActivityLogManager activityLogManager =
+ ActivityLogManagerFactory.getInstance().createInterface();
+ private NotificationPropagationManager notifier =
+ NotificationPropagationManagerFactory.getInstance().createInterface();
+
+ @Override
+ public Response list(String itemId, String user) {
+ GenericCollectionWrapper<VersionDto> results = new GenericCollectionWrapper<>();
+ MapVersionToDto mapper = new MapVersionToDto();
+
+ versioningManager.list(itemId)
+ .forEach(version -> results.add(mapper.applyMapping(version, VersionDto.class)));
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response create(VersionRequestDto request, String itemId, String baseVersionId,
+ String user) {
+ Version version = new Version();
+ version.setBaseId(baseVersionId);
+ version.setDescription(request.getDescription());
+
+ version = versioningManager.create(itemId, version, request.getCreationMethod());
+
+ VersionDto versionDto = new MapVersionToDto().applyMapping(version, VersionDto.class);
+
+ activityLogManager.logActivity(new ActivityLogEntity(itemId, version,
+ ActivityType.Create_Version, user, true, "", ""));
+
+ return Response.ok(versionDto).build();
+ }
+
+ @Override
+ public Response get(String itemId, String versionId, String user) {
+ Version version = getVersion(itemId, new Version(versionId));
+ VersionDto versionDto = new MapVersionToDto().applyMapping(version, VersionDto.class);
+ return Response.ok(versionDto).build();
+ }
+
+ @Override
+ public Response getActivityLog(String itemId, String versionId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Get_List_Activity_Log.toString());
+
+ GenericCollectionWrapper<ActivityLogDto> results = new GenericCollectionWrapper<>();
+ MapActivityLogEntityToDto mapper = new MapActivityLogEntityToDto();
+
+ activityLogManager.listLoggedActivities(itemId, new Version(versionId))
+ .forEach(loggedActivity -> results
+ .add(mapper.applyMapping(loggedActivity, ActivityLogDto.class)));
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response listRevisions(String itemId, String versionId, String user) {
+ GenericCollectionWrapper<RevisionDto> results = new GenericCollectionWrapper<>();
+ MapRevisionToDto mapper = new MapRevisionToDto();
+
+ versioningManager.listRevisions(itemId, new Version(versionId))
+ .forEach(revision -> results.add(mapper.applyMapping(revision, RevisionDto.class)));
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response actOn(VersionActionRequestDto request, String itemId, String versionId,
+ String user) {
+ Version version = new Version(versionId);
+ switch (request.getAction()) {
+ case Sync:
+ sync(itemId, version);
+ break;
+ case Commit:
+ if (!permissionsManager.isAllowed(itemId, user, COMMIT_ITEM_ACTION)) {
+ return Response.status(Response.Status.FORBIDDEN)
+ .entity(new Exception(Messages.PERMISSIONS_ERROR.getErrorMessage())).build();
+ }
+ commit(request.getCommitRequest(), itemId, version, user);
+ break;
+ case Revert:
+ revert(request.getRevisionRequest(), itemId, versionId);
+ break;
+ case Reset:
+ throw new UnsupportedOperationException("Action reset not supported.");
+ default:
+ }
+ return Response.ok().build();
+ }
+
+
+ private void revert(RevisionRequestDto request, String itemId, String versionId) {
+ if (request.getRevisionId() == null) {
+ throw new CoreException(new RevisionIdNotFoundErrorBuilder().build());
+ }
+
+ versioningManager.revert(itemId, new Version(versionId), request.getRevisionId());
+ }
+
+ private void sync(String itemId, Version version) {
+ versioningManager.sync(itemId, version);
+ conflictsManager.finalizeMerge(itemId, version);
+ }
+
+ private void commit(CommitRequestDto request, String itemId, Version version, String user) {
+
+ String message = request == null ? "" : request.getMessage();
+
+ versioningManager.publish(itemId, version, message);
+ notifyUsers(itemId, version, message, user, NotificationEventTypes.COMMIT);
+
+ activityLogManager.logActivity(new ActivityLogEntity(itemId, version,
+ ActivityType.Commit, user, true, "", message));
+ }
+
+ private void notifyUsers(String itemId, Version version, String message,
+ String userName, NotificationEventTypes eventType) {
+ Map<String, Object> eventProperties = new HashMap<>();
+ eventProperties.put(ITEM_NAME, itemManager.get(itemId).getName());
+ eventProperties.put(ITEM_ID, itemId);
+
+ Version ver = versioningManager.get(itemId, version);
+ eventProperties.put(VERSION_NAME, ver.getName());
+ eventProperties.put(VERSION_ID, ver.getId());
+
+ eventProperties.put(SUBMIT_DESCRIPTION, message);
+ eventProperties.put(PERMISSION_USER, userName);
+
+ Event syncEvent = new SyncEvent(eventType.getEventName(), itemId, eventProperties, itemId);
+ try {
+ notifier.notifySubscribers(syncEvent, userName);
+ } catch (Exception e) {
+ LOGGER.error("Failed to send sync notification to users subscribed o item '" + itemId);
+ }
+ }
+
+ private class SyncEvent implements Event {
+
+ private String eventType;
+ private String originatorId;
+ private Map<String, Object> attributes;
+ private String entityId;
+
+ public SyncEvent(String eventType, String originatorId,
+ Map<String, Object> attributes, String entityId) {
+ this.eventType = eventType;
+ this.originatorId = originatorId;
+ this.attributes = attributes;
+ this.entityId = entityId;
+ }
+
+ @Override
+ public String getEventType() {
+ return eventType;
+ }
+
+ @Override
+ public String getOriginatorId() {
+ return originatorId;
+ }
+
+ @Override
+ public Map<String, Object> getAttributes() {
+ return attributes;
+ }
+
+ @Override
+ public String getEntityId() {
+ return entityId;
+ }
+ }
+
+ private Version getVersion(String itemId, Version version) {
+ version = versioningManager.get(itemId, version);
+
+ if (version.getState().getSynchronizationState() != SynchronizationState.Merging &&
+ conflictsManager.isConflicted(itemId, version)) { // looks for sdc applicative conflicts
+ version.getState().setSynchronizationState(SynchronizationState.Merging);
+ }
+ return version;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/pom.xml
new file mode 100644
index 0000000000..6b974809b2
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>item-rest-types</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-versioning-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-activity-log-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-conflict-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/src/main/java/org/openecomp/sdcrests/activitylog/types/ActivityLogDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java
index dde579554f..40fb91867e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/src/main/java/org/openecomp/sdcrests/activitylog/types/ActivityLogDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java
@@ -18,64 +18,68 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdcrests.activitylog.types;
-
+package org.openecomp.sdcrests.item.types;
import java.util.Date;
public class ActivityLogDto {
- private String id;
- private Date timestamp;
- private String type;
- private String comment;
- private String user;
- private ActivityStatus status;
+ private String id;
+ private Date timestamp;
+ private String type;
+ private String comment;
+ private String user;
+ private ActivityStatus status;
- public ActivityLogDto(){}
+ public ActivityLogDto() {
+ }
- public String getId() { return id; }
+ public String getId() {
+ return id;
+ }
- public void setId(String id) { this.id = id; }
+ public void setId(String id) {
+ this.id = id;
+ }
- public Date getTimestamp() {
- return timestamp;
- }
+ public Date getTimestamp() {
+ return timestamp;
+ }
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
- public String getType() {
- return type;
- }
+ public String getType() {
+ return type;
+ }
- public void setType(String type) {
- this.type = type;
- }
+ public void setType(String type) {
+ this.type = type;
+ }
- public String getComment() {
- return comment;
- }
+ public String getComment() {
+ return comment;
+ }
- public void setComment(String comment) {
- this.comment = comment;
- }
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
- public String getUser() {
- return user;
- }
+ public String getUser() {
+ return user;
+ }
- public void setUser(String user) {
- this.user = user;
- }
+ public void setUser(String user) {
+ this.user = user;
+ }
- public ActivityStatus getStatus() {
- return status;
- }
+ public ActivityStatus getStatus() {
+ return status;
+ }
- public void setStatus(ActivityStatus status) {
- this.status = status;
- }
+ public void setStatus(ActivityStatus status) {
+ this.status = status;
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/src/main/java/org/openecomp/sdcrests/activitylog/types/ActivityStatus.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityStatus.java
index 326b1b624d..601a211e5b 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/src/main/java/org/openecomp/sdcrests/activitylog/types/ActivityStatus.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityStatus.java
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdcrests.activitylog.types;
+package org.openecomp.sdcrests.item.types;
public class ActivityStatus {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java
new file mode 100644
index 0000000000..a1d46cbdf1
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdcrests.item.types;
+
+public class CommitRequestDto {
+ private String message;
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java
new file mode 100644
index 0000000000..afba96f6c8
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java
@@ -0,0 +1,22 @@
+package org.openecomp.sdcrests.item.types;
+
+public class ItemCreationDto {
+ private String itemId;
+ private VersionDto version;
+
+ public String getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(String itemId) {
+ this.itemId = itemId;
+ }
+
+ public VersionDto getVersion() {
+ return version;
+ }
+
+ public void setVersion(VersionDto version) {
+ this.version = version;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java
new file mode 100644
index 0000000000..1eebf19750
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java
@@ -0,0 +1,40 @@
+package org.openecomp.sdcrests.item.types;
+
+public class ItemDto {
+ private String id;
+ private String type;
+ private String name;
+ private String description;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java
new file mode 100644
index 0000000000..241d28541e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java
@@ -0,0 +1,43 @@
+package org.openecomp.sdcrests.item.types;
+
+import java.util.Date;
+
+public class RevisionDto {
+ private String id;
+ private String message;
+ private Date time;
+ private String user;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionRequestDto.java
new file mode 100644
index 0000000000..49ea9fc7f2
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionRequestDto.java
@@ -0,0 +1,14 @@
+package org.openecomp.sdcrests.item.types;
+
+public class RevisionRequestDto {
+
+ private String revisionId;
+
+ public String getRevisionId() {
+ return revisionId;
+ }
+
+ public void setRevisionId(String revisionId) {
+ this.revisionId = revisionId;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java
new file mode 100644
index 0000000000..2591560fbb
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdcrests.item.types;
+
+public class SubmitRequestDto {
+ private String message;
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionAction.java
index f77005f781..c9d6f4e293 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspCreationDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,19 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdcrests.vendorsoftwareproducts.types;
+package org.openecomp.sdcrests.item.types;
-/**
- * Created by TALIO on 4/26/2016.
- */
-public class VspCreationDto {
- private String vspId;
-
- public String getVspId() {
- return vspId;
- }
-
- public void setVspId(String vspId) {
- this.vspId = vspId;
- }
+public enum VersionAction {
+ Sync,
+ Commit,
+ Revert,
+ Reset
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionActionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionActionRequestDto.java
new file mode 100644
index 0000000000..98a5bb94ee
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionActionRequestDto.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.sdcrests.item.types;
+
+public class VersionActionRequestDto {
+ private VersionAction action;
+ private CommitRequestDto commitRequest;
+
+ private RevisionRequestDto revisionRequest;
+
+ public VersionAction getAction() {
+ return action;
+ }
+
+ public void setAction(VersionAction action) {
+ this.action = action;
+ }
+
+ public CommitRequestDto getCommitRequest() {
+ return commitRequest;
+ }
+
+ public void setCommitRequest(CommitRequestDto commitRequest) {
+ this.commitRequest = commitRequest;
+ }
+
+ public RevisionRequestDto getRevisionRequest() {
+ return revisionRequest;
+ }
+
+ public void setRevisionRequest(RevisionRequestDto revisionRequest) {
+ this.revisionRequest = revisionRequest;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java
new file mode 100644
index 0000000000..a0c1942b03
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java
@@ -0,0 +1,94 @@
+package org.openecomp.sdcrests.item.types;
+
+import org.openecomp.sdc.versioning.dao.types.VersionState;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+
+import java.util.Date;
+import java.util.Map;
+
+public class VersionDto {
+ private String id;
+ private String name;
+ private String description;
+ private String baseId;
+ private VersionStatus status;
+ private VersionState state;
+ private Date creationTime;
+ private Date modificationTime;
+ private Map<String,Object> additionalInfo;
+ public VersionDto() {
+
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getBaseId() {
+ return baseId;
+ }
+
+ public void setBaseId(String baseId) {
+ this.baseId = baseId;
+ }
+
+ public VersionStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(VersionStatus status) {
+ this.status = status;
+ }
+
+ public VersionState getState() {
+ return state;
+ }
+
+ public void setState(VersionState state) {
+ this.state = state;
+ }
+
+ public Date getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Date creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public Date getModificationTime() {
+ return modificationTime;
+ }
+
+ public void setModificationTime(Date modificationTime) {
+ this.modificationTime = modificationTime;
+ }
+
+ public Map<String, Object> getAdditionalInfo() {
+ return additionalInfo;
+ }
+
+ public void setAdditionalInfo(Map<String, Object> additionalInfo) {
+ this.additionalInfo = additionalInfo;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java
new file mode 100644
index 0000000000..629bc2d2db
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java
@@ -0,0 +1,24 @@
+package org.openecomp.sdcrests.item.types;
+
+import org.openecomp.sdc.versioning.types.VersionCreationMethod;
+
+public class VersionRequestDto {
+ private String description;
+ private VersionCreationMethod creationMethod;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public VersionCreationMethod getCreationMethod() {
+ return creationMethod;
+ }
+
+ public void setCreationMethod(VersionCreationMethod creationMethod) {
+ this.creationMethod = creationMethod;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/pom.xml
index 70f029a0e3..6623de8cce 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/pom.xml
@@ -4,12 +4,19 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>activity-log-rest-types</artifactId>
-
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>activity-log-rest</artifactId>
+ <artifactId>openecomp-sdc-rest-webapp</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
-</project>
+ <artifactId>item-rest</artifactId>
+ <packaging>pom</packaging>
+
+
+ <modules>
+ <module>item-rest-services</module>
+ <module>item-rest-types</module>
+ </modules>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml
new file mode 100644
index 0000000000..319b0285cb
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml
@@ -0,0 +1,161 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.openecomp.sdc.onboarding</groupId>
+ <artifactId>notifications-fe</artifactId>
+ <name>notification-war</name>
+ <packaging>war</packaging>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc</artifactId>
+ <relativePath>../../..</relativePath>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ <spring.version>4.3.4.RELEASE</spring.version>
+ <jetty.version>9.3.6.v20151106</jetty.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-notification-websocket</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${javax.servlet.version}</version>
+ </dependency>
+ <!-- JSON -->
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-jaxrs</artifactId>
+ <version>${org.codehaus.jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>${org.codehaus.jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlets</artifactId>
+ <version>${jetty.version}</version>
+ </dependency>
+ <!-- START required for websocket -->
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>${jetty.version}</version>
+ </dependency>
+ <!-- END required for websocket -->
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>1.0.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.3.1.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <version>${groovy.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>${logback.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.janino</groupId>
+ <artifactId>janino</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <version>1.8.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>1.8.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjtools</artifactId>
+ <version>1.8.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.3.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+ </dependencies>
+
+ <!-- Should be removed once TogglZ usage in pom files is fixed -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>3.0.0</version>
+ <configuration>
+ <packagingExcludes>WEB-INF/lib/togglz*.jar</packagingExcludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToGetFileDataStructureResponseDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/java/org/openecomp/server/listeners/OnboardingAppStartupListener.java
index b7d4670203..96300b5cbb 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToGetFileDataStructureResponseDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/java/org/openecomp/server/listeners/OnboardingAppStartupListener.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,23 +18,26 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdcrests.vsp.rest.mapping;
+package org.openecomp.server.listeners;
-import org.openecomp.sdc.vendorsoftwareproduct.types.GetFileDataStructureResponseDTO;
-import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
-import org.openecomp.sdcrests.mapping.MappingBase;
+import org.springframework.web.context.ContextLoaderListener;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public class OnboardingAppStartupListener implements ServletContextListener {
+
+ ContextLoaderListener springListener;
+
+ @Override
+ public void contextInitialized(ServletContextEvent servletContextEvent) {
+ springListener = new ContextLoaderListener();
+ springListener.initWebApplicationContext(servletContextEvent.getServletContext());
+ }
-/**
- * Created by TALIO on 4/27/2016.
- */
-public class MapFilesDataStructureToGetFileDataStructureResponseDto
- extends MappingBase<FilesDataStructure, GetFileDataStructureResponseDTO> {
@Override
- public void doMapping(FilesDataStructure source, GetFileDataStructureResponseDTO target) {
- target.setModules(source.getModules());
- target.setArtifacts(source.getArtifacts());
- target.setUnassigned(source.getUnassigned());
- target.setNested(source.getNested());
+ public void contextDestroyed(ServletContextEvent servletContextEvent) {
+ springListener.closeWebApplicationContext(servletContextEvent.getServletContext());
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/resources/keyfile.txt b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/resources/keyfile.txt
new file mode 100644
index 0000000000..d6c2c253f8
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/resources/keyfile.txt
@@ -0,0 +1,27 @@
+hfLSGGYWU2SyTlltV0HVwU6o3GtrtccAU8aFwq65OHsl6JeEAirXaNl73xz2uTrfiFqVJD7GTxXr
+_qlY4BnLFZ7q3KNRZ0VQssjF_REjB8p7YMkEiTzbJL0pSaI6s0GRotuM432Jbsoksh8WZeui7svx
+I_KD124t73d1EpIAQwHldZXRZEoDrLjfJUSCAcmsXSu5OlIMZDKOy7vR0aXPw6Dpn9sZBcpFHFQL
+Xkp63yTf81snlVBGXApwS852_u4nEYmQrGQo9u6iLRg4dodOUD7wG7jbNB_KtmIspxL87i75hJ_0
+PXkLN8H2K14Rvk9ILYjdASpPOyVMK8avylRRyRy5HFBUJfeWk4YJEPus79Ol-j3QefWxX2hEOe_Y
+AcA5xYgwsYylSARWcQ7aZ8M781-CNaM1yDkFCBRNLQoOo3k_yyspfHC0fOwIOPZdh9YiXIop3MAM
+FC0SdPTUQrQxlF3IOC7tfEp7Wu2XezkcbIBe8mDy7dcYa87KqrL0zRju80R_gl-UCkxMLZpEKhnB
+zWxjDNOGCC4VaLMrW6uREFlanw2yg3XAXZD2vl60r1WNUrRUJcYRs9FwNkdVhKH7o_D7GLXCxlEF
+ltapyC4i1xgeXiEH35WrqlmS1PexaWkRloFmpLXY56D3iqg9RYrZnqQAift20LLQ_ZMFS_fOlb8w
+pu-VqjifrOthE9B375Nq-_YdMCLRAdAXf5wiMC1AlimLE6gmE6cl0SopHpmtmLX--4jy8IUSOceG
+xhTKpfO_7Gnn-V5m-ourtkj_UivEiM3eIyzilamlEtac50e-mg1sEHjPvAQd7p_oqaGd4NveSUeG
+_WsLUZJgKI6Nu0545J1tDmlgZ4atd1b4Mkutl1CbijYg9c6Nu_zxMs9RwN9_-C3JJJxQpBUieXFY
+f38PD62P8Ihb8VmNmBhOT8abRmH7Zx1adz6fcjFtaO0wSsfWr8M04W_GrbrGO_yr7GeJwqdYEP8r
+rUoQWkNRuapL09KUHhHTdc8hQoCNUx4p2H2_ADA8j6gp62z54LUQDaTOHJI3Vs6mdfP7oDr2H_VK
+LLWR7fHcDzS89opwtp7NO56jpmmq4q-U9kxpY1lMYJhKBuVMCm038l_eMGL35jD6OcgOCC2GL9U9
+wfyjwumJMNIND8I3viuyouMy_B5q00v27M2im6Q814Mg5Cw-RCiKy4kjhutkqTw8hXh7RLkm-QeJ
+KlsrH98snwWLaw9LBeGoMbqzHzWl93inEsTyLutMPA8xSIj5kySLIcJCXq9-RMp8cnOYy8TY9Jix
+oaB2u4ofHDDrrMzKY88ZPdMiGQX2BNdsOG6o4ifSVyyYwIWBtQvtO7SDvGhRUGEV1JHloBdIos0M
+87SMERYd_UPKK_yl2RaqloQZRlDSgUR7i0hoqrhtPe5Ef4cJFX_CSt_oQnEu0JatwAuwybkLLPbO
+mArd3rtrOh-uR_0Y77zb7Uw4H5_oX_ANIecH0sgRcvQESaq-ioYrvS94VqvxU8ByuxqxJLMo90Rc
+oOAk3pq0b-16x_WRxWTfbnnNLDSQ_DwS-Xeav1nPwm-ELy1AVEQdpgbjONThjkZp3AuljaH_1Fs4
+u0A8HeCgIa4g7jsvIRxw6zLKspYENdvoHvQLWGRpaA-vfT3i3lR0MEu53v8M9hI8U8MqJo_J0xe6
+z2mtQWPiCLtW99vTqhKOm621_GNYmp10TEXVMkXumEk2rTgLBDaFEFwpgS5LqkEOObVChd9jx9oa
+DW4LjhzO1EE5twGvbTiRAJsO6j5UNTonGFLLttYKq9CMvDiBZ8-whFGOM8D2qAWYiwDCI-dLqwat
+jxQP1cYKGHMS2-VJ5QJa6EINEx2zo3VmnHYCE9gM71fC26018Y2T-sQfE1MRE9SU_Xma7Qbl5OBp
+IflyJCTyhZfgFlqU9f2cq12bjoNuMrgOlKwap6325LGZK1XsmsHuHmASRE4-E-qmQY7GI9oJLmbl
+425swlxRA-mr1eGZU0hK3ZFjz_4clBMLJBYMFYhdGzi4VYGPzaO0z0wNJzOQf3V5NbReFjxl \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/beans-services.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/beans-services.xml
new file mode 100644
index 0000000000..c41bc03473
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/beans-services.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:websocket="http://www.springframework.org/schema/websocket"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/websocket
+ http://www.springframework.org/schema/websocket/spring-websocket.xsd">
+
+
+ <!-- CXF -->
+ <context:component-scan base-package="org.openecomp.sdcrests"/>
+
+ <!-- Needed for JSR-303 validations. May be removed when moving to JAX-RS 2.0 -->
+ <bean class="org.springframework.validation.beanvalidation.MethodValidationPostProcessor"/>
+
+ <bean id="jacksonObjectMapper" class="org.codehaus.jackson.map.ObjectMapper">
+ <property name="serializationInclusion" value="NON_NULL"/>
+ </bean>
+
+ <bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider">
+ <property name="mapper" ref="jacksonObjectMapper"/>
+ </bean>
+
+ <!-- WEB-SOCKETS -->
+ <websocket:handlers allowed-origins="*">
+ <websocket:mapping path="/notificationHandler" handler="notificationHandler"/>
+ <websocket:handshake-handler ref="handshakeHandler"/>
+ </websocket:handlers>
+
+ <bean id="newNotificationsReader" class="org.openecomp.sdc.notification.workers.impl.NewNotificationsReaderRestImpl"/>
+
+ <bean id="notificationWorker" class="org.openecomp.sdc.notification.workers.NotificationWorker">
+ <constructor-arg ref="newNotificationsReader"/>
+ </bean>
+
+ <bean id="notificationHandler" class="org.openecomp.sdc.notification.websocket.NotificationWebsocketHandler">
+ <constructor-arg ref="notificationWorker"/>
+ </bean>
+
+ <bean class="org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean">
+ <property name="maxTextMessageBufferSize" value="8192"/>
+ <property name="maxBinaryMessageBufferSize" value="8192"/>
+ </bean>
+
+ <bean id="handshakeHandler" class="org.springframework.web.socket.server.support.DefaultHandshakeHandler">
+ <constructor-arg ref="upgradeStrategy"/>
+ </bean>
+
+ <bean id="upgradeStrategy" class="org.springframework.web.socket.server.jetty.JettyRequestUpgradeStrategy">
+ <constructor-arg ref="serverFactory"/>
+ </bean>
+
+ <bean id="serverFactory" class="org.eclipse.jetty.websocket.server.WebSocketServerFactory">
+ <constructor-arg>
+ <bean class="org.eclipse.jetty.websocket.api.WebSocketPolicy">
+ <constructor-arg value="SERVER"/>
+ <property name="inputBufferSize" value="8092"/>
+ <property name="idleTimeout" value="600000"/>
+ </bean>
+ </constructor-arg>
+ </bean>
+
+</beans>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/jetty-web.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/jetty-web.xml
new file mode 100644
index 0000000000..443b6a1fd3
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/jetty-web.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE Configure PUBLIC
+ "-//Mort Bay Consulting//DTD Configure//EN"
+ "http://www.eclipse.org/jetty/configure_9_0.dtd">
+
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+ <Set name="contextPath">/notification-api</Set>
+</Configure>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/spring-mapper-servlet.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/spring-mapper-servlet.xml
new file mode 100644
index 0000000000..2851d560ce
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/spring-mapper-servlet.xml
@@ -0,0 +1,12 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
+ <property name="mappings">
+ <props>
+ </props>
+ </property>
+ </bean>
+
+</beans>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/web.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..354fcbfac6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,81 @@
+<web-app
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
+
+
+ <!-- Spring -->
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>WEB-INF/beans-services.xml</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.openecomp.server.listeners.OnboardingAppStartupListener</listener-class>
+ </listener>
+
+ <filter>
+ <filter-name>cross-origin</filter-name>
+ <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
+ <init-param>
+ <param-name>allowedOrigins</param-name>
+ <param-value>*</param-value>
+ </init-param>
+ <init-param>
+ <param-name>allowedMethods</param-name>
+ <param-value>*</param-value>
+ </init-param>
+ <init-param>
+ <param-name>allowedHeaders</param-name>
+ <param-value>*</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>cross-origin</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <!-- Spring WS Mapping -->
+ <servlet>
+ <servlet-name>spring-mapper</servlet-name>
+ <servlet-class>
+ org.springframework.web.servlet.DispatcherServlet
+ </servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <!-- CXF -->
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXF Servlet</display-name>
+ <servlet-class>
+ org.apache.cxf.transport.servlet.CXFServlet
+ </servlet-class>
+ <init-param>
+ <param-name>redirects-list</param-name>
+ <param-value>
+ /docs/(\S)+\.json
+ </param-value>
+ </init-param>
+ <init-param>
+ <param-name>redirect-attributes</param-name>
+ <param-value>
+ javax.servlet.include.request_uri
+ </param-value>
+ </init-param>
+ <init-param>
+ <param-name>redirect-servlet-name</param-name>
+ <param-value>default</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>spring-mapper</servlet-name>
+ <url-pattern>/ws/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/pom.xml
new file mode 100644
index 0000000000..597b017b0f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>notifications-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>notifications-rest-services</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-application-config-manager</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-common-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+ <!-- CXF -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>notifications-rest-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-notification-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ </dependencies>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsStatusToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsStatusToDto.java
new file mode 100644
index 0000000000..41376b040f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsStatusToDto.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.sdcrests.notifications.rest.mapping;
+
+import com.datastax.driver.core.utils.UUIDs;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.notification.dao.types.NotificationEntity;
+import org.openecomp.sdc.notification.dtos.NotificationsStatus;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.notifications.types.NotificationEntityDto;
+import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class MapNotificationsStatusToDto
+ extends MappingBase<NotificationsStatus, NotificationsStatusDto> {
+
+ private static final DateFormat formatter =
+ DateFormat.getDateTimeInstance(DateFormat.LONG,
+ DateFormat.SHORT);
+
+ @Override
+ public void doMapping(NotificationsStatus source, NotificationsStatusDto target) {
+
+ target.setLastScanned(source.getLastScanned());
+ target.setNewEntries(source.getNewEntries());
+ target.setEndOfPage(source.getEndOfPage());
+ target.setNumOfNotSeenNotifications(source.getNumOfNotSeenNotifications());
+ List<NotificationEntityDto> entityDtos = new ArrayList<>();
+ source.getNotifications()
+ .forEach(notification -> entityDtos.add(new NotificationEntityDto(notification.isRead(),
+ notification.getEventId(), notification.getEventType(),
+ JsonUtil.json2Object(notification.getEventAttributes(), Map.class),
+ extractDate(notification))));
+ target.setNotifications(entityDtos);
+ }
+
+ private String extractDate(NotificationEntity notification) {
+ return formatter.format(UUIDs.unixTimestamp
+ (notification
+ .getEventId()));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsToDto.java
new file mode 100644
index 0000000000..558453b7b6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/mapping/MapNotificationsToDto.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.sdcrests.notifications.rest.mapping;
+
+import com.datastax.driver.core.utils.UUIDs;
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.notification.dao.types.NotificationEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.notifications.types.NotificationEntityDto;
+import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class MapNotificationsToDto extends MappingBase<List<NotificationEntity>, NotificationsStatusDto> {
+ private static final DateFormat formatter =
+ DateFormat.getDateTimeInstance(DateFormat.LONG,
+ DateFormat.SHORT);
+ @Override
+ public void doMapping(List<NotificationEntity> source, NotificationsStatusDto target) {
+ List<NotificationEntityDto> entityDtos = new ArrayList<>();
+ if(CollectionUtils.isNotEmpty(source)) {
+ source.forEach(notification -> entityDtos.add(new NotificationEntityDto(notification.isRead(),
+ notification.getEventId(), notification.getEventType(), JsonUtil.json2Object(notification.getEventAttributes(), Map.class),
+ extractDate(notification))));
+ target.setNotifications(entityDtos);
+ target.setLastScanned(source.get(0).getEventId());
+ }
+ }
+
+ private String extractDate(NotificationEntity notification) {
+ return formatter.format(UUIDs.unixTimestamp
+ (notification
+ .getEventId()));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/Notifications.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/Notifications.java
new file mode 100644
index 0000000000..97199f604f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/Notifications.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.sdcrests.notifications.rest.services;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
+import org.openecomp.sdcrests.notifications.types.UpdateNotificationResponseStatus;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.lang.reflect.InvocationTargetException;
+import java.util.UUID;
+
+import static org.openecomp.sdcrests.common.RestConstants.LAST_DELIVERED_QUERY_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+@Path("/v1.0/notifications")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Notifications")
+@Validated
+public interface Notifications {
+ String LIMIT_QUERY_PARAM = "NOTIFICATION_ROWS_LIMIT";
+ String END_OF_PAGE_QUERY_PARAM = "END_OF_PAGE_EVENT_ID";
+
+ @GET
+ @ApiOperation(value = "Retrive all user notifications",
+ response = NotificationsStatusDto.class,
+ responseContainer = "List")
+ Response getNotifications(
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
+ @QueryParam(LAST_DELIVERED_QUERY_PARAM) UUID lastDelvered,
+ @QueryParam(END_OF_PAGE_QUERY_PARAM) UUID endOfPage);
+
+ @PUT
+ @Path("/{notificationId}")
+ @ApiOperation(value = "Mark notification as read",
+ response = UpdateNotificationResponseStatus.class)
+ Response markAsRead(
+ @ApiParam(value = "Notification Id") @PathParam("notificationId") String notificationId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
+ throws InvocationTargetException, IllegalAccessException;
+
+ @PUT
+ @Path("/last-seen/{notificationId}")
+ @ApiOperation(value = "Update Last Seen Notification",
+ response = UpdateNotificationResponseStatus.class)
+ Response updateLastSeenNotification(
+ @ApiParam(value = "Notification Id") @PathParam("notificationId") String notificationId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
+ throws InvocationTargetException, IllegalAccessException;
+
+ @GET
+ @Path("/worker")
+ @ApiOperation(value = "Retrive user not delivered notifications",
+ response = NotificationsStatusDto.class,
+ responseContainer = "List")
+ Response getNewNotificationsByOwnerId(
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
+ @QueryParam(LAST_DELIVERED_QUERY_PARAM) String eventId,
+ @QueryParam(LIMIT_QUERY_PARAM) String limit);
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/impl/NotificationsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/impl/NotificationsImpl.java
new file mode 100644
index 0000000000..8ff0ac0eea
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-services/src/main/java/org/openecomp/sdcrests/notifications/rest/services/impl/NotificationsImpl.java
@@ -0,0 +1,117 @@
+package org.openecomp.sdcrests.notifications.rest.services.impl;
+
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.logging.context.MdcUtil;
+import org.openecomp.sdc.logging.types.LoggerServiceName;
+import org.openecomp.sdc.notification.dao.types.NotificationEntity;
+import org.openecomp.sdc.notification.dtos.NotificationsStatus;
+import org.openecomp.sdc.notification.exceptons.NotificationNotExistException;
+import org.openecomp.sdc.notification.factories.NotificationsServiceFactory;
+import org.openecomp.sdc.notification.services.NotificationsService;
+import org.openecomp.sdcrests.notifications.rest.mapping.MapNotificationsStatusToDto;
+import org.openecomp.sdcrests.notifications.rest.mapping.MapNotificationsToDto;
+import org.openecomp.sdcrests.notifications.rest.services.Notifications;
+import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
+import org.openecomp.sdcrests.notifications.types.UpdateNotificationResponseStatus;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.Objects;
+import java.util.UUID;
+
+/**
+ * @author Avrahamg
+ * @since June 22, 2017
+ */
+@Named
+@Service("notifications")
+@Scope(value = "prototype")
+public class NotificationsImpl implements Notifications {
+
+ private static int selectionLimit = 10;
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(NotificationsImpl.class);
+ private NotificationsService notificationsService = NotificationsServiceFactory.getInstance().createInterface();
+
+ @Override
+ public Response getNotifications(String user, UUID lastDelivered, UUID endOfPage) {
+ MdcUtil.initMdc(LoggerServiceName.notifications.toString());
+ NotificationsStatus notificationsStatus = notificationsService
+ .getNotificationsStatus(user, lastDelivered, selectionLimit, endOfPage);
+ MapNotificationsStatusToDto converter = new MapNotificationsStatusToDto();
+ NotificationsStatusDto notificationsStatusDto = new NotificationsStatusDto();
+ converter.doMapping(notificationsStatus, notificationsStatusDto);
+
+ return Response.ok(notificationsStatusDto).build();
+ }
+
+ @Override
+ public Response updateLastSeenNotification(String notificationId, String user)
+ throws InvocationTargetException, IllegalAccessException {
+ UpdateNotificationResponseStatus
+ updateNotificationResponseStatus = new UpdateNotificationResponseStatus();
+ try {
+ notificationsService.updateLastSeenNotification(user, UUID.fromString(notificationId));
+ } catch (Exception ex) {
+ LOGGER.error(
+ String.format(Messages.FAILED_TO_UPDATE_LAST_SEEN_NOTIFICATION.getErrorMessage(),
+ user), ex);
+ updateNotificationResponseStatus.addStructureError(notificationId,
+ new ErrorMessage(ErrorLevel.ERROR,
+ Messages.FAILED_TO_UPDATE_LAST_SEEN_NOTIFICATION.getErrorMessage()));
+ }
+ return Response.ok(updateNotificationResponseStatus).build();
+ }
+
+ @Override
+ public Response markAsRead(String notificationId, String user)
+ throws InvocationTargetException, IllegalAccessException {
+
+ UpdateNotificationResponseStatus
+ updateNotificationResponseStatus = new UpdateNotificationResponseStatus();
+ try {
+ notificationsService.markAsRead(user, notificationId);
+ } catch (NotificationNotExistException ex) {
+ LOGGER.error(Messages.FAILED_TO_MARK_NOTIFICATION_AS_READ.getErrorMessage(), ex);
+ updateNotificationResponseStatus.addStructureError(
+ notificationId, new ErrorMessage(ErrorLevel.ERROR, Messages
+ .FAILED_TO_MARK_NOTIFICATION_AS_READ
+ .getErrorMessage()));
+ }
+ return Response.ok(updateNotificationResponseStatus).build();
+ }
+
+ @Override
+ public Response getNewNotificationsByOwnerId(String user, String eventId, String limitStr) {
+ MdcUtil.initMdc(LoggerServiceName.notifications.toString());
+
+ int limit = selectionLimit;
+
+ if (Objects.nonNull(limitStr)) {
+ try {
+ limit = Integer.parseInt(limitStr);
+ }
+ catch (NumberFormatException f) {
+ LOGGER.error("Non numeric selection list size value specified: " + limitStr);
+ }
+ }
+
+ List<NotificationEntity> notifications = Objects.isNull(eventId)
+ ? notificationsService.getNotificationsByOwnerId(user, limit)
+ : notificationsService.getNewNotificationsByOwnerId(user, UUID.fromString(eventId), limit);
+
+ MapNotificationsToDto converter = new MapNotificationsToDto();
+ NotificationsStatusDto notificationsStatusDto = new NotificationsStatusDto();
+ converter.doMapping(notifications, notificationsStatusDto);
+
+ return Response.ok(notificationsStatusDto).build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/pom.xml
new file mode 100644
index 0000000000..4a3300ad12
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>notifications-rest</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>notifications-rest-types</artifactId>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDto.java
new file mode 100644
index 0000000000..d41deb3a4d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDto.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.sdcrests.notifications.types;
+
+import java.util.Map;
+import java.util.UUID;
+
+public class NotificationEntityDto {
+ private boolean read;
+ private UUID eventId;
+ private String dateTime;
+ private String eventType;
+ private Map<String, Object> eventAttributes;
+
+ public NotificationEntityDto() {
+ }
+ public NotificationEntityDto(boolean read, UUID eventId, String eventType,
+ Map<String, Object> eventAttributes) {
+ this.read = read;
+ this.eventId = eventId;
+ this.eventType = eventType;
+ this.eventAttributes = eventAttributes;
+ }
+
+ public NotificationEntityDto(boolean read, UUID eventId,String eventType,
+ Map<String, Object> eventAttributes, String dateTime) {
+ this.read = read;
+ this.eventId = eventId;
+ this.dateTime = dateTime;
+ this.eventType = eventType;
+ this.eventAttributes = eventAttributes;
+ }
+
+ public boolean isRead() {
+ return read;
+ }
+
+ public void setRead(boolean read) {
+ this.read = read;
+ }
+
+ public UUID getEventId() {
+ return eventId;
+ }
+
+ public void setEventId(UUID eventId) {
+ this.eventId = eventId;
+ }
+
+ public String getEventType() {
+ return eventType;
+ }
+
+ public void setEventType(String eventType) {
+ this.eventType = eventType;
+ }
+
+ public Map<String, Object> getEventAttributes() {
+ return eventAttributes;
+ }
+
+ public void setEventAttributes(Map<String, Object> eventAttributes) {
+ this.eventAttributes = eventAttributes;
+ }
+
+ public String getDateTime() {
+ return dateTime;
+ }
+
+ public void setDateTime(String dateTime) {
+ this.dateTime = dateTime;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToVspCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationResponseStatus.java
index f009d8bbc6..a0273d51e0 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToVspCreationDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationResponseStatus.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,15 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdcrests.vsp.rest.mapping;
+package org.openecomp.sdcrests.notifications.types;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdcrests.mapping.MappingBase;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto;
-
-public class MapVspDetailsToVspCreationDto extends MappingBase<VspDetails, VspCreationDto> {
- @Override
- public void doMapping(VspDetails source, VspCreationDto target) {
- target.setVspId(source.getId());
- }
+public enum NotificationResponseStatus {
+ Success,
+ Failure
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDto.java
new file mode 100644
index 0000000000..182245cc12
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDto.java
@@ -0,0 +1,61 @@
+package org.openecomp.sdcrests.notifications.types;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * @author avrahamg
+ * @since June 29, 2017
+ */
+public class NotificationsStatusDto {
+ private List<NotificationEntityDto> notifications;
+ private List<UUID> newEntries = new ArrayList<>();
+ private UUID lastScanned;
+ private UUID endOfPage;
+ private long numOfNotSeenNotifications;
+
+ public NotificationsStatusDto() {
+ }
+
+ public List<NotificationEntityDto> getNotifications() {
+ return notifications;
+ }
+
+ public void setNotifications(
+ List<NotificationEntityDto> notifications) {
+ this.notifications = notifications;
+ }
+
+ public List<UUID> getNewEntries() {
+ return newEntries;
+ }
+
+ public void setNewEntries(List<UUID> newEntries) {
+ this.newEntries = newEntries;
+ }
+
+ public UUID getLastScanned() {
+ return lastScanned;
+ }
+
+ public void setLastScanned(UUID lastScanned) {
+ this.lastScanned = lastScanned;
+ }
+
+ public UUID getEndOfPage() {
+ return endOfPage;
+ }
+
+ public void setEndOfPage(UUID endOfPage) {
+ this.endOfPage = endOfPage;
+ }
+
+ public long getNumOfNotSeenNotifications() {
+ return numOfNotSeenNotifications;
+ }
+
+ public void setNumOfNotSeenNotifications(long numOfNotSeenNotifications) {
+ this.numOfNotSeenNotifications = numOfNotSeenNotifications;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatus.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatus.java
new file mode 100644
index 0000000000..9e985726dc
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/main/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatus.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.sdcrests.notifications.types;
+
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.openecomp.sdcrests.notifications.types.NotificationResponseStatus.Failure;
+import static org.openecomp.sdcrests.notifications.types.NotificationResponseStatus.Success;
+
+/**
+ * Created by TALIO on 4/27/2016.
+ */
+public class UpdateNotificationResponseStatus {
+ private Map<String, List<ErrorMessage>> errors = new HashMap<>();
+ private NotificationResponseStatus status = Success;
+
+ public Map<String, List<ErrorMessage>> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(Map<String, List<ErrorMessage>> errors) {
+ this.errors = errors;
+ }
+
+ public NotificationResponseStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(NotificationResponseStatus status) {
+ this.status = status;
+ }
+
+ public void addStructureError(String notificationId, ErrorMessage errorMessage) {
+ List<ErrorMessage> errorList =
+ errors.computeIfAbsent(notificationId, k -> new ArrayList<>());
+ errorList.add(errorMessage);
+ if (ErrorLevel.ERROR.equals(errorMessage.getLevel())) {
+ status = Failure;
+ }
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/pom.xml
new file mode 100644
index 0000000000..d35c5afbee
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-rest-webapp</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>notifications-rest</artifactId>
+
+ <packaging>pom</packaging>
+
+
+ <modules>
+ <module>notifications-rest-types</module>
+ <module>notifications-rest-services</module>
+ </modules>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml
index 84c4eb408a..32975b3ebf 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml
@@ -16,13 +16,23 @@
<dependencies>
<dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.openecomp.sdc.onboarding</groupId>
<artifactId>vendor-license-rest-services</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>activity-log-rest-services</artifactId>
+ <artifactId>openecomp-sdc-notification-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-notification-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -42,6 +52,21 @@
</dependency>
<dependency>
<groupId>org.openecomp.sdc</groupId>
+ <artifactId>conflict-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-permissions-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>notifications-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
<artifactId>application-config-rest-services</artifactId>
<version>${project.version}</version>
</dependency>
@@ -108,6 +133,11 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.framework.version}</version>
</dependency>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java
index 18465cd00c..e10f6a57ab 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java
@@ -23,9 +23,6 @@ package org.openecomp.server.filters;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import java.io.IOException;
-import java.security.Principal;
-import java.util.Base64;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -35,6 +32,9 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.security.Principal;
+import java.util.Base64;
public class ActionAuthenticationFilter implements Filter {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java
index 82e4fa80d9..f54b06d46a 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthorizationFilter.java
@@ -20,7 +20,6 @@
package org.openecomp.server.filters;
-import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -29,6 +28,7 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
public class ActionAuthorizationFilter implements Filter {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java
new file mode 100644
index 0000000000..b317fa6bf5
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java
@@ -0,0 +1,45 @@
+package org.openecomp.server.filters;
+
+import org.openecomp.sdc.common.session.SessionContextProvider;
+import org.openecomp.sdc.common.session.SessionContextProviderFactory;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+
+public class SessionContextFilter implements Filter {
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+
+ }
+
+ @Override
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
+ FilterChain filterChain) throws IOException, ServletException {
+ SessionContextProvider contextProvider =
+ SessionContextProviderFactory.getInstance().createInterface();
+
+ try {
+ if (servletRequest instanceof HttpServletRequest) {
+ String userName = ((HttpServletRequest) servletRequest).getHeader(USER_ID_HEADER_PARAM);
+ contextProvider.create(userName);
+ }
+
+ filterChain.doFilter(servletRequest, servletResponse);
+ } finally {
+ contextProvider.close();
+ }
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml
index 8f4a2db73e..e43fa017d8 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/beans-services.xml
@@ -36,24 +36,14 @@
<!-- aspect beans -->
<bean id = "healthCheck" class="org.openecomp.sdcrests.health.rest.services.HealthCheckImpl"/>
- <!--aop:config>
- < aspect pointcuts>
- <aop:pointcut id="loggingDebugPointcut" expression="execution(* org.openecomp.sdc.*.*.*(..))"/>
-
- <advices>
- <aop:aspect id="logDebugAspect" ref="debugAspect">
- <aop:before pointcut-ref="loggingDebugPointcut" method="debugEnterMethod"/>
- <aop:after-returning pointcut-ref="loggingDebugPointcut" method="debugExitMethod"/>
- </aop:aspect>
- </aop:config-->
-
-
-
-
+ <bean id = "itemPermissions" class="org.openecomp.sdcrests.itempermissions.rest.services.ItemPermissionsImpl"/>
+ <bean id = "notifications" class="org.openecomp.sdcrests.notifications.rest.services.impl.NotificationsImpl"/>
<!-- RESTful Services -->
<jaxrs:server id="restContainer" address="/">
<jaxrs:serviceBeans>
+ <ref bean="versions"/>
+ <ref bean="conflicts"/>
<ref bean="vendorLicenseModels"/>
<ref bean="licenseAgreements"/>
<ref bean="featureGroups"/>
@@ -75,9 +65,10 @@
<ref bean="deploymentFlavors"/>
<ref bean="images"/>
<ref bean="orchestrationTemplateCandidate"/>
- <ref bean="componentDependencyModel"/>
- <ref bean="activityLog"/>
+ <ref bean="componentDependencies"/>
<ref bean="healthCheck"/>
+ <ref bean="itemPermissions"/>
+ <ref bean="notifications"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml
new file mode 100644
index 0000000000..437df7945f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/spring-mapper-servlet.xml
@@ -0,0 +1,13 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+
+ <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
+ <property name="mappings">
+ <props>
+ </props>
+ </property>
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
index 35865f988e..de88197a8a 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
@@ -23,6 +23,19 @@
</listener>
<filter>
+ <filter-name>PermissionsFilter</filter-name>
+ <filter-class>org.openecomp.sdc.itempermissions.servlet.PermissionsFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>PermissionsFilter</filter-name>
+ <url-pattern>/v1.0/vendor-license-models/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>PermissionsFilter</filter-name>
+ <url-pattern>/v1.0/vendor-software-products/*</url-pattern>
+ </filter-mapping>
+
+ <filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<init-param>
@@ -68,6 +81,22 @@
<filter-name>LoggingServletFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
+ <filter>
+ <filter-name>SessionContextFilter</filter-name>
+ <filter-class>org.openecomp.server.filters.SessionContextFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>SessionContextFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <!-- Spring WS Mapping -->
+ <servlet>
+ <servlet-name>spring-mapper</servlet-name>
+ <servlet-class>
+ org.springframework.web.servlet.DispatcherServlet
+ </servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
<!-- CXF -->
<servlet>
<servlet-name>CXFServlet</servlet-name>
@@ -94,7 +123,10 @@
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
- <!--servlet-name>logger-aspect</servlet-name-->
+ <servlet-name>spring-mapper</servlet-name>
+ <url-pattern>/ws/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/common/RestConstants.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/common/RestConstants.java
index 7bc1082ebe..302af10dc2 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/common/RestConstants.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/common/RestConstants.java
@@ -21,10 +21,12 @@
package org.openecomp.sdcrests.common;
public class RestConstants {
- public static final String USER_ID_HEADER_PARAM = "USER_ID";
// value Should be equal to com.tlv.sdc.common.api.Constants#USER_ID_HEADER
+ public static final String USER_ID_HEADER_PARAM = "USER_ID";
+ public static final String LAST_DELIVERED_QUERY_PARAM = "LAST_DELIVERED_EVENT_ID";
public static final String USER_MISSING_ERROR_MSG =
"Field does not conform to predefined criteria : user : may not be null";
+
public static final String INVALID_JSON_ERROR_MESSAGE =
"Field does not conform to predefined criteria : body :must be in JSON format";
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/common/types/VersionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/common/types/VersionDto.java
deleted file mode 100644
index b5b86c65a2..0000000000
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/common/types/VersionDto.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.openecomp.sdcrests.common.types;
-
-/**
- * Created by SVISHNEV on 3/5/2017.
- */
-public class VersionDto {
- String id;
- String label;
-
- public VersionDto(){
-
- }
-
- public VersionDto(String id, String label) {
- this.id = id;
- this.label = label;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getLabel() {
- return label;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/EchoMapMapping.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/EchoMapMapping.java
new file mode 100644
index 0000000000..81c2f37a66
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/EchoMapMapping.java
@@ -0,0 +1,14 @@
+package org.openecomp.sdcrests.mapping;
+
+import java.util.HashMap;
+
+/**
+ * Created by ayalaben on 9/12/2017
+ */
+public class EchoMapMapping extends MappingBase<HashMap<String,String>,HashMap<String,String>> {
+
+ @Override
+public void doMapping(HashMap<String,String> source, HashMap<String, String> target) {
+ target.putAll(source);
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/EchoMapping.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/EchoMapping.java
new file mode 100644
index 0000000000..4e5a22e3c7
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/EchoMapping.java
@@ -0,0 +1,8 @@
+package org.openecomp.sdcrests.mapping;
+
+public class EchoMapping extends MappingBase <Object,Object>{
+ @Override
+ public void doMapping(Object source, Object target) {
+ target = source;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java
index 2310c0f6ce..25c2be9158 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java
@@ -23,15 +23,11 @@ package org.openecomp.sdcrests.mapping;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerServiceName;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
/**
* Base class for all mapping classes. Mapping classes will perform data mapping from source object
* to target object Base class provides following<br> <ol> <li>provides life cycle of
@@ -55,8 +51,6 @@ public abstract class MappingBase<S, T> {
* @return <code>T</code> - instance of type <code>T</code>
*/
- private final Logger logger = (Logger) LoggerFactory.getLogger(this.getClass().getName());
-
public final T applyMapping(final S source, Class<T> clazz) {
T target = (T) instantiateTarget(clazz);
if (source == null || target == null) {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml
index 9970dfbdfd..d44e0c8b98 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml
@@ -22,8 +22,12 @@
<module>/validation-rest</module>
<module>/action-library-rest</module>
<module>/application-config-rest</module>
- <module>/activity-log-rest</module>
<module>/healthcheck-rest</module>
+ <module>conflict-rest</module>
+ <module>item-permissions-rest</module>
+ <module>item-rest</module>
+ <module>notifications-fe</module>
+ <module>notifications-rest</module>
</modules>
</project>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java
index b08bc10727..349f0bdecf 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java
@@ -24,7 +24,6 @@ import io.swagger.annotations.Api;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.springframework.validation.annotation.Validated;
-import java.io.InputStream;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -32,6 +31,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import java.io.InputStream;
@Path("/v1.0/validation")
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java
index fd5bea3380..399f665655 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java
@@ -25,7 +25,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
-import java.io.InputStream;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -33,6 +32,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import java.io.InputStream;
@Path("/v1.0/validation")
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java
index 15675f14de..f43ff60b9f 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java
@@ -39,10 +39,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.io.IOException;
-import java.io.InputStream;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.io.InputStream;
@Named
@Service("validation")
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml
index 643addc0aa..cec09f0e8f 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml
@@ -30,13 +30,13 @@
</dependency>
<dependency>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-license-manager</artifactId>
+ <artifactId>openecomp-sdc-item-permissions-manager</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Spring -->
- <dependency>
+<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.framework.version}</version>
@@ -60,7 +60,7 @@
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.framework.version}</version>
- </dependency>
+ </dependency>-->
<!-- CXF -->
<dependency>
@@ -79,11 +79,11 @@
<version>${http.client.version}</version>
</dependency>
- <dependency>
+<!-- <dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${ws.rs.version}</version>
- </dependency>
+ </dependency>-->
<!-- Other Stuff-->
<!--dependency>
@@ -105,8 +105,13 @@
<artifactId>openecomp-sdc-vendor-software-product-manager</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
- </dependencies>
+ </dependencies>
<build>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPoolLimits.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPoolLimits.java
index 3e7adc845d..fb71b0a001 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPoolLimits.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPoolLimits.java
@@ -1,12 +1,8 @@
package org.openecomp.sdcrests.vendorlicense.rest;
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
-
import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto;
import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto;
import org.springframework.validation.annotation.Validated;
@@ -15,9 +11,9 @@ import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
-import javax.ws.rs.POST;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@@ -25,8 +21,11 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-@Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/entitlement-pools" +
- "/{entitlementPoolId}/limits")
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+@Path(
+ "/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/entitlement-pools/{entitlementPoolId}/limits")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Api(value = "Vendor License Model - Entitlement Pool Limits")
@@ -37,16 +36,16 @@ public interface EntitlementPoolLimits {
@Path("/")
@ApiOperation(value = "Create vendor entitlement pool limits")
Response createLimit(@Valid LimitRequestDto request,
- @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
- String vlmId,
- @ApiParam(value = "Vendor license model version Id") @PathParam
- ("versionId")
- String versionId,
- @ApiParam(value = "Vendor license model Entitlement Pool Id")
- @PathParam("entitlementPoolId")
- String entitlementPoolId ,
- @NotNull(message = USER_MISSING_ERROR_MSG)
- @HeaderParam(USER_ID_HEADER_PARAM) String user);
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @ApiParam(value = "Vendor license model version Id") @PathParam
+ ("versionId")
+ String versionId,
+ @ApiParam(value = "Vendor license model Entitlement Pool Id")
+ @PathParam("entitlementPoolId")
+ String entitlementPoolId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
@GET
@@ -72,7 +71,7 @@ public interface EntitlementPoolLimits {
String versionId,
@ApiParam(value = "Vendor license model Entitlement Pool Id")
@PathParam("entitlementPoolId")
- String entitlementPoolId ,
+ String entitlementPoolId,
@NotNull(message = USER_MISSING_ERROR_MSG)
@PathParam("limitId") String limitId,
@HeaderParam(USER_ID_HEADER_PARAM) String user);
@@ -94,10 +93,11 @@ public interface EntitlementPoolLimits {
@Path("/{limitId}")
@ApiOperation(value = "Delete vendor entitlement pool limit")
Response deleteLimit(
- @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
- @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
- @ApiParam(value = "Vendor license model Entitlement pool Id") @PathParam("entitlementPoolId") String entitlementPoolId,
- @PathParam("limitId") String limitId,
- @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
+ @ApiParam(value = "Vendor license model Entitlement pool Id") @PathParam("entitlementPoolId")
+ String entitlementPoolId,
+ @PathParam("limitId") String limitId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java
index a3a4e4d0d8..7344459077 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java
@@ -20,9 +20,6 @@
package org.openecomp.sdcrests.vendorlicense.rest;
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -46,6 +43,9 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
@Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/feature-groups")
@Produces(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java
index bd31dc5607..0033304e5a 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java
@@ -1,8 +1,5 @@
package org.openecomp.sdcrests.vendorlicense.rest;
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -24,8 +21,11 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-@Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-key-groups" +
- "/{licenseKeyGroupId}/limits")
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+@Path(
+ "/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-key-groups/{licenseKeyGroupId}/limits")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Api(value = "Vendor License Model - License Key Group Limits")
@@ -43,7 +43,7 @@ public interface LicenseKeyGroupLimits {
String versionId,
@ApiParam(value = "Vendor license model License Key Group Id")
@PathParam("licenseKeyGroupId")
- String licenseKeyGroupId ,
+ String licenseKeyGroupId,
@NotNull(message = USER_MISSING_ERROR_MSG)
@HeaderParam(USER_ID_HEADER_PARAM) String user);
@@ -70,7 +70,7 @@ public interface LicenseKeyGroupLimits {
String versionId,
@ApiParam(value = "Vendor license model License Key Group Id")
@PathParam("licenseKeyGroupId")
- String licenseKeyGroupId ,
+ String licenseKeyGroupId,
@NotNull(message = USER_MISSING_ERROR_MSG)
@PathParam("limitId") String limitId,
@HeaderParam(USER_ID_HEADER_PARAM) String user);
@@ -88,13 +88,14 @@ public interface LicenseKeyGroupLimits {
String limitId,
@NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
- @DELETE
- @Path("/{limitId}")
- @ApiOperation(value = "Delete vendor license key group limit")
- Response deleteLimit(
- @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
- @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
- @ApiParam(value = "Vendor license model license key group Id") @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
- @PathParam("limitId") String limitId,
- @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
+ @DELETE
+ @Path("/{limitId}")
+ @ApiOperation(value = "Delete vendor license key group limit")
+ Response deleteLimit(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
+ @ApiParam(value = "Vendor license model license key group Id") @PathParam("licenseKeyGroupId")
+ String licenseKeyGroupId,
+ @PathParam("limitId") String limitId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java
index 23a0960a3a..9b1c09603c 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java
@@ -24,6 +24,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.openecomp.sdcrests.common.RestConstants;
+import org.openecomp.sdcrests.item.types.ItemDto;
import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto;
import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto;
@@ -31,7 +32,16 @@ import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -45,65 +55,65 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG
@Validated
public interface VendorLicenseModels {
- @GET
- @Path("/")
- @ApiOperation(value = "List vendor license models",
- response = VendorLicenseModelEntityDto.class,
- responseContainer = "List")
- Response listLicenseModels(@ApiParam(
- value = "Currently supported value: 'Final' - only vendor License models with final versions "
- + "will be return - with their latest final version")
- @QueryParam("versionFilter") String versionFilter,
- @NotNull(message = USER_MISSING_ERROR_MSG)
- @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor license models",
+ response = ItemDto.class,
+ responseContainer = "List")
+ Response listLicenseModels(@ApiParam(value =
+ "Currently supported value: 'Certified' - only vendor License models with final versions "
+ + "will be return - with their latest final version")
+ @QueryParam("versionFilter") String versionStatus,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
- @POST
- @Path("/")
- @ApiOperation(value = "Create vendor license model")
- Response createLicenseModel(@Valid VendorLicenseModelRequestDto request,
- @NotNull(message = USER_MISSING_ERROR_MSG)
- @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create vendor license model")
+ Response createLicenseModel(@Valid VendorLicenseModelRequestDto request,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
- @PUT
- @Path("/{vlmId}/versions/{versionId}")
- @ApiOperation(value = "Update vendor license model")
- Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
- @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
- String vlmId,
- @ApiParam(value = "Vendor license model version Id") @PathParam
- ("versionId") String versionId,
- @NotNull(message = USER_MISSING_ERROR_MSG)
- @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+ @PUT
+ @Path("/{vlmId}/versions/{versionId}")
+ @ApiOperation(value = "Update vendor license model")
+ Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
+ @ApiParam(value = "Vendor license model Id")
+ @PathParam("vlmId") String vlmId,
+ @ApiParam(value = "Vendor license model version Id")
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
- @GET
- @Path("/{vlmId}/versions/{versionId}")
- @ApiOperation(value = "Get vendor license model",
- response = VendorLicenseModelEntityDto.class)
- Response getLicenseModel(
- @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
- @ApiParam(value = "Vendor license model version Id") @PathParam
- ("versionId") String versionId,
- @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
- String user);
+ @GET
+ @Path("/{vlmId}/versions/{versionId}")
+ @ApiOperation(value = "Get vendor license model",
+ response = VendorLicenseModelEntityDto.class)
+ Response getLicenseModel(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @ApiParam(value = "Vendor license model version Id") @PathParam
+ ("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
+ String user);
- @DELETE
- @Path("/{vlmId}/versions/{versionId}")
- @ApiOperation(value = "Delete vendor license model")
- Response deleteLicenseModel(
- @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
- @ApiParam(value = "Vendor license model version Id") @PathParam
- ("versionId") String versionId,
- @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
- String user);
+ @DELETE
+ @Path("/{vlmId}/versions/{versionId}")
+ @ApiOperation(value = "Delete vendor license model")
+ Response deleteLicenseModel(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @ApiParam(value = "Vendor license model version Id") @PathParam
+ ("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
+ String user);
- @PUT
- @Path("/{vlmId}/versions/{versionId}/actions")
- @ApiOperation(value = "Update vendor license model")
- Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
- @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
- String vlmId,
- @ApiParam(value = "Vendor license model version Id") @PathParam
- ("versionId") String versionId,
- @NotNull(message = USER_MISSING_ERROR_MSG)
- @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
+ @PUT
+ @Path("/{vlmId}/versions/{versionId}/actions")
+ @ApiOperation(value = "Update vendor license model")
+ Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @ApiParam(value = "Vendor license model version Id") @PathParam
+ ("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/src/main/java/org/openecomp/sdcrests/activitylog/types/ActivityType.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDto.java
index 80160bc202..7bdde1d592 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-types/src/main/java/org/openecomp/sdcrests/activitylog/types/ActivityType.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDto.java
@@ -18,36 +18,19 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdcrests.activitylog.types;
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
-import java.io.Serializable;
-
-public enum ActivityType implements Serializable {
-
- CREATE_NEW("Create New"),
- CHECKOUT("Check Out"),
- UNDO_CHECKOUT("Undo Check Out"),
- CHECKIN("Check In"),
- UPLOAD_HEAT("Upload Heat"),
- UPLOAD_MONITORING_FILE("Upload Monitoring File"),
- SUBMIT("Submit");
-
- // after collaboration will be added - this will be added:
- /*
- CREATE_NEW,
- COMMIT,
- ADD_PERMISSION,
- REMOVE_PERMISSION,
- */
-
- private String name;
-
- ActivityType(String name) {
- this.name = name;
- }
+import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
+public class MapVendorLicenseModelEntityToDto
+ extends MappingBase<VendorLicenseModelEntity, VendorLicenseModelEntityDto> {
@Override
- public String toString() {
- return name;
+ public void doMapping(VendorLicenseModelEntity source, VendorLicenseModelEntityDto target) {
+ target.setId(source.getId());
+ target.setVendorName(source.getVendorName());
+ target.setDescription(source.getDescription());
+ target.setIconRef(source.getIconRef());
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java
deleted file mode 100644
index 7c2db85d2e..0000000000
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.openecomp.sdcrests.vendorlicense.rest.mapping;
-
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.openecomp.sdcrests.common.types.VersionDto;
-import org.openecomp.sdcrests.mapping.MappingBase;
-import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
-
-import java.util.stream.Collectors;
-
-public class MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto
- extends MappingBase<VersionedVendorLicenseModel, VendorLicenseModelEntityDto> {
- @Override
- public void doMapping(VersionedVendorLicenseModel source, VendorLicenseModelEntityDto target) {
- VendorLicenseModelEntity sourceVlm = source.getVendorLicenseModel();
- target.setId(sourceVlm.getId());
- target.setVendorName(sourceVlm.getVendorName());
- target.setDescription(sourceVlm.getDescription());
- target.setIconRef(sourceVlm.getIconRef());
-
- VersionInfo versionInfo = source.getVersionInfo();
- if (versionInfo != null) {
- target.setVersion(new VersionDto(versionInfo.getActiveVersion().toString(),versionInfo
- .getActiveVersion().toString()));
- target.setStatus(versionInfo.getStatus());
- target.setLockingUser(versionInfo.getLockingUser());
-
- if (!CommonMethods.isEmpty(versionInfo.getViewableVersions())) {
- target.setViewableVersions(versionInfo.getViewableVersions().stream().map(version->new
- VersionDto(version.toString(),version.toString()))
- .collect(Collectors.toList()));
- }
-
- if (!CommonMethods.isEmpty(versionInfo.getFinalVersions())) {
- target.setFinalVersions(versionInfo.getFinalVersions().stream().map(version->new
- VersionDto(version.toString(),version.toString()))
- .collect(Collectors.toList()));
- }
- }
- }
-}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java
index 4365ace85d..a866278cf3 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java
@@ -17,14 +17,12 @@ import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitRequestDtoToLim
import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto;
import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto;
import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
-import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.util.Collection;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.util.Collection;
@Named
@Service("entitlementPoolLimits")
@@ -32,7 +30,7 @@ import javax.ws.rs.core.Response;
public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private VendorLicenseManager vendorLicenseManager =
- VendorLicenseManagerFactory.getInstance().createInterface();
+ VendorLicenseManagerFactory.getInstance().createInterface();
public static final String parent = "EntitlementPool";
@@ -45,20 +43,20 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId);
MdcUtil.initMdc(LoggerServiceName.Create_LIMIT.toString());
- vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ Version version = new Version(versionId);
+ vendorLicenseManager
+ .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId));
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
- limitEntity.setEpLkgId(entitlementPoolId);
+ new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class);
limitEntity.setVendorLicenseModelId(vlmId);
+ limitEntity.setVersion(version);
+ limitEntity.setEpLkgId(entitlementPoolId);
limitEntity.setParent(parent);
- LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user);
+ LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity);
MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto();
- LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto
- .class);
+ LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto.class);
/*StringWrapperResponse result =
createdLimit != null ? new StringWrapperResponse(createdLimit.getId())
@@ -67,25 +65,25 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId);
//return Response.ok(result).build();
- return Response.ok(createdLimitDto != null ? createdLimitDto : null)
- .build();
+ return Response.ok(createdLimitDto != null ? createdLimitDto : null).build();
}
@Override
public Response listLimits(String vlmId, String versionId, String entitlementPoolId, String
- user) {
+ user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId);
MdcUtil.initMdc(LoggerServiceName.List_EP.toString());
- vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ Version version = new Version(versionId);
+ vendorLicenseManager
+ .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId));
Collection<LimitEntity> limits =
- vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), entitlementPoolId, user);
+ vendorLicenseManager.listLimits(vlmId, version, entitlementPoolId);
GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>();
MapLimitEntityToLimitDto outputMapper =
- new MapLimitEntityToLimitDto();
+ new MapLimitEntityToLimitDto();
for (LimitEntity limit : limits) {
result.add(outputMapper.applyMapping(limit, LimitEntityDto.class));
}
@@ -96,28 +94,28 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
}
@Override
- public Response getLimit( String vlmId, String versionId, String entitlementPoolId,
- String limitId, String user) {
- mdcDataDebugMessage.debugEntryMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId,
- limitId);
+ public Response getLimit(String vlmId, String versionId, String entitlementPoolId,
+ String limitId, String user) {
+ mdcDataDebugMessage
+ .debugEntryMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId, limitId);
MdcUtil.initMdc(LoggerServiceName.Get_LIMIT.toString());
- vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
- LimitEntity epInput = new LimitEntity();
- epInput.setVendorLicenseModelId(vlmId);
- epInput.setVersion(Version.valueOf(versionId));
- epInput.setEpLkgId(entitlementPoolId);
- epInput.setId(limitId);
- LimitEntity limit = vendorLicenseManager.getLimit(epInput, user);
+ Version version = new Version(versionId);
+ vendorLicenseManager
+ .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId));
+ LimitEntity limitInput = new LimitEntity();
+ limitInput.setVendorLicenseModelId(vlmId);
+ limitInput.setVersion(version);
+ limitInput.setEpLkgId(entitlementPoolId);
+ limitInput.setId(limitId);
+ LimitEntity limit = vendorLicenseManager.getLimit(limitInput);
LimitEntityDto entitlementPoolEntityDto = limit == null ? null :
- new MapLimitEntityToLimitDto()
- .applyMapping(limit, LimitEntityDto.class);
+ new MapLimitEntityToLimitDto().applyMapping(limit, LimitEntityDto.class);
- mdcDataDebugMessage.debugExitMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId,
- limitId);
+ mdcDataDebugMessage
+ .debugExitMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId, limitId);
return Response.ok(entitlementPoolEntityDto).build();
}
@@ -129,26 +127,27 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
String entitlementPoolId,
String limitId,
String user) {
- mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id",
- limitId);
+ mdcDataDebugMessage
+ .debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id", limitId);
MdcUtil.initMdc(LoggerServiceName.Update_LIMIT.toString());
- vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ Version version = new Version(versionId);
+ vendorLicenseManager
+ .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId));
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
- limitEntity.setEpLkgId(entitlementPoolId);
+ new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class);
limitEntity.setVendorLicenseModelId(vlmId);
+ limitEntity.setVersion(version);
+ limitEntity.setEpLkgId(entitlementPoolId);
limitEntity.setId(limitId);
limitEntity.setParent(parent);
- vendorLicenseManager.updateLimit(limitEntity, user);
+ vendorLicenseManager.updateLimit(limitEntity);
- mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id",
- limitId);
+ mdcDataDebugMessage
+ .debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id", limitId);
return Response.ok().build();
}
@@ -156,29 +155,33 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
/**
* Delete entitlement pool.
*
- * @param vlmId the vlm id
- * @param entitlementPoolId the entitlement pool id
- * @param limitId the limitId
- * @param user the user
+ * @param vlmId the vlm id
+ * @param entitlementPoolId the entitlement pool id
+ * @param limitId the limitId
+ * @param user the user
* @return the response
*/
public Response deleteLimit(String vlmId, String versionId, String entitlementPoolId,
String limitId, String user) {
- mdcDataDebugMessage.debugEntryMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId, entitlementPoolId, limitId);
-
+ mdcDataDebugMessage.debugEntryMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId,
+ entitlementPoolId, limitId);
MdcUtil.initMdc(LoggerServiceName.Delete_LIMIT.toString());
- vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+
+ Version version = new Version(versionId);
+ vendorLicenseManager.getEntitlementPool(
+ new EntitlementPoolEntity(vlmId, version, entitlementPoolId));
LimitEntity limitInput = new LimitEntity();
limitInput.setVendorLicenseModelId(vlmId);
+ limitInput.setVersion(version);
limitInput.setEpLkgId(entitlementPoolId);
limitInput.setId(limitId);
limitInput.setParent(parent);
- vendorLicenseManager.deleteLimit(limitInput, user);
+ vendorLicenseManager.deleteLimit(limitInput);
- mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId, entitlementPoolId, limitId);
+ mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId,
+ entitlementPoolId, limitId);
return Response.ok().build();
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java
index 120bb3d6a0..8c31303b3b 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java
@@ -34,7 +34,6 @@ import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto;
import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto;
import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
@@ -64,7 +63,7 @@ public class EntitlementPoolsImpl implements EntitlementPools {
MdcUtil.initMdc(LoggerServiceName.List_EP.toString());
Collection<EntitlementPoolEntity> entitlementPools =
- vendorLicenseManager.listEntitlementPools(vlmId, Version.valueOf(versionId), user);
+ vendorLicenseManager.listEntitlementPools(vlmId, new Version(versionId));
GenericCollectionWrapper<EntitlementPoolEntityDto> result = new GenericCollectionWrapper<>();
MapEntitlementPoolEntityToEntitlementPoolEntityDto outputMapper =
@@ -96,9 +95,10 @@ public class EntitlementPoolsImpl implements EntitlementPools {
new MapEntitlementPoolRequestDtoToEntitlementPoolEntity()
.applyMapping(request, EntitlementPoolEntity.class);
entitlementPoolEntity.setVendorLicenseModelId(vlmId);
+ entitlementPoolEntity.setVersion(new Version(versionId));
EntitlementPoolEntity createdEntitlementPool =
- vendorLicenseManager.createEntitlementPool(entitlementPoolEntity, user);
+ vendorLicenseManager.createEntitlementPool(entitlementPoolEntity);
StringWrapperResponse result =
createdEntitlementPool != null ? new StringWrapperResponse(createdEntitlementPool.getId())
: null;
@@ -127,9 +127,10 @@ public class EntitlementPoolsImpl implements EntitlementPools {
new MapEntitlementPoolRequestDtoToEntitlementPoolEntity()
.applyMapping(request, EntitlementPoolEntity.class);
entitlementPoolEntity.setVendorLicenseModelId(vlmId);
+ entitlementPoolEntity.setVersion(new Version(versionId));
entitlementPoolEntity.setId(entitlementPoolId);
- vendorLicenseManager.updateEntitlementPool(entitlementPoolEntity, user);
+ vendorLicenseManager.updateEntitlementPool(entitlementPoolEntity);
mdcDataDebugMessage.debugExitMessage("VLM id, EP id", vlmId, entitlementPoolId);
@@ -140,12 +141,12 @@ public class EntitlementPoolsImpl implements EntitlementPools {
* Gets entitlement pool.
*
* @param vlmId the vlm id
- * @param version the version
+ * @param versionId the version id
* @param entitlementPoolId the entitlement pool id
* @param user the user
* @return the entitlement pool
*/
- public Response getEntitlementPool(String vlmId, String version, String entitlementPoolId,
+ public Response getEntitlementPool(String vlmId, String versionId, String entitlementPoolId,
String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", vlmId, entitlementPoolId);
@@ -153,9 +154,9 @@ public class EntitlementPoolsImpl implements EntitlementPools {
MdcUtil.initMdc(LoggerServiceName.Get_EP.toString());
EntitlementPoolEntity epInput = new EntitlementPoolEntity();
epInput.setVendorLicenseModelId(vlmId);
- epInput.setVersion(Version.valueOf(version));
+ epInput.setVersion(new Version(versionId));
epInput.setId(entitlementPoolId);
- EntitlementPoolEntity entitlementPool = vendorLicenseManager.getEntitlementPool(epInput, user);
+ EntitlementPoolEntity entitlementPool = vendorLicenseManager.getEntitlementPool(epInput);
EntitlementPoolEntityDto entitlementPoolEntityDto = entitlementPool == null ? null :
new MapEntitlementPoolEntityToEntitlementPoolEntityDto()
@@ -183,7 +184,8 @@ public class EntitlementPoolsImpl implements EntitlementPools {
EntitlementPoolEntity epInput = new EntitlementPoolEntity();
epInput.setVendorLicenseModelId(vlmId);
epInput.setId(entitlementPoolId);
- vendorLicenseManager.deleteEntitlementPool(epInput, user);
+ epInput.setVersion(new Version(versionId));
+ vendorLicenseManager.deleteEntitlementPool(epInput);
mdcDataDebugMessage.debugExitMessage("VLM id, EP id", vlmId, entitlementPoolId);
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java
index 593ed1939f..9f87f98bb5 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java
@@ -44,7 +44,6 @@ import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupUpdateRequestDto;
import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
@@ -69,7 +68,7 @@ public class FeatureGroupsImpl implements FeatureGroups {
MdcUtil.initMdc(LoggerServiceName.List_FG.toString());
Collection<FeatureGroupEntity> featureGroupEntities =
- vendorLicenseManager.listFeatureGroups(vlmId, Version.valueOf(versionId), user);
+ vendorLicenseManager.listFeatureGroups(vlmId, new Version(versionId));
MapFeatureGroupEntityToFeatureGroupDescriptorDto outputMapper =
new MapFeatureGroupEntityToFeatureGroupDescriptorDto();
@@ -101,11 +100,12 @@ public class FeatureGroupsImpl implements FeatureGroups {
FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity()
.applyMapping(request, FeatureGroupEntity.class);
featureGroupEntity.setVendorLicenseModelId(vlmId);
+ featureGroupEntity.setVersion(new Version(versionId));
featureGroupEntity.setLicenseKeyGroupIds(request.getAddedLicenseKeyGroupsIds());
featureGroupEntity.setEntitlementPoolIds(request.getAddedEntitlementPoolsIds());
FeatureGroupEntity createdFeatureGroup =
- vendorLicenseManager.createFeatureGroup(featureGroupEntity, user);
+ vendorLicenseManager.createFeatureGroup(featureGroupEntity);
StringWrapperResponse result =
createdFeatureGroup != null ? new StringWrapperResponse(createdFeatureGroup.getId()) : null;
@@ -125,12 +125,13 @@ public class FeatureGroupsImpl implements FeatureGroups {
FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity()
.applyMapping(request, FeatureGroupEntity.class);
featureGroupEntity.setVendorLicenseModelId(vlmId);
+ featureGroupEntity.setVersion(new Version(versionId));
featureGroupEntity.setId(featureGroupId);
vendorLicenseManager
.updateFeatureGroup(featureGroupEntity, request.getAddedLicenseKeyGroupsIds(),
request.getRemovedLicenseKeyGroupsIds(), request.getAddedEntitlementPoolsIds(),
- request.getRemovedEntitlementPoolsIds(), user);
+ request.getRemovedEntitlementPoolsIds());
mdcDataDebugMessage.debugExitMessage("VLM id, FG id", vlmId, featureGroupId);
@@ -146,9 +147,9 @@ public class FeatureGroupsImpl implements FeatureGroups {
MdcUtil.initMdc(LoggerServiceName.Get_FG.toString());
FeatureGroupEntity fgInput = new FeatureGroupEntity();
fgInput.setVendorLicenseModelId(vlmId);
- fgInput.setVersion(Version.valueOf(versionId));
+ fgInput.setVersion(new Version(versionId));
fgInput.setId(featureGroupId);
- FeatureGroupModel featureGroupModel = vendorLicenseManager.getFeatureGroupModel(fgInput, user);
+ FeatureGroupModel featureGroupModel = vendorLicenseManager.getFeatureGroupModel(fgInput);
if (featureGroupModel == null) {
return Response.ok().build();
@@ -197,8 +198,9 @@ public class FeatureGroupsImpl implements FeatureGroups {
MdcUtil.initMdc(LoggerServiceName.Delete_FG.toString());
FeatureGroupEntity fgInput = new FeatureGroupEntity();
fgInput.setVendorLicenseModelId(vlmId);
+ fgInput.setVersion(new Version(versionId));
fgInput.setId(featureGroupId);
- vendorLicenseManager.deleteFeatureGroup(fgInput, user);
+ vendorLicenseManager.deleteFeatureGroup(fgInput);
mdcDataDebugMessage.debugExitMessage("VLM id, FG id", vlmId, featureGroupId);
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java
index 60a2d684d2..210aadce42 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java
@@ -41,14 +41,13 @@ import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementRequestDto;
import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementUpdateRequestDto;
import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.util.Collection;
-import java.util.HashSet;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.util.Collection;
+import java.util.HashSet;
@Named
@Service("licenseAgreements")
@@ -62,9 +61,9 @@ public class LicenseAgreementsImpl implements LicenseAgreements {
/**
* List license agreements response.
*
- * @param vlmId the vlm id
+ * @param vlmId the vlm id
* @param versionId the version
- * @param user the user
+ * @param user the user
* @return the response
*/
public Response listLicenseAgreements(String vlmId, String versionId, String user) {
@@ -73,7 +72,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements {
MdcUtil.initMdc(LoggerServiceName.List_LA.toString());
Collection<LicenseAgreementEntity> licenseAgreements =
- vendorLicenseManager.listLicenseAgreements(vlmId, Version.valueOf(versionId), user);
+ vendorLicenseManager.listLicenseAgreements(vlmId, new Version(versionId));
GenericCollectionWrapper<LicenseAgreementEntityDto> results = new GenericCollectionWrapper<>();
MapLicenseAgreementEntityToLicenseAgreementDescriptorDto outputMapper =
@@ -100,7 +99,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements {
* @return the response
*/
public Response createLicenseAgreement(LicenseAgreementRequestDto request, String vlmId,
- String versionId,String user) {
+ String versionId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId);
@@ -109,11 +108,11 @@ public class LicenseAgreementsImpl implements LicenseAgreements {
new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity()
.applyMapping(request, LicenseAgreementEntity.class);
licenseAgreementEntity.setVendorLicenseModelId(vlmId);
- licenseAgreementEntity.setVersion(Version.valueOf(versionId));
+ licenseAgreementEntity.setVersion(new Version(versionId));
licenseAgreementEntity.setFeatureGroupIds(request.getAddedFeatureGroupsIds());
LicenseAgreementEntity createdLicenseAgreement =
- vendorLicenseManager.createLicenseAgreement(licenseAgreementEntity, user);
+ vendorLicenseManager.createLicenseAgreement(licenseAgreementEntity);
StringWrapperResponse result =
createdLicenseAgreement != null ? new StringWrapperResponse(createdLicenseAgreement.getId())
: null;
@@ -133,7 +132,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements {
* @return the response
*/
public Response updateLicenseAgreement(LicenseAgreementUpdateRequestDto request, String vlmId,
- String versionId,String licenseAgreementId, String user) {
+ String versionId, String licenseAgreementId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, LA id", vlmId, licenseAgreementId);
@@ -142,12 +141,12 @@ public class LicenseAgreementsImpl implements LicenseAgreements {
new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity()
.applyMapping(request, LicenseAgreementEntity.class);
licenseAgreementEntity.setVendorLicenseModelId(vlmId);
- licenseAgreementEntity.setVersion(Version.valueOf(versionId));
+ licenseAgreementEntity.setVersion(new Version(versionId));
licenseAgreementEntity.setId(licenseAgreementId);
vendorLicenseManager
.updateLicenseAgreement(licenseAgreementEntity, request.getAddedFeatureGroupsIds(),
- request.getRemovedFeatureGroupsIds(), user);
+ request.getRemovedFeatureGroupsIds());
mdcDataDebugMessage.debugExitMessage("VLM id, LA id", vlmId, licenseAgreementId);
@@ -158,7 +157,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements {
* Gets license agreement.
*
* @param vlmId the vlm id
- * @param versionId the version
+ * @param versionId the version
* @param licenseAgreementId the license agreement id
* @param user the user
* @return the license agreement
@@ -170,7 +169,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements {
MdcUtil.initMdc(LoggerServiceName.Get_LA.toString());
LicenseAgreementModel licenseAgreementModel = vendorLicenseManager
- .getLicenseAgreementModel(vlmId, Version.valueOf(versionId), licenseAgreementId, user);
+ .getLicenseAgreementModel(vlmId, new Version(versionId), licenseAgreementId);
if (licenseAgreementModel == null) {
return Response.ok().build();
@@ -206,18 +205,18 @@ public class LicenseAgreementsImpl implements LicenseAgreements {
* Delete license agreement response.
*
* @param vlmId the vlm id
- * @param versionId the version id
- * @param licenseAgreementId the license agreement id
+ * @param versionId the version id
+ * @param licenseAgreementId the license agreement id
* @param user the user
* @return the response
*/
- public Response deleteLicenseAgreement(String vlmId,String versionId, String licenseAgreementId,
+ public Response deleteLicenseAgreement(String vlmId, String versionId, String licenseAgreementId,
String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, LA id", vlmId, licenseAgreementId);
MdcUtil.initMdc(LoggerServiceName.Delete_LA.toString());
- vendorLicenseManager.deleteLicenseAgreement(vlmId, Version.valueOf(versionId), licenseAgreementId, user);
+ vendorLicenseManager.deleteLicenseAgreement(vlmId, new Version(versionId), licenseAgreementId);
mdcDataDebugMessage.debugExitMessage("VLM id, LA id", vlmId, licenseAgreementId);
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java
index bedbc928ed..3aef837bd3 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java
@@ -16,14 +16,12 @@ import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitRequestDtoToLim
import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto;
import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto;
import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
-import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.util.Collection;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.util.Collection;
@Named
@Service("licenseKeyGroupLimits")
@@ -32,10 +30,11 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private VendorLicenseManager vendorLicenseManager =
- VendorLicenseManagerFactory.getInstance().createInterface();
+ VendorLicenseManagerFactory.getInstance().createInterface();
public static final String parent = "LicenseKeyGroup";
+
@Override
public Response createLimit(LimitRequestDto request,
String vlmId,
@@ -46,20 +45,20 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId);
MdcUtil.initMdc(LoggerServiceName.Create_LIMIT.toString());
- vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ Version version = new Version(versionId);
+ vendorLicenseManager.getLicenseKeyGroup(
+ new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId));
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
- limitEntity.setEpLkgId(licenseKeyGroupId);
+ new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class);
limitEntity.setVendorLicenseModelId(vlmId);
+ limitEntity.setVersion(version);
+ limitEntity.setEpLkgId(licenseKeyGroupId);
limitEntity.setParent(parent);
- LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user);
+ LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity);
MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto();
- LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto
- .class);
+ LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto.class);
/*StringWrapperResponse result =
createdLimit != null ? new StringWrapperResponse(createdLimit.getId())
: null;*/
@@ -67,25 +66,25 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId);
//return Response.ok(result).build();
- return Response.ok(createdLimitDto != null ? createdLimitDto : null)
- .build();
+ return Response.ok(createdLimitDto != null ? createdLimitDto : null).build();
}
@Override
- public Response listLimits(String vlmId, String versionId, String licenseKeyGroupId, String
- user) {
+ public Response listLimits(String vlmId, String versionId, String licenseKeyGroupId,
+ String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId);
MdcUtil.initMdc(LoggerServiceName.List_EP.toString());
- vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ Version version = new Version(versionId);
+ vendorLicenseManager
+ .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId));
Collection<LimitEntity> limits =
- vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), licenseKeyGroupId, user);
+ vendorLicenseManager.listLimits(vlmId, version, licenseKeyGroupId);
GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>();
MapLimitEntityToLimitDto outputMapper =
- new MapLimitEntityToLimitDto();
+ new MapLimitEntityToLimitDto();
for (LimitEntity limit : limits) {
result.add(outputMapper.applyMapping(limit, LimitEntityDto.class));
}
@@ -103,25 +102,26 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
String limitId,
String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id",
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Update_LIMIT.toString());
- vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ Version version = new Version(versionId);
+ vendorLicenseManager
+ .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId));
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
- limitEntity.setEpLkgId(licenseKeyGroupId);
+ new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class);
limitEntity.setVendorLicenseModelId(vlmId);
+ limitEntity.setVersion(version);
+ limitEntity.setEpLkgId(licenseKeyGroupId);
limitEntity.setId(limitId);
limitEntity.setParent(parent);
- vendorLicenseManager.updateLimit(limitEntity, user);
+ vendorLicenseManager.updateLimit(limitEntity);
- mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id",
- limitId);
+ mdcDataDebugMessage
+ .debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id", limitId);
return Response.ok().build();
}
@@ -129,57 +129,59 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
/**
* Delete License Key Group.
*
- * @param vlmId the vlm id
- * @param licenseKeyGroupId the license Key Group id
- * @param limitId the limitId
- * @param user the user
+ * @param vlmId the vlm id
+ * @param licenseKeyGroupId the license Key Group id
+ * @param limitId the limitId
+ * @param user the user
* @return the response
*/
public Response deleteLimit(String vlmId, String versionId, String licenseKeyGroupId,
String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, Verison Id, LKG id, Limit Id", vlmId, versionId,
- licenseKeyGroupId, limitId);
-
+ licenseKeyGroupId, limitId);
MdcUtil.initMdc(LoggerServiceName.Delete_LIMIT.toString());
- vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+
+ Version version = new Version(versionId);
+ vendorLicenseManager
+ .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId));
LimitEntity limitInput = new LimitEntity();
limitInput.setVendorLicenseModelId(vlmId);
+ limitInput.setVersion(version);
limitInput.setEpLkgId(licenseKeyGroupId);
limitInput.setId(limitId);
limitInput.setParent(parent);
- vendorLicenseManager.deleteLimit(limitInput, user);
+ vendorLicenseManager.deleteLimit(limitInput);
mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, LKG id, Limit Id", vlmId, versionId,
- licenseKeyGroupId, limitId);
+ licenseKeyGroupId, limitId);
return Response.ok().build();
}
@Override
- public Response getLimit( String vlmId, String versionId, String licenseKeyGroupId,
- String limitId, String user) {
+ public Response getLimit(String vlmId, String versionId, String licenseKeyGroupId,
+ String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId,
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Get_LIMIT.toString());
- vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
- LimitEntity epInput = new LimitEntity();
- epInput.setVendorLicenseModelId(vlmId);
- epInput.setVersion(Version.valueOf(versionId));
- epInput.setEpLkgId(licenseKeyGroupId);
- epInput.setId(limitId);
- LimitEntity limit = vendorLicenseManager.getLimit(epInput, user);
-
- LimitEntityDto entitlementPoolEntityDto = limit == null ? null :
- new MapLimitEntityToLimitDto()
- .applyMapping(limit, LimitEntityDto.class);
-
- mdcDataDebugMessage.debugExitMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId,
- limitId);
+ Version version = new Version(versionId);
+ vendorLicenseManager
+ .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId));
+ LimitEntity limitInput = new LimitEntity();
+ limitInput.setVendorLicenseModelId(vlmId);
+ limitInput.setVersion(version);
+ limitInput.setEpLkgId(licenseKeyGroupId);
+ limitInput.setId(limitId);
+ LimitEntity limit = vendorLicenseManager.getLimit(limitInput);
+
+ LimitEntityDto entitlementPoolEntityDto = limit == null ? null
+ : new MapLimitEntityToLimitDto().applyMapping(limit, LimitEntityDto.class);
+
+ mdcDataDebugMessage
+ .debugExitMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId, limitId);
return Response.ok(entitlementPoolEntityDto).build();
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java
index 4c4bf134fd..6fe33d77ae 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java
@@ -34,7 +34,6 @@ import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto;
import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@@ -67,7 +66,7 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups {
MdcUtil.initMdc(LoggerServiceName.List_LKG.toString());
Collection<LicenseKeyGroupEntity> licenseKeyGroups =
- vendorLicenseManager.listLicenseKeyGroups(vlmId, Version.valueOf(versionId), user);
+ vendorLicenseManager.listLicenseKeyGroups(vlmId, new Version(versionId));
GenericCollectionWrapper<LicenseKeyGroupEntityDto> result = new GenericCollectionWrapper<>();
MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto outputMapper =
@@ -99,9 +98,10 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups {
new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity()
.applyMapping(request, LicenseKeyGroupEntity.class);
licenseKeyGroupEntity.setVendorLicenseModelId(vlmId);
+ licenseKeyGroupEntity.setVersion(new Version(versionId));
LicenseKeyGroupEntity createdLicenseKeyGroup =
- vendorLicenseManager.createLicenseKeyGroup(licenseKeyGroupEntity, user);
+ vendorLicenseManager.createLicenseKeyGroup(licenseKeyGroupEntity);
StringWrapperResponse result =
createdLicenseKeyGroup != null ? new StringWrapperResponse(createdLicenseKeyGroup.getId())
: null;
@@ -131,9 +131,10 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups {
new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity()
.applyMapping(request, LicenseKeyGroupEntity.class);
licenseKeyGroupEntity.setVendorLicenseModelId(vlmId);
+ licenseKeyGroupEntity.setVersion(new Version(versionId));
licenseKeyGroupEntity.setId(licenseKeyGroupId);
- vendorLicenseManager.updateLicenseKeyGroup(licenseKeyGroupEntity, user);
+ vendorLicenseManager.updateLicenseKeyGroup(licenseKeyGroupEntity);
mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", vlmId, licenseKeyGroupId);
@@ -157,9 +158,9 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups {
MdcUtil.initMdc(LoggerServiceName.Get_LKG.toString());
LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity();
lkgInput.setVendorLicenseModelId(vlmId);
- lkgInput.setVersion(Version.valueOf(versionId));
+ lkgInput.setVersion(new Version(versionId));
lkgInput.setId(licenseKeyGroupId);
- LicenseKeyGroupEntity licenseKeyGroup = vendorLicenseManager.getLicenseKeyGroup(lkgInput, user);
+ LicenseKeyGroupEntity licenseKeyGroup = vendorLicenseManager.getLicenseKeyGroup(lkgInput);
LicenseKeyGroupEntityDto licenseKeyGroupEntityDto = licenseKeyGroup == null ? null :
new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto()
@@ -186,8 +187,9 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups {
MdcUtil.initMdc(LoggerServiceName.Delete_LKG.toString());
LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity();
lkgInput.setVendorLicenseModelId(vlmId);
+ lkgInput.setVersion(new Version(versionId));
lkgInput.setId(licenseKeyGroupId);
- vendorLicenseManager.deleteLicenseKeyGroup(lkgInput, user);
+ vendorLicenseManager.deleteLicenseKeyGroup(lkgInput);
mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", vlmId, licenseKeyGroupId);
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
index 6d88e4cacb..2b8e5a343e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
@@ -20,37 +20,67 @@
package org.openecomp.sdcrests.vendorlicense.rest.services;
+import org.openecomp.core.util.UniqueValueUtil;
+import org.openecomp.sdc.activitylog.ActivityLogManager;
+import org.openecomp.sdc.activitylog.ActivityLogManagerFactory;
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.activitylog.dao.type.ActivityType;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.datatypes.model.ItemType;
+import org.openecomp.sdc.healing.factory.HealingManagerFactory;
+import org.openecomp.sdc.itempermissions.ItemPermissionsManager;
+import org.openecomp.sdc.itempermissions.ItemPermissionsManagerFactory;
+import org.openecomp.sdc.itempermissions.impl.types.PermissionTypes;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.MdcUtil;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.logging.messages.AuditMessages;
-import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerServiceName;
+import org.openecomp.sdc.notification.dtos.Event;
+import org.openecomp.sdc.notification.factories.NotificationPropagationManagerFactory;
+import org.openecomp.sdc.notification.services.NotificationPropagationManager;
+import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
-import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory;
+import org.openecomp.sdc.versioning.ItemManager;
+import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.VersioningManager;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+import org.openecomp.sdc.versioning.types.Item;
+import org.openecomp.sdc.versioning.types.NotificationEventTypes;
+import org.openecomp.sdcrests.item.rest.mapping.MapItemToDto;
+import org.openecomp.sdcrests.item.rest.mapping.MapVersionToDto;
+import org.openecomp.sdcrests.item.types.ItemCreationDto;
+import org.openecomp.sdcrests.item.types.ItemDto;
+import org.openecomp.sdcrests.item.types.VersionDto;
import org.openecomp.sdcrests.vendorlicense.rest.VendorLicenseModels;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVendorLicenseModelEntityToDto;
import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity;
-import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto;
import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto;
import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto;
import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
-import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.inject.Named;
import javax.ws.rs.core.Response;
-import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Predicate;
+
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_NAME;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.SUBMIT_DESCRIPTION;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_NAME;
@Named
@Service("vendorLicenseModels")
@@ -59,140 +89,248 @@ import java.util.Collection;
public class VendorLicenseModelsImpl implements VendorLicenseModels {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private static final Logger logger = LoggerFactory.getLogger(VendorLicenseModelsImpl.class);
+ public static final String SUBMIT_ITEM = "Submit_Item";
+ private ItemPermissionsManager permissionsManager = ItemPermissionsManagerFactory.getInstance()
+ .createInterface();
+ private NotificationPropagationManager notifier =
+ NotificationPropagationManagerFactory.getInstance().createInterface();
+
+ private ItemManager itemManager = ItemManagerFactory.getInstance().createInterface();
+ private VersioningManager versioningManager =
+ VersioningManagerFactory.getInstance().createInterface();
private VendorLicenseManager vendorLicenseManager =
VendorLicenseManagerFactory.getInstance().createInterface();
+ private ActivityLogManager activityLogManager =
+ ActivityLogManagerFactory.getInstance().createInterface();
+
+ @Override
+ public Response listLicenseModels(String versionStatus, String user) {
+ mdcDataDebugMessage.debugEntryMessage(null);
+ MdcUtil.initMdc(LoggerServiceName.List_VLM.toString());
+
+ Predicate<Item> itemPredicate;
+ if (VersionStatus.Certified.name().equals(versionStatus)) {
+ itemPredicate = item -> ItemType.vlm.name().equals(item.getType()) &&
+ item.getVersionStatusCounters().containsKey(VersionStatus.Certified);
+
+ } else if (VersionStatus.Draft.name().equals(versionStatus)) {
+ itemPredicate = item -> ItemType.vlm.name().equals(item.getType()) &&
+ item.getVersionStatusCounters().containsKey(VersionStatus.Draft) &&
+ userHasPermission(item.getId(), user);
+
+ } else {
+ itemPredicate = item -> ItemType.vlm.name().equals(item.getType());
+ }
- private static final Logger logger =
- LoggerFactory.getLogger(VendorLicenseModelsImpl.class);
+ GenericCollectionWrapper<ItemDto> results = new GenericCollectionWrapper<>();
+ MapItemToDto mapper = new MapItemToDto();
+ itemManager.list(itemPredicate).stream()
+ .sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime()))
+ .forEach(vspItem -> results.add(mapper.applyMapping(vspItem, ItemDto.class)));
- @Override
- public Response listLicenseModels(String versionFilter, String user) {
-
- mdcDataDebugMessage.debugEntryMessage(null, null);
- MdcUtil.initMdc(LoggerServiceName.List_VLM.toString());
- Collection<VersionedVendorLicenseModel> versionedVendorLicenseModels =
- vendorLicenseManager.listVendorLicenseModels(versionFilter, user);
-
- GenericCollectionWrapper<VendorLicenseModelEntityDto> results =
- new GenericCollectionWrapper<>();
- MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto outputMapper =
- new MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto();
- for (VersionedVendorLicenseModel versionedVlm : versionedVendorLicenseModels) {
- results.add(outputMapper.applyMapping(versionedVlm, VendorLicenseModelEntityDto.class));
- }
+ mdcDataDebugMessage.debugExitMessage(null);
+ return Response.ok(results).build();
+ }
- mdcDataDebugMessage.debugExitMessage(null, null);
+ @Override
+ public Response createLicenseModel(VendorLicenseModelRequestDto request, String user) {
+ mdcDataDebugMessage.debugEntryMessage(null);
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_VLM + request.getVendorName());
+ MdcUtil.initMdc(LoggerServiceName.Create_VLM.toString());
- return Response.ok(results).build();
- }
+ Item item = new Item();
+ item.setType(ItemType.vlm.name());
+ item.setName(request.getVendorName());
+ item.setDescription(request.getDescription());
- @Override
- public Response createLicenseModel(VendorLicenseModelRequestDto request, String user) {
+ UniqueValueUtil
+ .validateUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, item.getName());
+ item = itemManager.create(item);
+ UniqueValueUtil
+ .createUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, item.getName());
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ Version version = versioningManager.create(item.getId(), new Version(), null);
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_VLM
- + request.getVendorName());
+ VendorLicenseModelEntity vlm = new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity()
+ .applyMapping(request, VendorLicenseModelEntity.class);
+ vlm.setId(item.getId());
+ vlm.setVersion(version);
- MdcUtil.initMdc(LoggerServiceName.Create_VLM.toString());
- VendorLicenseModelEntity vendorLicenseModelEntity =
+ vendorLicenseManager.createVendorLicenseModel(vlm);
+ versioningManager.publish(item.getId(), version, "Initial vlm:" + vlm.getVendorName());
+
+ ItemCreationDto itemCreationDto = new ItemCreationDto();
+ itemCreationDto.setItemId(item.getId());
+ itemCreationDto.setVersion(new MapVersionToDto().applyMapping(version, VersionDto.class));
+
+ activityLogManager.logActivity(new ActivityLogEntity(vlm.getId(), version,
+ ActivityType.Create, user, true, "", ""));
+
+ mdcDataDebugMessage.debugExitMessage(null);
+ return Response.ok(itemCreationDto).build();
+ }
+
+ @Override
+ public Response updateLicenseModel(VendorLicenseModelRequestDto request, String vlmId,
+ String versionId, String user) {
+ mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId);
+ MdcUtil.initMdc(LoggerServiceName.Update_VLM.toString());
+
+ VendorLicenseModelEntity vlm =
new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity()
.applyMapping(request, VendorLicenseModelEntity.class);
- VendorLicenseModelEntity createdVendorLicenseModel =
- vendorLicenseManager.createVendorLicenseModel(vendorLicenseModelEntity, user);
- StringWrapperResponse result = createdVendorLicenseModel != null ? new StringWrapperResponse(
- createdVendorLicenseModel.getId()) : null;
+ vlm.setId(vlmId);
+ vlm.setVersion(new Version(versionId));
+
+ vendorLicenseManager.updateVendorLicenseModel(vlm);
+
+ mdcDataDebugMessage.debugExitMessage("VLM id", vlmId);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response getLicenseModel(String vlmId, String versionId, String user) {
+ mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId);
+ MdcUtil.initMdc(LoggerServiceName.Get_VLM.toString());
+
+ Version version = versioningManager.get(vlmId, new Version(versionId));
+ VendorLicenseModelEntity vlm = vendorLicenseManager.getVendorLicenseModel(vlmId, version);
+ vlm.setWritetimeMicroSeconds(version.getModificationTime().getTime());
+
+ try {
+ Optional<Version> healedVersion = HealingManagerFactory.getInstance().createInterface()
+ .healItemVersion(vlmId, version, ItemType.vlm, false);
+ healedVersion.ifPresent(vlm::setVersion);
+
+ if (healedVersion.isPresent() && version.getStatus() == VersionStatus.Certified) {
+ try {
+ submit(vlmId, healedVersion.get(), "Submit after heal", user);
+ } catch (Exception ex) {
+ logger.error("VLM Id {}: Error while submitting version {} " +
+ "created based on Certified version {} for healing purpose.",
+ vlmId, healedVersion.get().getId(), versionId, ex.getMessage());
+ }
+ }
+ } catch (Exception e) {
+ logger.error(String.format("Error while auto healing VLM with Id %s and version %s: %s",
+ vlmId, versionId, e.getMessage()));
+ }
- mdcDataDebugMessage.debugExitMessage(null, null);
+ VendorLicenseModelEntityDto vlmDto =
+ new MapVendorLicenseModelEntityToDto().applyMapping(vlm, VendorLicenseModelEntityDto.class);
- return Response.ok(result).build();
- }
+ mdcDataDebugMessage.debugExitMessage("VLM id", vlmId);
+ return Response.ok(vlmDto).build();
+ }
- @Override
- public Response updateLicenseModel(VendorLicenseModelRequestDto request, String vlmId,
- String versionId, String user) {
+ @Override
+ public Response deleteLicenseModel(String vlmId, String versionId, String user) {
+ mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId);
+
+ MdcUtil.initMdc(LoggerServiceName.Delete_VLM.toString());
+ vendorLicenseManager.deleteVendorLicenseModel(vlmId, new Version(versionId));
- mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId);
+ mdcDataDebugMessage.debugExitMessage("VLM id", vlmId);
- MdcUtil.initMdc(LoggerServiceName.Update_VLM.toString());
- VendorLicenseModelEntity vendorLicenseModelEntity =
- new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity()
- .applyMapping(request, VendorLicenseModelEntity.class);
- vendorLicenseModelEntity.setId(vlmId);
+ return Response.ok().build();
+ }
- vendorLicenseManager.updateVendorLicenseModel(vendorLicenseModelEntity, user);
+ @Override
+ public Response actOnLicenseModel(VendorLicenseModelActionRequestDto request, String vlmId,
+ String versionId, String user) {
+ Version version = new Version(versionId);
- mdcDataDebugMessage.debugExitMessage("VLM id", vlmId);
+ switch (request.getAction()) {
+ case Submit:
+ if (!permissionsManager.isAllowed(vlmId, user, SUBMIT_ITEM)) {
+ return Response.status(Response.Status.FORBIDDEN).entity
+ (new Exception(Messages.PERMISSIONS_ERROR.getErrorMessage())).build();
+ }
+ String message =
+ request.getSubmitRequest() == null ? "" : request.getSubmitRequest().getMessage();
+ submit(vlmId, version, message, user);
- return Response.ok().build();
+ notifyUsers(vlmId, version, message, user, NotificationEventTypes.SUBMIT);
+ break;
+ default:
}
- @Override
- public Response getLicenseModel(String vlmId, String versionId, String user) {
+ return Response.ok().build();
+ }
- mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId);
+ private void submit(String vlmId, Version version, String message, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Submit_VLM.toString());
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VLM + vlmId);
- MdcUtil.initMdc(LoggerServiceName.Get_VLM.toString());
- VersionedVendorLicenseModel versionedVlm =
- vendorLicenseManager.getVendorLicenseModel(vlmId, Version.valueOf(versionId), user);
+ vendorLicenseManager.validate(vlmId, version);
+ versioningManager.submit(vlmId, version, message);
- VendorLicenseModelEntityDto vlmDto = versionedVlm == null ? null :
- new MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto()
- .applyMapping(versionedVlm, VendorLicenseModelEntityDto.class);
+ activityLogManager.logActivity(
+ new ActivityLogEntity(vlmId, version, ActivityType.Submit, user, true, "", message));
+ }
- mdcDataDebugMessage.debugExitMessage("VLM id", vlmId);
+ private void notifyUsers(String itemId, Version version, String message,
+ String userName, NotificationEventTypes eventType) {
+ Map<String, Object> eventProperties = new HashMap<>();
+ eventProperties.put(ITEM_NAME, itemManager.get(itemId).getName());
+ eventProperties.put(ITEM_ID, itemId);
- return Response.ok(vlmDto).build();
- }
+ Version ver = versioningManager.get(itemId, version);
+ eventProperties.put(VERSION_NAME, ver.getName());
+ eventProperties.put(VERSION_ID, ver.getId());
- @Override
- public Response deleteLicenseModel(String vlmId, String versionId, String user) {
+ eventProperties.put(SUBMIT_DESCRIPTION, message);
+ eventProperties.put(PERMISSION_USER, userName);
- mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId);
+ Event syncEvent = new SyncEvent(eventType.getEventName(), itemId, eventProperties, itemId);
+ try {
+ notifier.notifySubscribers(syncEvent, userName);
+ } catch (Exception e) {
+ logger.error("Failed to send sync notification to users subscribed o item '" + itemId);
+ }
+ }
- MdcUtil.initMdc(LoggerServiceName.Delete_VLM.toString());
- vendorLicenseManager.deleteVendorLicenseModel(vlmId, user);
+ private class SyncEvent implements Event {
- mdcDataDebugMessage.debugExitMessage("VLM id", vlmId);
+ private String eventType;
+ private String originatorId;
+ private Map<String, Object> attributes;
+ private String entityId;
- return Response.ok().build();
+ public SyncEvent(String eventType, String originatorId,
+ Map<String, Object> attributes, String entityId) {
+ this.eventType = eventType;
+ this.originatorId = originatorId;
+ this.attributes = attributes;
+ this.entityId = entityId;
}
@Override
- public Response actOnLicenseModel(VendorLicenseModelActionRequestDto request, String vlmId,
- String versionId, String user) {
+ public String getEventType() {
+ return eventType;
+ }
- switch (request.getAction()) {
- case Checkout:
- MDC.put(LoggerConstants.SERVICE_NAME,
- LoggerServiceName.Checkout_VLM.toString());
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_OUT_VLM
- + vlmId);
- vendorLicenseManager.checkout(vlmId, user);
- break;
- case Undo_Checkout:
- MDC.put(LoggerConstants.SERVICE_NAME,
- LoggerServiceName.Undo_Checkout_VLM.toString());
- vendorLicenseManager.undoCheckout(vlmId, user);
- break;
- case Checkin:
- MDC.put(LoggerConstants.SERVICE_NAME,
- LoggerServiceName.Checkin_VLM.toString());
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_IN_VLM
- + vlmId);
- vendorLicenseManager.checkin(vlmId, user);
- break;
- case Submit:
- MDC.put(LoggerConstants.SERVICE_NAME,
- LoggerServiceName.Submit_VLM.toString());
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VLM
- + vlmId);
- vendorLicenseManager.submit(vlmId, user);
- break;
- default:
+ @Override
+ public String getOriginatorId() {
+ return originatorId;
}
- return Response.ok().build();
+ @Override
+ public Map<String, Object> getAttributes() {
+ return attributes;
}
+
+ @Override
+ public String getEntityId() {
+ return entityId;
+ }
+ }
+
+ private boolean userHasPermission(String itemId, String userId) {
+ String permission = permissionsManager.getUserItemPermiission(itemId, userId);
+ return (permission != null && permission
+ .matches(PermissionTypes.Contributor.name() + "|" + PermissionTypes.Owner.name()));
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml
index 6b30f9567f..daeb720c37 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml
@@ -12,17 +12,17 @@
<relativePath>../</relativePath>
</parent>
- <dependencies>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-common-rest</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-license-manager</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-vendor-license-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-rest-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupEntityDto.java
index aebb171b8e..3edf283707 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupEntityDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupEntityDto.java
@@ -22,8 +22,8 @@ package org.openecomp.sdcrests.vendorlicense.types;
import io.swagger.annotations.ApiModel;
-import java.util.Set;
import javax.validation.constraints.Size;
+import java.util.Set;
@ApiModel(value = "FeatureGroupEntity")
public class FeatureGroupEntityDto extends FeatureGroupDescriptorDto {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementEntityDto.java
index 7c9f03dc91..23d1218b74 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementEntityDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementEntityDto.java
@@ -23,8 +23,8 @@ package org.openecomp.sdcrests.vendorlicense.types;
import io.swagger.annotations.ApiModel;
-import java.util.Set;
import javax.validation.constraints.Size;
+import java.util.Set;
@ApiModel(value = "LicenseAgreementEntity")
public class LicenseAgreementEntityDto extends LicenseAgreementDescriptorDto {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/MultiChoiceOrOtherDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/MultiChoiceOrOtherDto.java
index 6039a810ba..1dc8ff2bdd 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/MultiChoiceOrOtherDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/MultiChoiceOrOtherDto.java
@@ -24,9 +24,9 @@ import org.hibernate.validator.group.GroupSequenceProvider;
import org.openecomp.sdcrests.vendorlicense.types.validation.MultiChoiceOrOtherSequenceProvider;
import org.openecomp.sdcrests.vendorlicense.types.validation.OtherChoiceValidation;
-import java.util.Set;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
+import java.util.Set;
@GroupSequenceProvider(value = MultiChoiceOrOtherSequenceProvider.class)
public class MultiChoiceOrOtherDto<E extends Enum<E>> {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelActionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelActionRequestDto.java
index cfae94ce35..68e0fd8552 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelActionRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelActionRequestDto.java
@@ -20,17 +20,30 @@
package org.openecomp.sdcrests.vendorlicense.types;
-import org.openecomp.sdcrests.versioning.types.VersioningAction;
+import org.openecomp.sdcrests.item.types.SubmitRequestDto;
public class VendorLicenseModelActionRequestDto {
- private VersioningAction action;
+ private VendorLicenseModelAction action;
+ private SubmitRequestDto submitRequest;
- public VersioningAction getAction() {
+ public VendorLicenseModelAction getAction() {
return action;
}
- public void setAction(VersioningAction action) {
+ public void setAction(VendorLicenseModelAction action) {
this.action = action;
}
+
+ public SubmitRequestDto getSubmitRequest() {
+ return submitRequest;
+ }
+
+ public void setSubmitRequest(SubmitRequestDto submitRequest) {
+ this.submitRequest = submitRequest;
+ }
+
+ public enum VendorLicenseModelAction {
+ Submit
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelEntityDto.java
index e8a900a82b..f88926c300 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelEntityDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelEntityDto.java
@@ -21,19 +21,10 @@
package org.openecomp.sdcrests.vendorlicense.types;
import io.swagger.annotations.ApiModel;
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdcrests.common.types.VersionDto;
-
-import java.util.List;
@ApiModel(value = "VendorLicenseModelEntity")
public class VendorLicenseModelEntityDto extends VendorLicenseModelRequestDto {
private String id;
- private VersionDto version;
- private VersionStatus status;
- private String lockingUser;
- private List<VersionDto> viewableVersions;
- private List<VersionDto> finalVersions;
public String getId() {
return id;
@@ -42,44 +33,4 @@ public class VendorLicenseModelEntityDto extends VendorLicenseModelRequestDto {
public void setId(String id) {
this.id = id;
}
-
- public VersionDto getVersion() {
- return version;
- }
-
- public void setVersion(VersionDto version) {
- this.version = version;
- }
-
- public VersionStatus getStatus() {
- return status;
- }
-
- public void setStatus(VersionStatus status) {
- this.status = status;
- }
-
- public String getLockingUser() {
- return lockingUser;
- }
-
- public void setLockingUser(String lockingUser) {
- this.lockingUser = lockingUser;
- }
-
- public List<VersionDto> getViewableVersions() {
- return viewableVersions;
- }
-
- public void setViewableVersions(List<VersionDto> viewableVersions) {
- this.viewableVersions = viewableVersions;
- }
-
- public List<VersionDto> getFinalVersions() {
- return finalVersions;
- }
-
- public void setFinalVersions(List<VersionDto> finalVersions) {
- this.finalVersions = finalVersions;
- }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencies.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencies.java
new file mode 100644
index 0000000000..44626ff62d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencies.java
@@ -0,0 +1,87 @@
+package org.openecomp.sdcrests.vsp.rest;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModel;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyResponseDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+@Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/component-dependencies")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor Software Product Component Dependencies")
+@Validated
+public interface ComponentDependencies extends VspEntities {
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create a vendor software product component dependency")
+ Response create(@Valid ComponentDependencyModel request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "Get component dependencies for vendor software product",
+ response = ComponentDependencyResponseDto.class,
+ responseContainer = "List")
+ Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product version Id") @PathParam("versionId")
+ String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/{dependencyId}")
+ @ApiOperation(value = "Delete component dependency for vendor software product")
+ Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product version Id")
+ @PathParam("versionId") String versionId,
+ @ApiParam(value = "Vendor software product Component Dependency Id") @PathParam
+ ("dependencyId") String dependencyId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
+ String user);
+
+ @PUT
+ @Path("/{dependencyId}")
+ @ApiOperation(value = "Update component dependency for vendor software product")
+ Response update(@Valid ComponentDependencyModel request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product version Id") @PathParam("versionId")
+ String versionId,
+ @ApiParam(value = "Vendor software product Component Dependency Id") @PathParam
+ ("dependencyId") String dependencyId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{dependencyId}")
+ @ApiOperation(value = "Get component dependency for vendor software product",
+ response = ComponentDependencyResponseDto.class)
+ Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
+ @ApiParam(value = "Vendor software product Component Dependency Id") @PathParam
+ ("dependencyId") String dependencyId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
+ String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencyModels.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencyModels.java
deleted file mode 100644
index d7ba65fce5..0000000000
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencyModels.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.openecomp.sdcrests.vsp.rest;
-
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModelRequestDto;
-import org.springframework.validation.annotation.Validated;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/component-dependency-model")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-@Api(value = "Vendor Software Product Component Dependency Model")
-@Validated
-public interface ComponentDependencyModels extends VspEntities {
-
- @POST
- @Path("/")
- @ApiOperation(value = "Create a vendor software product component dependency model")
- Response create(@Valid ComponentDependencyModelRequestDto request,
- @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
- @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
- @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
- String user);
-
- @GET
- @Path("/")
- @ApiOperation(value = "Get component dependency Model for vendor software product",
- response = ComponentDependencyModelRequestDto.class,
- responseContainer = "List")
- Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
- @ApiParam(value = "Vendor software product version Id") @PathParam("versionId")
- String versionId,
- @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
- String user);
-}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java
index edb3b5bfc2..5595dc1254 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java
@@ -31,7 +31,15 @@ import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Compute.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Compute.java
index d5125c92bf..635d31255c 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Compute.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Compute.java
@@ -1,8 +1,5 @@
package org.openecomp.sdcrests.vsp.rest;
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -26,6 +23,9 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
@Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId" +
"}/compute-flavors")
@Produces(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/DeploymentFlavors.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/DeploymentFlavors.java
index 1ba2f71b4c..a154f9ffa7 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/DeploymentFlavors.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/DeploymentFlavors.java
@@ -1,8 +1,5 @@
package org.openecomp.sdcrests.vsp.rest;
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -25,6 +22,9 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
@Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/deployment-flavors")
@Produces(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Images.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Images.java
index ffa1675f91..b3d2e5cd1c 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Images.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Images.java
@@ -1,8 +1,5 @@
package org.openecomp.sdcrests.vsp.rest;
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -26,6 +23,9 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
@Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/images")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java
index 21bd65eccb..67be16825a 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java
@@ -20,9 +20,6 @@
package org.openecomp.sdcrests.vsp.rest;
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -46,6 +43,9 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
@Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/nics")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java
index fa7f421fc8..4f5e31aaaf 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java
@@ -25,7 +25,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
-import org.openecomp.sdc.vendorsoftwareproduct.types.FileDataStructureDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.FileDataStructureDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
import org.springframework.validation.annotation.Validated;
@@ -43,7 +43,6 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java
index 458a1c63fd..caf03b4fc7 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java
@@ -20,9 +20,6 @@
package org.openecomp.sdcrests.vsp.rest;
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -46,6 +43,9 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
@Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/processes")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java
index 20fe64b88f..d848d41f7c 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java
@@ -23,12 +23,13 @@ package org.openecomp.sdcrests.vsp.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
+import org.openecomp.sdcrests.item.types.ItemCreationDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspRequestDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
import org.springframework.validation.annotation.Validated;
@@ -51,6 +52,7 @@ import java.io.IOException;
import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
@Path("/v1.0/vendor-software-products")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@@ -61,8 +63,8 @@ public interface VendorSoftwareProducts extends VspEntities {
@POST
@Path("/")
@ApiOperation(value = "Create a new vendor software product",
- response = VspCreationDto.class)
- Response createVsp(@Valid VspDescriptionDto vspDescriptionDto,
+ response = ItemCreationDto.class)
+ Response createVsp(@Valid VspRequestDto vspRequestDto,
@NotNull(message = USER_MISSING_ERROR_MSG)
@HeaderParam(USER_ID_HEADER_PARAM) String user);
@@ -71,13 +73,12 @@ public interface VendorSoftwareProducts extends VspEntities {
@ApiOperation(value = "Get list of vendor software products and their description",
responseContainer = "List")
Response listVsps(@ApiParam(
- value = "Currently supported values: 'Final' - only vendor software products with final "
+ value = "Currently supported values: 'Certified' - only vendor software products with final "
+ " version will be return - with their latest final version")
- @QueryParam("versionFilter") String versionFilter,
+ @QueryParam("versionFilter") String versionStatus,
@NotNull(message = USER_MISSING_ERROR_MSG)
@HeaderParam(USER_ID_HEADER_PARAM) String user);
-
@GET
@Path("/{vspId}/versions/{versionId}")
@ApiOperation(value = "Get details of a vendor software product")
@@ -140,9 +141,9 @@ public interface VendorSoftwareProducts extends VspEntities {
+ "Checkin: Unlocks it and activates the edited version to all users.| "
+ "Submit: Finalize its active version.|"
+ "Create_Package: Creates a CSAR zip file.|")
- Response actOnVendorSoftwareProduct(@PathParam("vspId") String vspId,
+ Response actOnVendorSoftwareProduct(VersionSoftwareProductActionRequestDto request,
+ @PathParam("vspId") String vspId,
@PathParam("versionId") String versionId,
- VersionSoftwareProductActionRequestDto request,
@NotNull(message = USER_MISSING_ERROR_MSG)
@HeaderParam(USER_ID_HEADER_PARAM) String user)
throws IOException;
@@ -201,18 +202,9 @@ public interface VendorSoftwareProducts extends VspEntities {
@ApiOperation(value = "Get list of vendor software product compute-flavors",
response = VspComputeDto.class,
responseContainer = "List")
- Response listCompute(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String
- vspId,
- @PathParam("versionId") String versionId,
- @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
- String user);
-
- @PUT
- @Path("/reSubmitAll")
- @ApiOperation(value = "Performs healing ,check out, check in and submit for Network Package " +
- "Based VSPs",
- notes
- = "Please note - only submitted VSPs will be processed")
- Response reSubmitAll(@NotNull(message = USER_MISSING_ERROR_MSG)
- @HeaderParam(USER_ID_HEADER_PARAM) String user) throws IOException;
+ Response listComputes(@ApiParam(value = "Vendor software product Id")
+ @PathParam("vspId") String vspId,
+ @PathParam("versionId") String versionId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProductsForSwaggerFileUpload.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProductsForSwaggerFileUpload.java
index eb70394b28..c2a49401d3 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProductsForSwaggerFileUpload.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProductsForSwaggerFileUpload.java
@@ -27,7 +27,12 @@ import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotNull;
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.InputStream;
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VspEntities.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VspEntities.java
index bd53305e33..4514af649b 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VspEntities.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VspEntities.java
@@ -20,27 +20,6 @@
package org.openecomp.sdcrests.vsp.rest;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
-import org.openecomp.sdc.versioning.VersioningManager;
-import org.openecomp.sdc.versioning.VersioningManagerFactory;
-import org.openecomp.sdc.versioning.VersioningUtil;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-
public interface VspEntities {
- VersioningManager versioningManager = VersioningManagerFactory.getInstance().createInterface();
-
- default Version resolveVspVersion(String vspId, String version, String user,
- VersionableEntityAction action) {
- return VersioningUtil
- .resolveVersion(Version.valueOf(version), getVersionInfo(vspId, action, user), user);
- }
- default VersionInfo getVersionInfo(String vendorSoftwareProductId, VersionableEntityAction action,
- String user) {
- return versioningManager.getEntityVersionInfo(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
- vendorSoftwareProductId, user, action);
- }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToCreationDto.java
new file mode 100644
index 0000000000..cb480b2aa0
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToCreationDto.java
@@ -0,0 +1,16 @@
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyCreationDto;
+
+public class MapComponentDependencyEntityToCreationDto extends MappingBase
+ <ComponentDependencyModelEntity, ComponentDependencyCreationDto> {
+
+ @Override
+ public void doMapping(ComponentDependencyModelEntity source,
+ ComponentDependencyCreationDto target) {
+ target.setId(source.getId());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToDto.java
new file mode 100644
index 0000000000..0fe51178a7
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyEntityToDto.java
@@ -0,0 +1,18 @@
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyResponseDto;
+
+public class MapComponentDependencyEntityToDto extends
+ MappingBase<ComponentDependencyModelEntity, ComponentDependencyResponseDto> {
+
+ @Override
+ public void doMapping(ComponentDependencyModelEntity source,
+ ComponentDependencyResponseDto target) {
+ target.setSourceId(source.getSourceComponentId());
+ target.setTargetId(source.getTargetComponentId());
+ target.setRelationType(source.getRelation());
+ target.setId(source.getId());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java
index ee9882369f..7db9a0a9b1 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java
@@ -12,6 +12,6 @@ public class MapComputeDetailsDtoToComputeEntity extends MappingBase<ComputeDeta
public void doMapping(ComputeDetailsDto source, ComputeEntity target) {
ComputeDescription computeDesc = new ComputeDescription(source.getName(), source
.getDescription());
- target.setCompositionData(JsonUtil.object2Json(computeDesc));
+ target.setCompositionData(computeDesc == null ? null : JsonUtil.object2Json(computeDesc));
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToDto.java
new file mode 100644
index 0000000000..09e4d224a0
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToDto.java
@@ -0,0 +1,17 @@
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.FileDataStructureDto;
+
+public class MapFilesDataStructureToDto
+ extends MappingBase<FilesDataStructure, FileDataStructureDto> {
+
+ @Override
+ public void doMapping(FilesDataStructure source, FileDataStructureDto target) {
+ target.setModules(source.getModules());
+ target.setArtifacts(source.getArtifacts());
+ target.setNested(source.getNested());
+ target.setUnassigned(source.getUnassigned());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDto.java
index 684cd4c31d..f938c52e5b 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDto.java
@@ -1,6 +1,5 @@
package org.openecomp.sdcrests.vsp.rest.mapping;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ImageData;
import org.openecomp.sdcrests.mapping.MappingBase;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto;
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDto.java
new file mode 100644
index 0000000000..ad45e63330
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDto.java
@@ -0,0 +1,18 @@
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.versioning.types.Item;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
+import org.openecomp.sdcrests.vsp.rest.services.VspItemProperty;
+
+public class MapItemToVspDetailsDto extends MappingBase<Item, VspDetailsDto> {
+ @Override
+ public void doMapping(Item source, VspDetailsDto target) {
+ target.setId(source.getId());
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ target.setVendorId((String) source.getProperties().get(VspItemProperty.VENDOR_ID));
+ target.setVendorName((String) source.getProperties().get(VspItemProperty.VENDOR_NAME));
+ target.setOnboardingMethod((String) source.getProperties().get(VspItemProperty.ONBOARDING_METHOD));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java
index 34616b4306..eeee4e95d5 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java
@@ -33,7 +33,7 @@ public class MapPackageInfoToPackageInfoDto extends MappingBase<PackageInfo, Pac
target.setVspName(source.getVspName());
target.setPackageId(source.getVspId());
target.setDescription(source.getVspDescription());
- target.setVersion(source.getVersion() == null ? null : source.getVersion().toString());
+ target.setVersion(source.getVersion());
target.setPackageType(source.getPackageType());
target.setCategory(source.getCategory());
target.setSubCategory(source.getSubCategory());
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireToQuestionnaireDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireToQuestionnaireDto.java
new file mode 100644
index 0000000000..f47f7834fb
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireToQuestionnaireDto.java
@@ -0,0 +1,21 @@
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireDto;
+
+import java.util.HashMap;
+
+/**
+ * Created by ayalaben on 9/26/2017
+ */
+public class MapQuestionnaireToQuestionnaireDto extends
+ MappingBase<CompositionEntity, QuestionnaireDto> {
+
+ @Override
+ public void doMapping(CompositionEntity source, QuestionnaireDto target) {
+ target.setId(source.getId());
+ target.setQuestionareData(JsonUtil.json2Object(source.getQuestionnaireData(), HashMap.class));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java
index 3cabebbb69..85b5567ed6 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java
@@ -32,9 +32,7 @@ import org.openecomp.sdcrests.common.mapping.MapErrorMessageToDto;
import org.openecomp.sdcrests.common.types.ErrorCodeDto;
import org.openecomp.sdcrests.common.types.ErrorMessageDto;
import org.openecomp.sdcrests.mapping.MappingBase;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentValidationResultDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorValidationResultDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireValidationResultDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ValidationResponseDto;
@@ -47,30 +45,31 @@ import java.util.Set;
import java.util.stream.Collectors;
public class MapValidationResponseToDto
- extends MappingBase<ValidationResponse, ValidationResponseDto> {
+ extends MappingBase<ValidationResponse, ValidationResponseDto> {
private static Map<String, List<ErrorMessageDto>> mapUploadDataErrors(
- Map<String, List<ErrorMessage>> uploadDataErrors) {
+ Map<String, List<ErrorMessage>> uploadDataErrors) {
if (MapUtils.isEmpty(uploadDataErrors)) {
return null;
}
return uploadDataErrors.entrySet().stream().collect(
- Collectors.toMap(entry -> entry.getKey(), entry -> mapErrorMessages(entry.getValue())));
+ Collectors.toMap(entry -> entry.getKey(), entry -> mapErrorMessages(entry.getValue())));
}
private static QuestionnaireValidationResultDto mapQuestionnaireValidationResult(
- QuestionnaireValidationResult questionnaireValidationResult) {
+ QuestionnaireValidationResult questionnaireValidationResult) {
if (Objects.isNull(questionnaireValidationResult)
- || Objects.isNull(questionnaireValidationResult.getValidationData())) {
+ || Objects.isNull(questionnaireValidationResult.getValidationData())) {
return null;
}
QuestionnaireValidationResultDto questionnaireValidationResultDto =
- new QuestionnaireValidationResultDto();
+ new QuestionnaireValidationResultDto();
questionnaireValidationResultDto.setValid(questionnaireValidationResult.isValid());
Set<CompositionEntityValidationDataDto> validationDataDto = new HashSet<>();
- for(CompositionEntityValidationData validationData : questionnaireValidationResult.getValidationData()){
+ for (CompositionEntityValidationData validationData : questionnaireValidationResult
+ .getValidationData()) {
validationDataDto.add(new MapCompositionEntityValidationDataToDto().applyMapping
- (validationData, CompositionEntityValidationDataDto.class));
+ (validationData, CompositionEntityValidationDataDto.class));
}
questionnaireValidationResultDto.setValidationData(validationDataDto);
@@ -87,7 +86,7 @@ public class MapValidationResponseToDto
componentValidationResultDto.setValid(componentValidationResult.isValid());
Set<CompositionEntityValidationDataDto> validationDataDto = new HashSet<>();
- for(CompositionEntityValidationData validationData : componentValidationResult.getValidationData()){
+ for(CompositionEntityValidationData validationData : componentValidationResult.getInfo()){
validationDataDto.add(new MapCompositionEntityValidationDataToDto().applyMapping
(validationData, CompositionEntityValidationDataDto.class));
}
@@ -106,7 +105,7 @@ public class MapValidationResponseToDto
deploymentFlavorValidationResultDto.setValid(deploymentFlavorValidationResult.isValid());
Set<CompositionEntityValidationDataDto> validationDataDto = new HashSet<>();
- for(CompositionEntityValidationData validationData : deploymentFlavorValidationResult.getValidationData()){
+ for(CompositionEntityValidationData validationData : deploymentFlavorValidationResult.getInfo()){
validationDataDto.add(new MapCompositionEntityValidationDataToDto().applyMapping
(validationData, CompositionEntityValidationDataDto.class));
}
@@ -117,14 +116,14 @@ public class MapValidationResponseToDto
private static List<ErrorMessageDto> mapErrorMessages(List<ErrorMessage> errorMessages) {
return errorMessages == null ? null : errorMessages.stream().map(
- errorMessage -> new MapErrorMessageToDto()
- .applyMapping(errorMessage, ErrorMessageDto.class)).collect(Collectors.toList());
+ errorMessage -> new MapErrorMessageToDto()
+ .applyMapping(errorMessage, ErrorMessageDto.class)).collect(Collectors.toList());
}
private static Collection<ErrorCodeDto> mapErrorCodes(Collection<ErrorCode> errorCodes) {
return CollectionUtils.isEmpty(errorCodes) ? null : errorCodes.stream()
- .map(errorCode -> new MapErrorCodeToDto().applyMapping(errorCode, ErrorCodeDto.class))
- .collect(Collectors.toList());
+ .map(errorCode -> new MapErrorCodeToDto().applyMapping(errorCode, ErrorCodeDto.class))
+ .collect(Collectors.toList());
}
@Override
@@ -134,6 +133,6 @@ public class MapValidationResponseToDto
target.setLicensingDataErrors(mapErrorCodes(source.getLicensingDataErrors()));
target.setUploadDataErrors(mapUploadDataErrors(source.getUploadDataErrors()));
target.setQuestionnaireValidationResult(
- mapQuestionnaireValidationResult(source.getQuestionnaireValidationResult()));
+ mapQuestionnaireValidationResult(source.getQuestionnaireValidationResult()));
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java
deleted file mode 100644
index 815135f834..0000000000
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.openecomp.sdcrests.vsp.rest.mapping;
-
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
-import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
-import org.openecomp.sdcrests.common.types.VersionDto;
-import org.openecomp.sdcrests.mapping.MappingBase;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
-
-import java.util.stream.Collectors;
-
-public class MapVersionedVendorSoftwareProductInfoToVspDetailsDto
- extends MappingBase<VersionedVendorSoftwareProductInfo, VspDetailsDto> {
-
- @Override
- public void doMapping(VersionedVendorSoftwareProductInfo source, VspDetailsDto target) {
- VspDetails vsp = source.getVspDetails();
-
- target.setId(vsp.getId());
- target.setVersion(new VersionDto(vsp.getVersion().toString(), vsp.getVersion().toString()));
- target.setName(vsp.getName());
- target.setDescription(vsp.getDescription());
- target.setCategory(vsp.getCategory());
- target.setSubCategory(vsp.getSubCategory());
- target.setVendorId(vsp.getVendorId());
- target.setVendorName(vsp.getVendorName());
- target.setOnboardingOrigin(vsp.getOnboardingOrigin());
- target.setLicensingVersion(vsp.getVlmVersion() == null ? null : new VersionDto(vsp.getVlmVersion().toString(), vsp.getVlmVersion().toString()));
- target.setIsOldVersion("False");
- target.setNetworkPackageName(vsp.getNetworkPackageName());
-
- if (vsp.getLicenseAgreement() != null || vsp.getFeatureGroups() != null) {
- LicensingData licensingData = new LicensingData();
- licensingData.setLicenseAgreement(vsp.getLicenseAgreement());
- licensingData.setFeatureGroups(vsp.getFeatureGroups());
- target.setLicensingData(licensingData);
- }
-
- target.setValidationData(vsp.getValidationDataStructure());
-
- target.setStatus(source.getVersionInfo().getStatus());
- target.setLockingUser(source.getVersionInfo().getLockingUser());
-
- if (!CommonMethods.isEmpty(source.getVersionInfo().getViewableVersions())) {
- target.setViewableVersions(
- source.getVersionInfo().getViewableVersions().stream()
- .map(version -> new VersionDto(version.toString(), version.toString()))
- .collect(Collectors.toList()));
- }
-
- if (!CommonMethods.isEmpty(source.getVersionInfo().getFinalVersions())) {
- target.setFinalVersions(
- source.getVersionInfo().getFinalVersions().stream()
- .map(version -> new VersionDto(version.toString(), version.toString()))
- .collect(Collectors.toList()));
- }
-
- //Onboarding Method valid value will always be present in VSP saved in DB
- target.setOnboardingMethod(vsp.getOnboardingMethod());
-
- }
-}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItem.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItem.java
new file mode 100644
index 0000000000..3a7800f1c3
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItem.java
@@ -0,0 +1,16 @@
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.versioning.types.Item;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
+import org.openecomp.sdcrests.vsp.rest.services.VspItemProperty;
+
+public class MapVspDescriptionDtoToItem extends MappingBase<VspDescriptionDto, Item> {
+ @Override
+ public void doMapping(VspDescriptionDto source, Item target) {
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ target.addProperty(VspItemProperty.VENDOR_ID, source.getVendorId());
+ target.addProperty(VspItemProperty.VENDOR_NAME, source.getVendorName());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java
index ba3d92e5d2..634bd90d20 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java
@@ -23,7 +23,6 @@ package org.openecomp.sdcrests.vsp.rest.mapping;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdcrests.common.types.VersionDto;
import org.openecomp.sdcrests.mapping.MappingBase;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
@@ -38,17 +37,9 @@ public class MapVspDescriptionDtoToVspDetails extends MappingBase<VspDescription
target.setIcon(source.getIcon());
target.setVendorName(source.getVendorName());
target.setVendorId(source.getVendorId());
- target.setOnboardingMethod(source.getOnboardingMethod());
- target.setOnboardingOrigin(source.getOnboardingOrigin());
- target.setNetworkPackageName(source.getNetworkPackageName());
- VersionDto vlmVersion = source.getLicensingVersion();
- if (vlmVersion != null) {
- Version version = Version.valueOf(vlmVersion.getId());
- target.setVlmVersion(version);
-// target.setVlmVersion(
-// Pattern.compile(Version.VERSION_REGEX).matcher(vlmVersion.getId()).find() ? Version
-// .valueOf(vlmVersion.getId()) : null);
+ if (source.getLicensingVersion() != null) {
+ target.setVlmVersion(new Version(source.getLicensingVersion()));
}
LicensingData licensingData = source.getLicensingData();
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDto.java
new file mode 100644
index 0000000000..6e659cbb54
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDto.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
+
+public class MapVspDetailsToDto extends MappingBase<VspDetails, VspDetailsDto> {
+
+ @Override
+ public void doMapping(VspDetails source, VspDetailsDto target) {
+ target.setId(source.getId());
+ target.setVersion(source.getVersion() == null ? null : source.getVersion().getId());
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ target.setIcon(source.getIcon());
+ target.setCategory(source.getCategory());
+ target.setSubCategory(source.getSubCategory());
+ target.setVendorId(source.getVendorId());
+ target.setVendorName(source.getVendorName());
+ target.setLicensingVersion(
+ source.getVlmVersion() == null ? null : source.getVlmVersion().getId());
+
+ if (source.getLicenseAgreement() != null || source.getFeatureGroups() != null) {
+ LicensingData licensingData = new LicensingData();
+ licensingData.setLicenseAgreement(source.getLicenseAgreement());
+ licensingData.setFeatureGroups(source.getFeatureGroups());
+ target.setLicensingData(licensingData);
+ }
+
+ target.setOnboardingMethod(source.getOnboardingMethod());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependenciesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependenciesImpl.java
new file mode 100644
index 0000000000..73c2bac976
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependenciesImpl.java
@@ -0,0 +1,119 @@
+package org.openecomp.sdcrests.vsp.rest.services;
+
+import org.openecomp.sdc.logging.context.MdcUtil;
+import org.openecomp.sdc.logging.types.LoggerServiceName;
+import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManager;
+import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyCreationDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModel;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyResponseDto;
+import org.openecomp.sdcrests.vsp.rest.ComponentDependencies;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentDependencyEntityToCreationDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentDependencyEntityToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentDependencyModelRequestToEntity;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+@Named
+@Service("componentDependencies")
+@Scope(value = "prototype")
+public class ComponentDependenciesImpl implements ComponentDependencies {
+
+ private ComponentDependencyModelManager componentDependencyModelManager =
+ ComponentDependencyModelManagerFactory.getInstance().createInterface();
+
+ @Override
+ public Response create(ComponentDependencyModel request, String vspId, String versionId,
+ String user) {
+ MdcUtil.initMdc(LoggerServiceName.CREATE_COMPONENT_DEPENDENCY_MODEL.toString());
+ List<ComponentDependencyModelEntity> modelEntities = new
+ ArrayList<ComponentDependencyModelEntity>();
+
+ final Version version = new Version(versionId);
+
+ ComponentDependencyModelEntity modelEntity =
+ new MapComponentDependencyModelRequestToEntity().applyMapping(request,
+ ComponentDependencyModelEntity.class);
+
+ modelEntity.setVspId(vspId);
+ modelEntity.setVersion(version);
+
+ ComponentDependencyModelEntity componentDependency =
+ componentDependencyModelManager.createComponentDependency(modelEntity, vspId, version);
+
+ MapComponentDependencyEntityToCreationDto mapping =
+ new MapComponentDependencyEntityToCreationDto();
+ ComponentDependencyCreationDto createdComponentDependencyDto = mapping.applyMapping(
+ componentDependency, ComponentDependencyCreationDto.class);
+ return Response.ok(componentDependency != null ? createdComponentDependencyDto : null)
+ .build();
+ }
+
+ @Override
+ public Response list(String vspId, String versionId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.GET_LIST_COMPONENT_DEPENDENCY.toString());
+ Version vspVersion = new Version(versionId);
+
+ Collection<ComponentDependencyModelEntity> componentDependencies =
+ componentDependencyModelManager.list(vspId, vspVersion);
+
+ MapComponentDependencyEntityToDto mapper = new MapComponentDependencyEntityToDto();
+ GenericCollectionWrapper<ComponentDependencyResponseDto> results = new GenericCollectionWrapper
+ <ComponentDependencyResponseDto>();
+ for (ComponentDependencyModelEntity entity : componentDependencies) {
+ results.add(mapper.applyMapping(entity, ComponentDependencyResponseDto.class));
+ }
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response delete(String vspId, String versionId, String dependencyId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.DELETE_COMPONENT_DEPENDENCY.toString());
+ Version vspVersion = new Version(versionId);
+ componentDependencyModelManager.delete(vspId, vspVersion, dependencyId);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response update(ComponentDependencyModel request, String vspId, String versionId, String
+ dependencyId, String user) {
+
+ MdcUtil.initMdc(LoggerServiceName.UPDATE_COMPONENT_DEPENDENCY.toString());
+
+ final Version version = new Version(versionId);
+ ComponentDependencyModelEntity modelEntity =
+ new MapComponentDependencyModelRequestToEntity().applyMapping(request,
+ ComponentDependencyModelEntity.class);
+
+ modelEntity.setId(dependencyId);
+ modelEntity.setVspId(vspId);
+ modelEntity.setVersion(version);
+ componentDependencyModelManager.update(modelEntity);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response get(String vspId, String version, String dependencyId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.GET_COMPONENT_DEPENDENCY.toString());
+ ComponentDependencyModelEntity componentDependencyModelEntity = componentDependencyModelManager
+ .get(vspId, new Version(version), dependencyId);
+
+ MapComponentDependencyEntityToDto mapper = new MapComponentDependencyEntityToDto();
+ ComponentDependencyResponseDto componentDependencyResponseDto =
+ mapper.applyMapping(componentDependencyModelEntity, ComponentDependencyResponseDto.class);
+
+ return Response.ok(componentDependencyModelEntity != null ? componentDependencyResponseDto :
+ null).build();
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependencyModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependencyModelsImpl.java
deleted file mode 100644
index 4a23140c88..0000000000
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependencyModelsImpl.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.openecomp.sdcrests.vsp.rest.services;
-
-import org.openecomp.sdc.logging.context.MdcUtil;
-import org.openecomp.sdc.logging.types.LoggerServiceName;
-import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManager;
-import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModel;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModelRequestDto;
-import org.openecomp.sdcrests.vsp.rest.ComponentDependencyModels;
-import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentDependencyModelEntityToDto;
-import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentDependencyModelRequestToEntity;
-
-import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import javax.inject.Named;
-import javax.ws.rs.core.Response;
-
-@Named
-@Service("componentDependencyModel")
-@Scope(value = "prototype")
-public class ComponentDependencyModelsImpl implements ComponentDependencyModels {
-
- private ComponentDependencyModelManager componentDependencyModelManager =
- ComponentDependencyModelManagerFactory.getInstance().createInterface();
-
- @Override
- public Response create(ComponentDependencyModelRequestDto request, String vspId,
- String versionId, String user) {
- MdcUtil.initMdc(LoggerServiceName.CREATE_COMPONENT_DEPENDENCY_MODEL.toString());
- List<ComponentDependencyModelEntity> modelEntities = new
- ArrayList<ComponentDependencyModelEntity>();
-
- final Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
-
- if (request.getComponentDependencyModels() != null) {
- for(ComponentDependencyModel model : request.getComponentDependencyModels()) {
- ComponentDependencyModelEntity modelEntity =
- new MapComponentDependencyModelRequestToEntity().applyMapping(model,
- ComponentDependencyModelEntity.class);
-
- modelEntity.setVspId(vspId);
- modelEntity.setVersion(version);
- modelEntities.add(modelEntity);
- }
- }
-
- componentDependencyModelManager
- .createComponentDependencyModel(modelEntities, vspId, version, user);
-
- return Response.ok().build();
- }
-
- @Override
- public Response list(String vspId, String versionId, String user) {
- MdcUtil.initMdc(LoggerServiceName.GET_COMPONENT_DEPENDENCY_MODEL.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
-
- Collection<ComponentDependencyModelEntity> componentDependencies =
- componentDependencyModelManager.list(vspId, vspVersion, user);
-
- MapComponentDependencyModelEntityToDto mapper = new MapComponentDependencyModelEntityToDto();
- GenericCollectionWrapper<ComponentDependencyModel> results = new GenericCollectionWrapper
- <ComponentDependencyModel>();
- for (ComponentDependencyModelEntity entity : componentDependencies) {
- results.add(mapper.applyMapping(entity, ComponentDependencyModel.class));
- }
-
- return Response.ok(results).build();
- }
-}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentMonitoringUploadsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentMonitoringUploadsImpl.java
index a971782a15..a997d94d63 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentMonitoringUploadsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentMonitoringUploadsImpl.java
@@ -16,7 +16,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.MonitoringUploadStatusDto;
import org.openecomp.sdcrests.vsp.rest.ComponentMonitoringUploads;
import org.openecomp.sdcrests.vsp.rest.mapping.MapMonitoringUploadStatusToDto;
@@ -54,13 +53,13 @@ public class ComponentMonitoringUploadsImpl implements ComponentMonitoringUpload
logger.audit(AuditMessages.AUDIT_MSG + String.format(AuditMessages
.UPLOAD_MONITORING_FILE, type, vspId, componentId));
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.validateComponentExistence(vspId, version, componentId, user);
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
MonitoringUploadType monitoringUploadType = getMonitoringUploadType(vspId, componentId, type);
monitoringUploadsManager.upload(attachment.getObject(InputStream.class),
attachment.getContentDisposition().getParameter("filename"), vspId, version, componentId,
- monitoringUploadType, user);
+ monitoringUploadType);
mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId + "," + componentId);
return Response.ok().build();
@@ -88,10 +87,9 @@ public class ComponentMonitoringUploadsImpl implements ComponentMonitoringUpload
MonitoringUploadType monitoringUploadType = getMonitoringUploadType(vspId, componentId, type);
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.validateComponentExistence(vspId, version, componentId, user);
- monitoringUploadsManager
- .delete(vspId, version, componentId, monitoringUploadType, user);
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
+ monitoringUploadsManager.delete(vspId, version, componentId, monitoringUploadType);
mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId + "," + componentId);
return Response.ok().build();
@@ -102,16 +100,15 @@ public class ComponentMonitoringUploadsImpl implements ComponentMonitoringUpload
String user) {
MdcUtil.initMdc(LoggerServiceName.List_Monitoring_Artifacts.toString());
- Version version = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, version, componentId, user);
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
- MonitoringUploadStatus response = monitoringUploadsManager
- .listFilenames(vspId, version, componentId, user);
+ MonitoringUploadStatus response =
+ monitoringUploadsManager.listFilenames(vspId, version, componentId);
MonitoringUploadStatusDto returnEntity =
new MapMonitoringUploadStatusToDto()
.applyMapping(response, MonitoringUploadStatusDto.class);
return Response.status(Response.Status.OK).entity(returnEntity).build();
-
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImpl.java
index abcb3c5322..bad6f169d9 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImpl.java
@@ -21,6 +21,10 @@
package org.openecomp.sdcrests.vsp.rest.services;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.openecomp.sdc.activitylog.ActivityLogManager;
+import org.openecomp.sdc.activitylog.ActivityLogManagerFactory;
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.activitylog.dao.type.ActivityType;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.MdcUtil;
@@ -30,10 +34,8 @@ import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.ProcessManager;
import org.openecomp.sdc.vendorsoftwareproduct.ProcessManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
import org.openecomp.sdcrests.vsp.rest.ComponentProcesses;
@@ -50,8 +52,6 @@ import java.io.File;
import java.io.InputStream;
import java.util.Collection;
-import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID;
-
@Named
@Service("componentProcesses")
@Scope(value = "prototype")
@@ -60,21 +60,18 @@ public class ComponentProcessesImpl implements ComponentProcesses {
private ProcessManager processManager = ProcessManagerFactory.getInstance().createInterface();
private ComponentManager componentManager =
ComponentManagerFactory.getInstance().createInterface();
- private static final Logger logger =
- LoggerFactory.getLogger(ComponentProcessesImpl.class);
+ private ActivityLogManager activityLogManager =
+ ActivityLogManagerFactory.getInstance().createInterface();
+
+ private static final Logger logger =
+ LoggerFactory.getLogger(ComponentProcessesImpl.class);
@Override
public Response list(String vspId, String versionId, String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.List_Component_Processes.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- validateComponentExistence(vspId, vspVersion, componentId, user);
- Collection<ProcessEntity> processes;
- if (componentId.equals(VendorSoftwareProductConstants.GENERAL_COMPONENT_ID)) {
- processes = processManager.listProcesses(vspId, vspVersion, null, user);
- } else {
- processes = processManager.listProcesses(vspId, vspVersion, componentId, user);
- }
-
+ Version version = new Version(versionId);
+ validateComponentExistence(vspId, version, componentId, user);
+ Collection<ProcessEntity> processes = processManager.listProcesses(vspId, version, componentId);
MapProcessEntityToProcessEntityDto mapper = new MapProcessEntityToProcessEntityDto();
GenericCollectionWrapper<ProcessEntityDto> results = new GenericCollectionWrapper<>();
@@ -88,9 +85,9 @@ public class ComponentProcessesImpl implements ComponentProcesses {
@Override
public Response deleteList(String vspId, String versionId, String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_List_Component_Processes.toString());
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
+ Version version = new Version(versionId);
validateComponentExistence(vspId, version, componentId, user);
- processManager.deleteProcesses(vspId, version, componentId, user);
+ processManager.deleteProcesses(vspId, version, componentId);
return Response.ok().build();
}
@@ -102,13 +99,11 @@ public class ComponentProcessesImpl implements ComponentProcesses {
ProcessEntity process =
new MapProcessRequestDtoToProcessEntity().applyMapping(request, ProcessEntity.class);
process.setVspId(vspId);
- process.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
- if (!componentId.equals(VendorSoftwareProductConstants.GENERAL_COMPONENT_ID)) {
- process.setComponentId(componentId);
- }
+ process.setVersion(new Version(versionId));
+ process.setComponentId(componentId);
validateComponentExistence(vspId, process.getVersion(), componentId, user);
- ProcessEntity createdProcess = processManager.createProcess(process, user);
+ ProcessEntity createdProcess = processManager.createProcess(process);
return Response
.ok(createdProcess != null ? new StringWrapperResponse(createdProcess.getId()) : null)
@@ -119,10 +114,9 @@ public class ComponentProcessesImpl implements ComponentProcesses {
public Response get(String vspId, String versionId, String componentId, String processId,
String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Component_Processes.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- validateComponentExistence(vspId, vspVersion, componentId, user);
- ProcessEntity process =
- processManager.getProcess(vspId, vspVersion, componentId, processId, user);
+ Version version = new Version(versionId);
+ validateComponentExistence(vspId, version, componentId, user);
+ ProcessEntity process = processManager.getProcess(vspId, version, componentId, processId);
ProcessEntityDto result =
new MapProcessEntityToProcessEntityDto().applyMapping(process, ProcessEntityDto.class);
return Response.ok(result).build();
@@ -132,9 +126,9 @@ public class ComponentProcessesImpl implements ComponentProcesses {
public Response delete(String vspId, String versionId, String componentId, String processId,
String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_Component_Processes.toString());
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
+ Version version = new Version(versionId);
validateComponentExistence(vspId, version, componentId, user);
- processManager.deleteProcess(vspId, version, componentId, processId, user);
+ processManager.deleteProcess(vspId, version, componentId, processId);
return Response.ok().build();
}
@@ -146,11 +140,11 @@ public class ComponentProcessesImpl implements ComponentProcesses {
ProcessEntity process =
new MapProcessRequestDtoToProcessEntity().applyMapping(request, ProcessEntity.class);
process.setVspId(vspId);
- process.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
+ process.setVersion(new Version(versionId));
process.setComponentId(componentId);
process.setId(processId);
validateComponentExistence(vspId, process.getVersion(), componentId, user);
- processManager.updateProcess(process, user);
+ processManager.updateProcess(process);
return Response.ok().build();
}
@@ -158,9 +152,9 @@ public class ComponentProcessesImpl implements ComponentProcesses {
public Response getUploadedFile(String vspId, String versionId, String componentId,
String processId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Uploaded_File_Component_Processes.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
+ Version vspVersion = new Version(versionId);
validateComponentExistence(vspId, vspVersion, componentId, user);
- File file = processManager.getProcessArtifact(vspId, vspVersion, componentId, processId, user);
+ File file = processManager.getProcessArtifact(vspId, vspVersion, componentId, processId);
Response.ResponseBuilder response = Response.ok(file);
if (file == null) {
@@ -175,9 +169,9 @@ public class ComponentProcessesImpl implements ComponentProcesses {
String processId,
String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_Uploaded_File_Component_Processes.toString());
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
+ Version version = new Version(versionId);
validateComponentExistence(vspId, version, componentId, user);
- processManager.deleteProcessArtifact(vspId, version, componentId, processId, user);
+ processManager.deleteProcessArtifact(vspId, version, componentId, processId);
return Response.ok().build();
}
@@ -186,21 +180,26 @@ public class ComponentProcessesImpl implements ComponentProcesses {
String componentId,
String processId, String user) {
MdcUtil.initMdc(LoggerServiceName.Upload_File_Component_Processes.toString());
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.UPLOAD_PROCESS_ARTIFACT + vspId);
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.UPLOAD_PROCESS_ARTIFACT + vspId);
+ Version version = new Version(versionId);
validateComponentExistence(vspId, version, componentId, user);
processManager.uploadProcessArtifact(attachment.getObject(InputStream.class),
attachment.getContentDisposition().getParameter("filename"), vspId, version, componentId,
- processId, user);
+ processId);
+
+
+ activityLogManager.logActivity(new ActivityLogEntity(vspId, version,
+ ActivityType.Upload_Artifact, user, true, "", ""));
+
return Response.ok().build();
}
private void validateComponentExistence(String vspId, Version version, String componentId,
String user) {
- if (GENERAL_COMPONENT_ID.equals(componentId)) {
+ if (componentId == null) {
return;
}
- componentManager.validateComponentExistence(vspId, version, componentId, user);
+ componentManager.validateComponentExistence(vspId, version, componentId);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java
index fa7e9249c2..de422ece7f 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java
@@ -31,7 +31,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentCreationDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRequestDto;
@@ -50,9 +49,9 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.util.Collection;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.util.Collection;
@Named
@Service("components")
@@ -65,8 +64,7 @@ public class ComponentsImpl implements Components {
public Response list(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.List_Components.toString());
Collection<ComponentEntity> components =
- componentManager.listComponents(vspId, resolveVspVersion(vspId, versionId, user,
- VersionableEntityAction.Read), user);
+ componentManager.listComponents(vspId, new Version(versionId));
MapComponentEntityToComponentDto mapper = new MapComponentEntityToComponentDto();
GenericCollectionWrapper<ComponentDto> results = new GenericCollectionWrapper<>();
@@ -80,8 +78,7 @@ public class ComponentsImpl implements Components {
@Override
public Response deleteList(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_List_Components.toString());
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.deleteComponents(vspId, version, user);
+ componentManager.deleteComponents(vspId, new Version(versionId));
return Response.ok().build();
}
@@ -91,9 +88,9 @@ public class ComponentsImpl implements Components {
ComponentEntity component =
new MapComponentRequestDtoToComponentEntity().applyMapping(request, ComponentEntity.class);
component.setVspId(vspId);
- component.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
+ component.setVersion(new Version(versionId));
- ComponentEntity createdComponent = componentManager.createComponent(component, user);
+ ComponentEntity createdComponent = componentManager.createComponent(component);
MapComponentEntityToComponentCreationDto mapping =
new MapComponentEntityToComponentCreationDto();
ComponentCreationDto createdComponentDto = mapping.applyMapping(createdComponent,
@@ -106,9 +103,8 @@ public class ComponentsImpl implements Components {
@Override
public Response get(String vspId, String versionId, String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Component.toString());
- CompositionEntityResponse<ComponentData> response = componentManager
- .getComponent(vspId, resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read),
- componentId, user);
+ CompositionEntityResponse<ComponentData> response =
+ componentManager.getComponent(vspId, new Version(versionId), componentId);
CompositionEntityResponseDto<ComponentDto> responseDto = new CompositionEntityResponseDto<>();
new MapCompositionEntityResponseToDto<>(new MapComponentDataToComponentDto(),
@@ -119,23 +115,23 @@ public class ComponentsImpl implements Components {
@Override
public Response delete(String vspId, String versionId, String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_Component.toString());
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.deleteComponent(vspId, version, componentId, user);
+ componentManager.deleteComponent(vspId, new Version(versionId), componentId);
return Response.ok().build();
}
@Override
- public Response update(ComponentRequestDto request, String vspId, String versionId, String componentId,
+ public Response update(ComponentRequestDto request, String vspId, String versionId,
+ String componentId,
String user) {
MdcUtil.initMdc(LoggerServiceName.Update_Component.toString());
ComponentEntity componentEntity =
new MapComponentRequestDtoToComponentEntity().applyMapping(request, ComponentEntity.class);
componentEntity.setVspId(vspId);
- componentEntity.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
+ componentEntity.setVersion(new Version(versionId));
componentEntity.setId(componentId);
CompositionEntityValidationData validationData =
- componentManager.updateComponent(componentEntity, user);
+ componentManager.updateComponent(componentEntity);
return validationData != null && CollectionUtils.isNotEmpty(validationData.getErrors())
? Response.status(Response.Status.EXPECTATION_FAILED).entity(
new MapCompositionEntityValidationDataToDto().applyMapping(validationData,
@@ -143,12 +139,11 @@ public class ComponentsImpl implements Components {
}
@Override
- public Response getQuestionnaire(String vspId, String versionId, String componentId, String user) {
+ public Response getQuestionnaire(String vspId, String versionId, String componentId,
+ String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Questionnaire_Component.toString());
- QuestionnaireResponse questionnaireResponse = componentManager
- .getQuestionnaire(vspId,
- resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), componentId,
- user);
+ QuestionnaireResponse questionnaireResponse =
+ componentManager.getQuestionnaire(vspId, new Version(versionId), componentId);
QuestionnaireResponseDto result = new MapQuestionnaireResponseToQuestionnaireResponseDto()
.applyMapping(questionnaireResponse, QuestionnaireResponseDto.class);
@@ -156,11 +151,11 @@ public class ComponentsImpl implements Components {
}
@Override
- public Response updateQuestionnaire(String questionnaireData, String vspId, String versionId, String componentId,
- String user) {
+ public Response updateQuestionnaire(String questionnaireData, String vspId, String versionId,
+ String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.Update_Questionnaire_Component.toString());
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.updateQuestionnaire(vspId, version, componentId, questionnaireData, user);
+ componentManager
+ .updateQuestionnaire(vspId, new Version(versionId), componentId, questionnaireData);
return Response.ok().build();
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImpl.java
index 599b5adac7..081024a519 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImpl.java
@@ -14,7 +14,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeCreationDto;
@@ -33,9 +32,9 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.util.Collection;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.util.Collection;
@Named
@Service("computes")
@@ -47,13 +46,12 @@ public class ComputeImpl implements Compute {
ComponentManagerFactory.getInstance().createInterface();
@Override
- public Response list(String vspId, String version, String componentId, String user) {
+ public Response list(String vspId, String versionId, String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.List_Computes.toString());
- Version vspVersion = resolveVspVersion(vspId, version, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
Collection<ListComputeResponse> computes =
- computetManager
- .listCompute(vspId, vspVersion, componentId, user);
+ computetManager.listComputes(vspId, version, componentId);
MapComputeEntityToComputeDto mapper = new MapComputeEntityToComputeDto();
GenericCollectionWrapper<ComputeDto> results = new GenericCollectionWrapper<>();
@@ -65,13 +63,13 @@ public class ComputeImpl implements Compute {
}
@Override
- public Response get(String vspId, String version, String componentId, String computeId,
+ public Response get(String vspId, String versionId, String componentId, String computeId,
String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Compute.toString());
- Version vspVersion = resolveVspVersion(vspId, version, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
- CompositionEntityResponse<ComputeData> response = computetManager
- .getCompute(vspId, vspVersion, componentId, computeId, user);
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
+ CompositionEntityResponse<ComputeData> response =
+ computetManager.getCompute(vspId, version, componentId, computeId);
CompositionEntityResponseDto<ComputeDetailsDto> responseDto = new
CompositionEntityResponseDto<>();
@@ -87,33 +85,31 @@ public class ComputeImpl implements Compute {
ComputeEntity compute = new MapComputeDetailsDtoToComputeEntity().applyMapping(request,
ComputeEntity.class);
compute.setVspId(vspId);
+ compute.setVersion(new Version(versionId));
compute.setComponentId(componentId);
- compute.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
- componentManager.validateComponentExistence(vspId, compute.getVersion(), componentId, user);
+ componentManager.validateComponentExistence(vspId, compute.getVersion(), componentId);
- ComputeEntity createdCompute = computetManager.createCompute(compute, user);
+ ComputeEntity createdCompute = computetManager.createCompute(compute);
MapComputeEntityToComputeCreationDto mapper = new MapComputeEntityToComputeCreationDto();
- ComputeCreationDto createdComputeDto = mapper.applyMapping(createdCompute, ComputeCreationDto
- .class);
- return Response.ok(createdComputeDto != null ? createdComputeDto : null)
- .build();
+ ComputeCreationDto createdComputeDto =
+ mapper.applyMapping(createdCompute, ComputeCreationDto.class);
+ return Response.ok(createdComputeDto != null ? createdComputeDto : null).build();
}
@Override
- public Response update(ComputeDetailsDto request, String vspId, String versionId, String
- componentId, String computeFlavorId, String user) {
+ public Response update(ComputeDetailsDto request, String vspId, String versionId,
+ String componentId, String computeFlavorId, String user) {
MdcUtil.initMdc(LoggerServiceName.Update_Compute.toString());
- ComputeEntity compute = new MapComputeDetailsDtoToComputeEntity().applyMapping(request,
- ComputeEntity.class);
+ ComputeEntity compute =
+ new MapComputeDetailsDtoToComputeEntity().applyMapping(request, ComputeEntity.class);
compute.setVspId(vspId);
+ compute.setVersion(new Version(versionId));
compute.setComponentId(componentId);
- compute.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
compute.setId(computeFlavorId);
- componentManager.validateComponentExistence(vspId, compute.getVersion(), componentId, user);
- CompositionEntityValidationData validationData =
- computetManager.updateCompute(compute, user);
+ componentManager.validateComponentExistence(vspId, compute.getVersion(), componentId);
+ CompositionEntityValidationData validationData = computetManager.updateCompute(compute);
return validationData != null && CollectionUtils.isNotEmpty(validationData.getErrors())
? Response.status(Response.Status.EXPECTATION_FAILED).entity(
new MapCompositionEntityValidationDataToDto().applyMapping(validationData,
@@ -121,23 +117,23 @@ public class ComputeImpl implements Compute {
}
@Override
- public Response delete(String vspId, String versionId, String componentId, String
- computeFlavorId, String user) {
+ public Response delete(String vspId, String versionId, String componentId, String computeFlavorId,
+ String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_Compute.toString());
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.validateComponentExistence(vspId, version, componentId, user);
- computetManager.deleteCompute(vspId, version, componentId, computeFlavorId, user);
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
+ computetManager.deleteCompute(vspId, version, componentId, computeFlavorId);
return Response.ok().build();
}
@Override
- public Response getQuestionnaire(String vspId, String versionId, String componentId, String
- computeFlavorId, String user) {
+ public Response getQuestionnaire(String vspId, String versionId, String componentId,
+ String computeFlavorId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Questionnaire_Compute.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
- QuestionnaireResponse questionnaireResponse = computetManager
- .getComputeQuestionnaire(vspId, vspVersion, componentId, computeFlavorId, user);
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
+ QuestionnaireResponse questionnaireResponse =
+ computetManager.getComputeQuestionnaire(vspId, version, componentId, computeFlavorId);
QuestionnaireResponseDto result = new MapQuestionnaireResponseToQuestionnaireResponseDto()
.applyMapping(questionnaireResponse, QuestionnaireResponseDto.class);
@@ -146,16 +142,12 @@ public class ComputeImpl implements Compute {
@Override
public Response updateQuestionnaire(String questionnaireData, String vspId, String versionId,
- String componentId,
- String computeFlavorId, String user) {
- MdcUtil
- .initMdc(LoggerServiceName.Update_Questionnaire_Compute.toString()
- );
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.validateComponentExistence(vspId, version, componentId, user);
- computetManager
- .updateComputeQuestionnaire(vspId, version, componentId, computeFlavorId,
- questionnaireData, user);
+ String componentId, String computeFlavorId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Update_Questionnaire_Compute.toString());
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
+ computetManager.updateComputeQuestionnaire(vspId, version, componentId, computeFlavorId,
+ questionnaireData);
return Response.ok().build();
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImpl.java
index 03372269fc..d1486b66b8 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImpl.java
@@ -10,7 +10,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorCreationDto;
@@ -28,15 +27,14 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.util.Collection;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.util.Collection;
@Named
@Service("deploymentFlavors")
@Scope(value = "prototype")
-public class DeploymentFlavorsImpl implements DeploymentFlavors
-{
+public class DeploymentFlavorsImpl implements DeploymentFlavors {
private DeploymentFlavorManager deploymentFlavorManager =
DeploymentFlavorManagerFactory.getInstance().createInterface();
@@ -48,29 +46,28 @@ public class DeploymentFlavorsImpl implements DeploymentFlavors
new MapDeploymentFlavorRequestDtoToDeploymentFlavorEntity()
.applyMapping(request, DeploymentFlavorEntity.class);
deploymentFlavorEntity.setVspId(vspId);
- deploymentFlavorEntity.setVersion(resolveVspVersion(vspId, null, user,
- VersionableEntityAction.Write));
+ deploymentFlavorEntity.setVersion(new Version(versionId));
DeploymentFlavorEntity createdDeploymentFlavor =
- deploymentFlavorManager.createDeploymentFlavor(deploymentFlavorEntity, user);
+ deploymentFlavorManager.createDeploymentFlavor(deploymentFlavorEntity);
MapDeploymentFlavorEntityToDeploymentFlavorCreationDto mapping =
new MapDeploymentFlavorEntityToDeploymentFlavorCreationDto();
- DeploymentFlavorCreationDto deploymentFlavorCreatedDto= mapping.applyMapping
- (createdDeploymentFlavor,DeploymentFlavorCreationDto.class);
+ DeploymentFlavorCreationDto deploymentFlavorCreatedDto = mapping.applyMapping
+ (createdDeploymentFlavor, DeploymentFlavorCreationDto.class);
return Response
.ok(createdDeploymentFlavor != null ? deploymentFlavorCreatedDto : null)
.build();
}
@Override
- public Response list(String vspId,String version,String user) {
+ public Response list(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_List_Deployment_flavor.toString());
Collection<DeploymentFlavorEntity> deploymentFlavors =
- deploymentFlavorManager.listDeploymentFlavors(vspId, resolveVspVersion(vspId, version, user,
- VersionableEntityAction.Read), user);
+ deploymentFlavorManager.listDeploymentFlavors(vspId, new Version(versionId));
MapDeploymentFlavorEntityDeploymentFlavorToListResponse mapper = new
MapDeploymentFlavorEntityDeploymentFlavorToListResponse();
- GenericCollectionWrapper<DeploymentFlavorListResponseDto> results = new GenericCollectionWrapper<>();
+ GenericCollectionWrapper<DeploymentFlavorListResponseDto> results =
+ new GenericCollectionWrapper<>();
for (DeploymentFlavorEntity deploymentFlavor : deploymentFlavors) {
results.add(mapper.applyMapping(deploymentFlavor, DeploymentFlavorListResponseDto.class));
}
@@ -78,32 +75,32 @@ public class DeploymentFlavorsImpl implements DeploymentFlavors
}
@Override
- public Response get(String vspId, String version, String deploymentFlavorId, String user) {
+ public Response get(String vspId, String versionId, String deploymentFlavorId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Deployment_flavor.toString());
CompositionEntityResponse<DeploymentFlavor> response = deploymentFlavorManager
- .getDeploymentFlavor(vspId, resolveVspVersion(vspId, version, user,
- VersionableEntityAction.Read), deploymentFlavorId, user);
+ .getDeploymentFlavor(vspId, new Version(versionId), deploymentFlavorId);
CompositionEntityResponseDto<DeploymentFlavorDto> responseDto = new
CompositionEntityResponseDto<>();
- new MapCompositionEntityResponseToDto<>(new MapDeploymentFlavorToDeploymentDto(), DeploymentFlavorDto.class)
+ new MapCompositionEntityResponseToDto<>(new MapDeploymentFlavorToDeploymentDto(),
+ DeploymentFlavorDto.class)
.doMapping(response, responseDto);
return Response.ok(responseDto).build();
}
@Override
- public Response getSchema(String vspId, String version, String user) {
+ public Response getSchema(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Deployment_flavor.toString());
CompositionEntityResponse<DeploymentFlavor> response = deploymentFlavorManager
- .getDeploymentFlavorSchema(vspId, Version.valueOf(version), user);
+ .getDeploymentFlavorSchema(vspId, new Version(versionId));
return Response.ok(response).build();
}
@Override
public Response delete(String vspId, String versionId, String deploymentFlavorId, String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_Deployment_flavor.toString());
- Version version = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- deploymentFlavorManager.deleteDeploymentFlavor(vspId, version, deploymentFlavorId, user);
+ Version version = new Version(versionId);
+ deploymentFlavorManager.deleteDeploymentFlavor(vspId, version, deploymentFlavorId);
return Response.ok().build();
}
@@ -115,11 +112,11 @@ public class DeploymentFlavorsImpl implements DeploymentFlavors
new MapDeploymentFlavorRequestDtoToDeploymentFlavorEntity().applyMapping(request,
DeploymentFlavorEntity.class);
deploymentFlavorEntity.setVspId(vspId);
- deploymentFlavorEntity.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
+ deploymentFlavorEntity.setVersion(new Version(versionId));
deploymentFlavorEntity.setId(deploymentFlavorId);
CompositionEntityValidationData validationData =
- deploymentFlavorManager.updateDeploymentFlavor(deploymentFlavorEntity, user);
+ deploymentFlavorManager.updateDeploymentFlavor(deploymentFlavorEntity);
return validationData != null && CollectionUtils.isNotEmpty(validationData.getErrors())
? Response.status(Response.Status.EXPECTATION_FAILED).entity(
new MapCompositionEntityValidationDataToDto().applyMapping(validationData,
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImpl.java
index fcaf038dc0..b8e0f64cf2 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImpl.java
@@ -14,7 +14,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageCreationDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto;
@@ -30,32 +29,31 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.util.Collection;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.util.Collection;
@Named
@Service("images")
@Scope(value = "prototype")
-public class ImagesImpl implements Images
- {
+public class ImagesImpl implements Images {
private ImageManager imageManager = ImageManagerFactory.getInstance().createInterface();
private ComponentManager componentManager =
ComponentManagerFactory.getInstance().createInterface();
@Override
- public Response create(ImageRequestDto request, String vspId, String versionId,String
- componentId, String user) {
+ public Response create(ImageRequestDto request, String vspId, String versionId,
+ String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.Create_Image.toString());
ImageEntity image =
new MapImageRequestDtoToImageEntity().applyMapping(request, ImageEntity.class);
image.setVspId(vspId);
image.setComponentId(componentId);
- image.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
- componentManager.validateComponentExistence(vspId, image.getVersion(), componentId, user);
- ImageEntity createdImage = imageManager.createImage(image, user);
+ image.setVersion(new Version(versionId));
+ componentManager.validateComponentExistence(vspId, image.getVersion(), componentId);
+ ImageEntity createdImage = imageManager.createImage(image);
MapImageEntityToImageCreationDto mapping = new MapImageEntityToImageCreationDto();
ImageCreationDto createdImageDto = mapping.applyMapping(createdImage, ImageCreationDto.class);
return Response
@@ -66,19 +64,18 @@ public class ImagesImpl implements Images
@Override
public Response getImageSchema(String vspId, String versionId, String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.GET_Image_Schema.toString());
- CompositionEntityResponse<Image> response =
- imageManager.getImageSchema(vspId, user);
+ CompositionEntityResponse<Image> response = imageManager.getImageSchema(vspId);
return Response.ok(response).build();
}
@Override
- public Response get(String vspId, String versionId, String componentId, String imageId, String
- user) {
+ public Response get(String vspId, String versionId, String componentId, String imageId,
+ String user) {
MdcUtil.initMdc(LoggerServiceName.GET_Image.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
- CompositionEntityResponse<Image> response = imageManager.getImage(vspId,
- vspVersion, componentId, imageId, user);
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
+ CompositionEntityResponse<Image> response =
+ imageManager.getImage(vspId, version, componentId, imageId);
return Response.ok(response).build();
}
@@ -86,10 +83,9 @@ public class ImagesImpl implements Images
@Override
public Response list(String vspId, String versionId, String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.List_Images.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
- Collection<ImageEntity> images =
- imageManager.listImages(vspId, vspVersion, componentId, user);
+ Version vspVersion = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, vspVersion, componentId);
+ Collection<ImageEntity> images = imageManager.listImages(vspId, vspVersion, componentId);
MapImageEntityToImageDto mapper = new MapImageEntityToImageDto();
GenericCollectionWrapper<ImageDto> results = new GenericCollectionWrapper<>();
@@ -104,28 +100,25 @@ public class ImagesImpl implements Images
public Response delete(String vspId, String versionId, String componentId, String imageId,
String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_Image.toString());
- Version vspVersion = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
- imageManager.deleteImage(vspId, vspVersion, componentId, imageId, user);
+ Version vspVersion = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, vspVersion, componentId);
+ imageManager.deleteImage(vspId, vspVersion, componentId, imageId);
return Response.ok().build();
}
@Override
- public Response update(ImageRequestDto request, String vspId, String versionId, String
- componentId,
- String imageId,
- String user) {
+ public Response update(ImageRequestDto request, String vspId, String versionId,
+ String componentId, String imageId, String user) {
MdcUtil.initMdc(LoggerServiceName.Update_Image.toString());
ImageEntity imageEntity = new MapImageRequestDtoToImageEntity().applyMapping(request,
ImageEntity.class);
imageEntity.setVspId(vspId);
- imageEntity.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
+ imageEntity.setVersion(new Version(versionId));
imageEntity.setComponentId(componentId);
imageEntity.setId(imageId);
- componentManager.validateComponentExistence(vspId, imageEntity.getVersion(), componentId, user);
+ componentManager.validateComponentExistence(vspId, imageEntity.getVersion(), componentId);
- CompositionEntityValidationData validationData =
- imageManager.updateImage(imageEntity, user);
+ CompositionEntityValidationData validationData = imageManager.updateImage(imageEntity);
return validationData != null && CollectionUtils.isNotEmpty(validationData.getErrors())
? Response.status(Response.Status.EXPECTATION_FAILED).entity(
new MapCompositionEntityValidationDataToDto()
@@ -134,14 +127,13 @@ public class ImagesImpl implements Images
}
@Override
- public Response getQuestionnaire(String vspId, String versionId, String componentId, String
- imageId, String user) {
+ public Response getQuestionnaire(String vspId, String versionId, String componentId,
+ String imageId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Questionnaire_Compute.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
- QuestionnaireResponse questionnaireResponse = imageManager
- .getImageQuestionnaire(vspId, vspVersion, componentId, imageId,
- user);
+ Version vspVersion = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, vspVersion, componentId);
+ QuestionnaireResponse questionnaireResponse =
+ imageManager.getImageQuestionnaire(vspId, vspVersion, componentId, imageId);
QuestionnaireResponseDto result = new MapQuestionnaireResponseToQuestionnaireResponseDto()
.applyMapping(questionnaireResponse, QuestionnaireResponseDto.class);
@@ -150,15 +142,12 @@ public class ImagesImpl implements Images
}
@Override
- public Response updateQuestionnaire(String questionnaireData, String vspId, String
- versionId,String componentId,String imageId, String user) {
- MdcUtil
- .initMdc(LoggerServiceName.Update_Questionnaire_Compute.toString()
- );
- Version vspVersion = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
- imageManager.updateImageQuestionnaire(vspId, vspVersion, componentId, imageId,
- questionnaireData, user);
+ public Response updateQuestionnaire(String questionnaireData, String vspId, String versionId,
+ String componentId, String imageId, String user) {
+ MdcUtil.initMdc(LoggerServiceName.Update_Questionnaire_Compute.toString());
+ Version version = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, version, componentId);
+ imageManager.updateImageQuestionnaire(vspId, version, componentId, imageId, questionnaireData);
return Response.ok().build();
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImpl.java
index 471138f23c..5478327fc1 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImpl.java
@@ -29,7 +29,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
+import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
@@ -61,8 +61,7 @@ public class NetworksImpl implements Networks {
public Response list(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.List_Network.toString());
Collection<NetworkEntity> networks =
- networkManager.listNetworks(vspId,
- resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
+ networkManager.listNetworks(vspId, new Version(versionId));
MapNetworkEntityToNetworkDto mapper = new MapNetworkEntityToNetworkDto();
GenericCollectionWrapper<NetworkDto> results = new GenericCollectionWrapper<>();
@@ -79,8 +78,8 @@ public class NetworksImpl implements Networks {
NetworkEntity network =
new MapNetworkRequestDtoToNetworkEntity().applyMapping(request, NetworkEntity.class);
network.setVspId(vspId);
- network.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
- NetworkEntity createdNetwork = networkManager.createNetwork(network, user);
+ network.setVersion(new Version(versionId));
+ NetworkEntity createdNetwork = networkManager.createNetwork(network);
return Response
.ok(createdNetwork != null ? new StringWrapperResponse(createdNetwork.getId()) : null)
.build();
@@ -91,8 +90,8 @@ public class NetworksImpl implements Networks {
MdcUtil.initMdc(LoggerServiceName.Get_Network.toString());
CompositionEntityResponse<Network> response =
networkManager.getNetwork(vspId,
- resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), networkId,
- user);
+ new Version(versionId), networkId
+ );
CompositionEntityResponseDto<NetworkDto> responseDto = new CompositionEntityResponseDto<>();
new MapCompositionEntityResponseToDto<>(new MapNetworkToNetworkDto(), NetworkDto.class)
@@ -104,22 +103,23 @@ public class NetworksImpl implements Networks {
public Response delete(String vspId, String versionId, String networkId, String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_Network.toString());
networkManager
- .deleteNetwork(vspId, resolveVspVersion(vspId, null, user, VersionableEntityAction.Write),
- networkId, user);
+ .deleteNetwork(vspId, new Version(versionId),
+ networkId);
return Response.ok().build();
}
@Override
- public Response update(NetworkRequestDto request, String vspId, String versionId, String networkId, String user) {
+ public Response update(NetworkRequestDto request, String vspId, String versionId,
+ String networkId, String user) {
MdcUtil.initMdc(LoggerServiceName.Update_Network.toString());
NetworkEntity networkEntity =
new MapNetworkRequestDtoToNetworkEntity().applyMapping(request, NetworkEntity.class);
networkEntity.setVspId(vspId);
- networkEntity.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
+ networkEntity.setVersion(new Version(versionId));
networkEntity.setId(networkId);
CompositionEntityValidationData validationData =
- networkManager.updateNetwork(networkEntity, user);
+ networkManager.updateNetwork(networkEntity);
return validationData != null && CollectionUtils.isNotEmpty(validationData.getErrors())
? Response.status(Response.Status.EXPECTATION_FAILED).entity(
new MapCompositionEntityValidationDataToDto()
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java
index 73ca82ada3..738609acba 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java
@@ -33,7 +33,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicCreationResponseDto;
@@ -52,9 +51,9 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import java.util.Collection;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import java.util.Collection;
@Named
@Service("nics")
@@ -67,9 +66,9 @@ public class NicsImpl implements Nics {
@Override
public Response list(String vspId, String versionId, String componentId, String user) {
MdcUtil.initMdc(LoggerServiceName.List_nics.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
- Collection<NicEntity> nics = nicManager.listNics(vspId, vspVersion, componentId, user);
+ Version vspVersion = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, vspVersion, componentId);
+ Collection<NicEntity> nics = nicManager.listNics(vspId, vspVersion, componentId);
MapNicEntityToNicDto mapper = new MapNicEntityToNicDto();
GenericCollectionWrapper<NicDto> results = new GenericCollectionWrapper<>();
@@ -81,15 +80,16 @@ public class NicsImpl implements Nics {
}
@Override
- public Response create(NicRequestDto request, String vspId, String versionId, String componentId, String user) {
+ public Response create(NicRequestDto request, String vspId, String versionId, String componentId,
+ String user) {
MdcUtil.initMdc(LoggerServiceName.Create_nic.toString());
NicEntity nic = new MapNicRequestDtoToNicEntity().applyMapping(request, NicEntity.class);
nic.setVspId(vspId);
- nic.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
+ nic.setVersion(new Version(versionId));
nic.setComponentId(componentId);
- componentManager.validateComponentExistence(vspId, nic.getVersion(), componentId, user);
+ componentManager.validateComponentExistence(vspId, nic.getVersion(), componentId);
- NicEntity createdNic = nicManager.createNic(nic, user);
+ NicEntity createdNic = nicManager.createNic(nic);
MapNicEntityToNicCreationResponseDto mapping =
new MapNicEntityToNicCreationResponseDto();
NicCreationResponseDto createdNicDto = mapping.applyMapping(createdNic,
@@ -99,12 +99,13 @@ public class NicsImpl implements Nics {
}
@Override
- public Response get(String vspId, String versionId, String componentId, String nicId, String user) {
+ public Response get(String vspId, String versionId, String componentId, String nicId,
+ String user) {
MdcUtil.initMdc(LoggerServiceName.Get_nic.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
+ Version vspVersion = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, vspVersion, componentId);
CompositionEntityResponse<Nic> response =
- nicManager.getNic(vspId, vspVersion, componentId, nicId, user);
+ nicManager.getNic(vspId, vspVersion, componentId, nicId);
CompositionEntityResponseDto<NicDto> responseDto = new CompositionEntityResponseDto<>();
new MapCompositionEntityResponseToDto<>(new MapNicToNicDto(), NicDto.class)
@@ -113,27 +114,29 @@ public class NicsImpl implements Nics {
}
@Override
- public Response delete(String vspId, String versionId, String componentId, String nicId, String user) {
+ public Response delete(String vspId, String versionId, String componentId, String nicId,
+ String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_nic.toString());
- Version vspVersion = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
- nicManager.deleteNic(vspId, vspVersion, componentId, nicId, user);
+ Version vspVersion = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, vspVersion, componentId);
+ nicManager.deleteNic(vspId, vspVersion, componentId, nicId);
return Response.ok().build();
}
@Override
- public Response update(NicRequestDto request, String vspId, String versionId, String componentId, String nicId,
+ public Response update(NicRequestDto request, String vspId, String versionId, String componentId,
+ String nicId,
String user) {
MdcUtil.initMdc(LoggerServiceName.Update_nic.toString());
NicEntity nicEntity = new MapNicRequestDtoToNicEntity().applyMapping(request, NicEntity.class);
nicEntity.setVspId(vspId);
- nicEntity.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
+ nicEntity.setVersion(new Version(versionId));
nicEntity.setComponentId(componentId);
nicEntity.setId(nicId);
- componentManager.validateComponentExistence(vspId, nicEntity.getVersion(), componentId, user);
+ componentManager.validateComponentExistence(vspId, nicEntity.getVersion(), componentId);
CompositionEntityValidationData validationData =
- nicManager.updateNic(nicEntity, user);
+ nicManager.updateNic(nicEntity);
return validationData != null && CollectionUtils.isNotEmpty(validationData.getErrors())
? Response.status(Response.Status.EXPECTATION_FAILED).entity(
new MapCompositionEntityValidationDataToDto()
@@ -145,10 +148,10 @@ public class NicsImpl implements Nics {
public Response getQuestionnaire(String vspId, String versionId, String componentId, String nicId,
String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Questionnaire_nic.toString());
- Version vspVersion = resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
+ Version vspVersion = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, vspVersion, componentId);
QuestionnaireResponse questionnaireResponse =
- nicManager.getNicQuestionnaire(vspId, vspVersion, componentId, nicId, user);
+ nicManager.getNicQuestionnaire(vspId, vspVersion, componentId, nicId);
QuestionnaireResponseDto result = new MapQuestionnaireResponseToQuestionnaireResponseDto()
.applyMapping(questionnaireResponse, QuestionnaireResponseDto.class);
@@ -156,13 +159,14 @@ public class NicsImpl implements Nics {
}
@Override
- public Response updateQuestionnaire(String questionnaireData, String vspId, String versionId, String componentId,
+ public Response updateQuestionnaire(String questionnaireData, String vspId, String versionId,
+ String componentId,
String nicId, String user) {
MdcUtil.initMdc(LoggerServiceName.Update_Questionnaire_nic.toString());
- Version vspVersion = resolveVspVersion(vspId, null, user, VersionableEntityAction.Write);
- componentManager.validateComponentExistence(vspId, vspVersion, componentId, user);
+ Version vspVersion = new Version(versionId);
+ componentManager.validateComponentExistence(vspId, vspVersion, componentId);
nicManager
- .updateNicQuestionnaire(vspId, vspVersion, componentId, nicId, questionnaireData, user);
+ .updateNicQuestionnaire(vspId, vspVersion, componentId, nicId, questionnaireData);
return Response.ok().build();
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
index 172c8940e9..aaee77df46 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
@@ -4,6 +4,10 @@ import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
+import org.openecomp.sdc.activitylog.ActivityLogManager;
+import org.openecomp.sdc.activitylog.ActivityLogManagerFactory;
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.activitylog.dao.type.ActivityType;
import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -12,27 +16,28 @@ import org.openecomp.sdc.logging.messages.AuditMessages;
import org.openecomp.sdc.logging.types.LoggerServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.types.FileDataStructureDto;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.FileDataStructureDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.OrchestrationTemplateActionResponseDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ValidationResponseDto;
import org.openecomp.sdcrests.vsp.rest.OrchestrationTemplateCandidate;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapFilesDataStructureToDto;
import org.openecomp.sdcrests.vsp.rest.mapping.MapUploadFileResponseToUploadFileResponseDto;
import org.openecomp.sdcrests.vsp.rest.mapping.MapValidationResponseToDto;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.Optional;
-import javax.inject.Named;
-import javax.ws.rs.core.Response;
import static org.openecomp.core.utilities.file.FileUtils.getFileExtension;
import static org.openecomp.core.utilities.file.FileUtils.getNetworkPackageName;
@@ -44,32 +49,31 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate
private OrchestrationTemplateCandidateManager candidateManager =
OrchestrationTemplateCandidateManagerFactory.getInstance().createInterface();
+ private ActivityLogManager activityLogManager =
+ ActivityLogManagerFactory.getInstance().createInterface();
+
private static final Logger logger =
- LoggerFactory.getLogger(OrchestrationTemplateCandidateImpl.class);
+ LoggerFactory.getLogger(OrchestrationTemplateCandidateImpl.class);
@Override
- public Response upload(String vspId, String versionId, Attachment fileToUpload,
- String user) {
+ public Response upload(String vspId, String versionId, Attachment fileToUpload, String user) {
MdcUtil.initMdc(LoggerServiceName.Upload_File.toString());
logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.UPLOAD_HEAT + vspId);
+
String filename = fileToUpload.getContentDisposition().getParameter("filename");
UploadFileResponse uploadFileResponse = candidateManager
- .upload(vspId, resolveVspVersion(vspId, null, user, VersionableEntityAction
- .Write), fileToUpload.getObject(InputStream.class), user, getFileExtension(filename),
- getNetworkPackageName(filename));
+ .upload(vspId, new Version(versionId), fileToUpload.getObject(InputStream.class),
+ getFileExtension(filename), getNetworkPackageName(filename));
+
UploadFileResponseDto uploadFileResponseDto = new MapUploadFileResponseToUploadFileResponseDto()
.applyMapping(uploadFileResponse, UploadFileResponseDto.class);
return Response.ok(uploadFileResponseDto).build();
}
-
-
@Override
public Response get(String vspId, String versionId, String user) throws IOException {
-
- Optional<Pair<String, byte[]>> zipFile = candidateManager
- .get(vspId, resolveVspVersion(vspId, null, user, VersionableEntityAction.Read), user);
+ Optional<Pair<String, byte[]>> zipFile = candidateManager.get(vspId, new Version(versionId));
if (!zipFile.isPresent()) {
return Response.status(Response.Status.NOT_FOUND).build();
@@ -84,10 +88,12 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate
public Response process(String vspId, String versionId, String user)
throws InvocationTargetException, IllegalAccessException {
- OrchestrationTemplateActionResponse response =
- candidateManager
- .process(vspId, resolveVspVersion(vspId, null, user, VersionableEntityAction.Write),
- user);
+ Version version = new Version(versionId);
+ OrchestrationTemplateActionResponse response = candidateManager.process(vspId, version);
+
+ activityLogManager.logActivity(new ActivityLogEntity(vspId, version,
+ ActivityType.Upload_Network_Package, user, true, "", ""));
+
OrchestrationTemplateActionResponseDto responseDto =
new OrchestrationTemplateActionResponseDto();
BeanUtils.copyProperties(responseDto, response);
@@ -95,8 +101,6 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate
return Response.ok(responseDto).build();
}
-
-
@Override
public Response updateFilesDataStructure(
String vspId, String versionId, FileDataStructureDto fileDataStructureDto, String user)
@@ -112,9 +116,7 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate
throw new Exception(errorWithParameters, exception);
}
ValidationResponse response = candidateManager
- .updateFilesDataStructure(vspId,
- resolveVspVersion(vspId, null, user, VersionableEntityAction
- .Write), user, fileDataStructure);
+ .updateFilesDataStructure(vspId, new Version(versionId), fileDataStructure);
if (!response.isValid()) {
return Response.status(Response.Status.EXPECTATION_FAILED).entity(
@@ -127,20 +129,13 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate
@Override
public Response getFilesDataStructure(String vspId, String versionId, String user)
throws Exception {
- Optional<FilesDataStructure> filesDataStructure = candidateManager
- .getFilesDataStructure(vspId, resolveVspVersion(vspId, null, user, VersionableEntityAction
- .Read), user);
- FileDataStructureDto fileDataStructureDto = new FileDataStructureDto();
- if (filesDataStructure.isPresent()) {
- try {
- BeanUtils.copyProperties(fileDataStructureDto, filesDataStructure.get());
- } catch (IllegalAccessException | InvocationTargetException exception) {
- String errorWithParameters = ErrorMessagesFormatBuilder
- .getErrorWithParameters(Messages.MAPPING_OBJECTS_FAILURE.getErrorMessage(),
- filesDataStructure.toString(), fileDataStructureDto.toString());
- throw new Exception(errorWithParameters, exception);
- }
- }
+ Optional<FilesDataStructure> filesDataStructure =
+ candidateManager.getFilesDataStructure(vspId, new Version(versionId));
+
+ FileDataStructureDto fileDataStructureDto =
+ filesDataStructure.map(dataStructure -> new MapFilesDataStructureToDto()
+ .applyMapping(dataStructure, FileDataStructureDto.class))
+ .orElse(new FileDataStructureDto());
return Response.ok(fileDataStructureDto).build();
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java
index 6bc7a37eee..ab67b68cd8 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java
@@ -20,8 +20,6 @@
package org.openecomp.sdcrests.vsp.rest.services;
-import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID;
-
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -43,67 +41,65 @@ import javax.ws.rs.core.Response;
@Scope(value = "prototype")
public class ProcessesImpl implements Processes {
+ private static final Logger logger = LoggerFactory.getLogger(ProcessesImpl.class);
@Autowired
private ComponentProcesses componentProcesses;
- private static final Logger logger =
- LoggerFactory.getLogger(ProcessesImpl.class);
@Override
public Response list(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.List_Processes.toString());
- return componentProcesses.list(vspId, versionId, GENERAL_COMPONENT_ID, user);
+ return componentProcesses.list(vspId, versionId, null, user);
}
@Override
public Response deleteList(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_List_Processes.toString());
- return componentProcesses.deleteList(vspId,versionId, GENERAL_COMPONENT_ID, user);
+ return componentProcesses.deleteList(vspId, versionId, null, user);
}
@Override
public Response create(ProcessRequestDto request, String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Create_Process.toString());
- return componentProcesses.create(request, vspId, versionId, GENERAL_COMPONENT_ID, user);
+ return componentProcesses.create(request, vspId, versionId, null, user);
}
@Override
public Response get(String vspId, String versionId, String processId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Processes.toString());
- return componentProcesses.get(vspId, versionId, GENERAL_COMPONENT_ID, processId, user);
+ return componentProcesses.get(vspId, versionId, null, processId, user);
}
@Override
public Response delete(String vspId, String versionId, String processId, String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_Processes.toString());
- return componentProcesses.delete(vspId, versionId, GENERAL_COMPONENT_ID, processId, user);
+ return componentProcesses.delete(vspId, versionId, null, processId, user);
}
@Override
- public Response update(ProcessRequestDto request, String vspId, String versionId, String processId, String user) {
+ public Response update(ProcessRequestDto request, String vspId, String versionId,
+ String processId, String user) {
MdcUtil.initMdc(LoggerServiceName.Update_Process.toString());
- return componentProcesses.update(request, vspId, versionId, GENERAL_COMPONENT_ID, processId, user);
+ return componentProcesses.update(request, vspId, versionId, null, processId, user);
}
@Override
public Response getUploadedFile(String vspId, String versionId, String processId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Uploaded_File_Processes.toString());
- return componentProcesses
- .getUploadedFile(vspId, versionId, GENERAL_COMPONENT_ID, processId, user);
+ return componentProcesses.getUploadedFile(vspId, versionId, null, processId, user);
}
@Override
- public Response deleteUploadedFile(String vspId, String versionId, String processId, String user) {
+ public Response deleteUploadedFile(String vspId, String versionId, String processId,
+ String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_Uploaded_File_Processes.toString());
- return componentProcesses.deleteUploadedFile(vspId, versionId, GENERAL_COMPONENT_ID,
- processId, user);
+ return componentProcesses.deleteUploadedFile(vspId, versionId, null, processId, user);
}
@Override
- public Response uploadFile(Attachment attachment, String vspId, String versionId, String processId, String user) {
+ public Response uploadFile(Attachment attachment, String vspId, String versionId,
+ String processId, String user) {
MdcUtil.initMdc(LoggerServiceName.Upload_File_Processes.toString());
logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.UPLOAD_PROCESS_ARTIFACT + vspId);
- return componentProcesses.uploadFile(attachment, vspId, versionId, GENERAL_COMPONENT_ID,
- processId,
- user);
+ return componentProcesses.uploadFile(attachment, vspId, versionId, null, processId, user);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
index c38bf8a0ec..feffb91703 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -20,10 +20,23 @@
package org.openecomp.sdcrests.vsp.rest.services;
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.util.UniqueValueUtil;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.activitylog.ActivityLogManager;
+import org.openecomp.sdc.activitylog.ActivityLogManagerFactory;
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.activitylog.dao.type.ActivityType;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.datatypes.model.ItemType;
+import org.openecomp.sdc.healing.factory.HealingManagerFactory;
+import org.openecomp.sdc.itempermissions.ItemPermissionsManager;
+import org.openecomp.sdc.itempermissions.ItemPermissionsManagerFactory;
+import org.openecomp.sdc.itempermissions.impl.types.PermissionTypes;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.MdcUtil;
@@ -33,25 +46,53 @@ import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorCode;
import org.openecomp.sdc.logging.types.LoggerServiceName;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.notification.dtos.Event;
+import org.openecomp.sdc.notification.factories.NotificationPropagationManagerFactory;
+import org.openecomp.sdc.notification.services.NotificationPropagationManager;
+import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OnboardingMethod;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.CreatePackageForNonFinalVendorSoftwareProductErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.OnboardingMethodErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageNotFoundErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
-import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
+import org.openecomp.sdc.versioning.ItemManager;
+import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.VersioningManager;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.*;
+import org.openecomp.sdc.versioning.errors.RequestedVersionInvalidErrorBuilder;
+import org.openecomp.sdc.versioning.types.Item;
+import org.openecomp.sdc.versioning.types.NotificationEventTypes;
+import org.openecomp.sdcrests.item.rest.mapping.MapVersionToDto;
+import org.openecomp.sdcrests.item.types.ItemCreationDto;
+import org.openecomp.sdcrests.item.types.VersionDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ValidationResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspRequestDto;
import org.openecomp.sdcrests.vsp.rest.VendorSoftwareProducts;
-import org.openecomp.sdcrests.vsp.rest.mapping.*;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComputeEntityToVspComputeDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapItemToVspDetailsDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapPackageInfoToPackageInfoDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireResponseToQuestionnaireResponseDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapValidationResponseToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapVspDescriptionDtoToItem;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapVspDescriptionDtoToVspDetails;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapVspDetailsToDto;
import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
-import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
-import org.slf4j.MDC;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
@@ -60,78 +101,127 @@ import javax.ws.rs.core.Response;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Predicate;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER;
import static org.openecomp.sdc.logging.messages.AuditMessages.SUBMIT_VSP_ERROR;
+import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME;
+import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.VALIDATION_VSP_NAME;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_NAME;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.SUBMIT_DESCRIPTION;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_NAME;
@Named
@Service("vendorSoftwareProducts")
@Scope(value = "prototype")
public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
+ private static final String SUBMIT_ITEM = "Submit_Item";
- private final VendorSoftwareProductManager vendorSoftwareProductManager =
- VspManagerFactory.getInstance().createInterface();
+ private static final Logger LOGGER = LoggerFactory.getLogger(VendorSoftwareProductsImpl.class);
+
+ private static ItemCreationDto validationVsp;
- private static final Logger logger =
- LoggerFactory.getLogger(VendorSoftwareProductsImpl.class);
+ private ItemManager itemManager = ItemManagerFactory.getInstance().createInterface();
+ private ItemPermissionsManager permissionsManager =
+ ItemPermissionsManagerFactory.getInstance().createInterface();
+ private VersioningManager versioningManager =
+ VersioningManagerFactory.getInstance().createInterface();
+ private VendorSoftwareProductManager vendorSoftwareProductManager =
+ VspManagerFactory.getInstance().createInterface();
+ private ActivityLogManager activityLogManager =
+ ActivityLogManagerFactory.getInstance().createInterface();
+ private NotificationPropagationManager notifier =
+ NotificationPropagationManagerFactory.getInstance().createInterface();
@Override
- public Response createVsp(VspDescriptionDto vspDescriptionDto, String user) {
+ public Response createVsp(VspRequestDto vspRequestDto, String user) {
MdcUtil.initMdc(LoggerServiceName.Create_VSP.toString());
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_VSP
- + vspDescriptionDto.getName());
+ LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_VSP + vspRequestDto.getName());
- OnboardingMethod onboardingMethod;
+ ItemCreationDto itemCreationDto;
+ OnboardingMethod onboardingMethod;
try {
- onboardingMethod = OnboardingMethod.valueOf(vspDescriptionDto.getOnboardingMethod());
+ onboardingMethod = OnboardingMethod.valueOf(vspRequestDto.getOnboardingMethod());
} catch (IllegalArgumentException e) {
- return handleUnknownOnboardingMethod();
+ throw getUnknownOnboardingMethod();
}
-
switch (onboardingMethod) {
case NetworkPackage:
case Manual:
- VspDetails vspDetails = new MapVspDescriptionDtoToVspDetails().
- applyMapping(vspDescriptionDto, VspDetails.class);
+ Item item = new MapVspDescriptionDtoToItem().applyMapping(vspRequestDto, Item.class);
+ item.setType(ItemType.vsp.name());
+ item.addProperty(VspItemProperty.ONBOARDING_METHOD, onboardingMethod.name());
+
+ UniqueValueUtil.validateUniqueValue(VENDOR_SOFTWARE_PRODUCT_NAME, item.getName());
+ item = itemManager.create(item);
+ UniqueValueUtil.createUniqueValue(VENDOR_SOFTWARE_PRODUCT_NAME, item.getName());
+
+ Version version = versioningManager.create(item.getId(), new Version(), null);
+
+ VspDetails vspDetails =
+ new MapVspDescriptionDtoToVspDetails().applyMapping(vspRequestDto, VspDetails.class);
+ vspDetails.setId(item.getId());
+ vspDetails.setVersion(version);
+ vspDetails.setOnboardingMethod(vspRequestDto.getOnboardingMethod());
- vspDetails = vendorSoftwareProductManager.createVsp(vspDetails, user);
+ vendorSoftwareProductManager.createVsp(vspDetails);
+ versioningManager.publish(item.getId(), version, "Initial vsp:" + vspDetails.getName());
- MapVspDetailsToVspCreationDto mapping = new MapVspDetailsToVspCreationDto();
- VspCreationDto vspCreationDto = mapping.applyMapping(vspDetails, VspCreationDto.class);
- return Response.ok(vspCreationDto).build();
+ itemCreationDto = new ItemCreationDto();
+ itemCreationDto.setItemId(item.getId());
+ itemCreationDto.setVersion(new MapVersionToDto().applyMapping(version, VersionDto.class));
+
+ activityLogManager.logActivity(new ActivityLogEntity(vspDetails.getId(), version,
+ ActivityType.Create, user, true, "", ""));
+ break;
default:
- return handleUnknownOnboardingMethod();
+ throw getUnknownOnboardingMethod();
}
+
+ return Response.ok(itemCreationDto).build();
}
- private Response handleUnknownOnboardingMethod() {
+ private CoreException getUnknownOnboardingMethod() {
ErrorCode onboardingMethodUpdateErrorCode = OnboardingMethodErrorBuilder
.getInvalidOnboardingMethodErrorBuilder();
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
LoggerTragetServiceName.ADD_VSP, ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), onboardingMethodUpdateErrorCode.message());
- throw new CoreException(onboardingMethodUpdateErrorCode);
+ return new CoreException(onboardingMethodUpdateErrorCode);
}
@Override
- public Response listVsps(String versionFilter, String user) {
+ public Response listVsps(String versionStatus, String user) {
MdcUtil.initMdc(LoggerServiceName.List_VSP.toString());
- List<VersionedVendorSoftwareProductInfo> vspList =
- vendorSoftwareProductManager.listVsps(versionFilter, user);
- GenericCollectionWrapper<VspDetailsDto> results = new GenericCollectionWrapper<>();
- if (!vspList.isEmpty()) {
- MapVersionedVendorSoftwareProductInfoToVspDetailsDto mapper =
- new MapVersionedVendorSoftwareProductInfoToVspDetailsDto();
- for (VersionedVendorSoftwareProductInfo versionedVsp : vspList) {
- results.add(mapper.applyMapping(versionedVsp, VspDetailsDto.class));
- }
+ Predicate<Item> itemPredicate;
+ if (VersionStatus.Certified.name().equals(versionStatus)) {
+ itemPredicate = item -> ItemType.vsp.name().equals(item.getType()) &&
+ item.getVersionStatusCounters().containsKey(VersionStatus.Certified);
+
+ } else if (VersionStatus.Draft.name().equals(versionStatus)) {
+ itemPredicate = item -> ItemType.vsp.name().equals(item.getType()) &&
+ item.getVersionStatusCounters().containsKey(VersionStatus.Draft) &&
+ userHasPermission(item.getId(), user);
+
+ } else {
+ itemPredicate = item -> ItemType.vsp.name().equals(item.getType());
}
+ GenericCollectionWrapper<VspDetailsDto> results = new GenericCollectionWrapper<>();
+ MapItemToVspDetailsDto mapper = new MapItemToVspDetailsDto();
+ itemManager.list(itemPredicate).stream()
+ .sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime()))
+ .forEach(vspItem -> results.add(mapper.applyMapping(vspItem, VspDetailsDto.class)));
+
return Response.ok(results).build();
}
@@ -139,40 +229,48 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
public Response getVsp(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_VSP.toString());
+ Version version = versioningManager.get(vspId, new Version(versionId));
+ VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version);
+ vspDetails.setWritetimeMicroSeconds(version.getModificationTime().getTime());
- VspDetails vspDetails =
- vendorSoftwareProductManager
- .getVsp(vspId, resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read),
- user);
-
- VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user);
-
+ try {
+ Optional<Version> healedVersion = HealingManagerFactory.getInstance().createInterface()
+ .healItemVersion(vspId, version, ItemType.vsp, false);
+ healedVersion.ifPresent(vspDetails::setVersion);
- if (vspDetails.getOldVersion() != null && !"".equals(vspDetails.getOldVersion())) {
- if (Version.valueOf(versionId).equals(versionInfo.getActiveVersion())) {
+ if (healedVersion.isPresent() && version.getStatus() == VersionStatus.Certified) {
try {
- Version healedVersion = vendorSoftwareProductManager.callAutoHeal(vspId, versionInfo,
- vspDetails, user);
- vspDetails =
- vendorSoftwareProductManager
- .getVsp(vspId, resolveVspVersion(vspId, healedVersion.toString(), user,
- VersionableEntityAction.Read), user);
- versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user);
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
+ submitHealedVsp(vspId, healedVersion.get(), user);
+ } catch (Exception ex) {
+ LOGGER.error("VSP Id {}: Error while submitting version {} " +
+ "created based on Certified version {} for healing purpose.",
+ vspId, healedVersion.get().getId(), versionId, ex.getMessage());
}
}
+ } catch (Exception e) {
+ LOGGER.error(String.format("Error while auto healing VSP with Id %s and version %s: %s",
+ vspId, versionId, e.getMessage()));
}
- VspDetailsDto vspDetailsDto = vspDetails == null
- ? null
- : new MapVersionedVendorSoftwareProductInfoToVspDetailsDto()
- .applyMapping(new VersionedVendorSoftwareProductInfo(vspDetails, versionInfo),
- VspDetailsDto.class);
+ VspDetailsDto vspDetailsDto =
+ new MapVspDetailsToDto().applyMapping(vspDetails, VspDetailsDto.class);
+ addNetworkPackageInfo(vspId, version, vspDetailsDto);
return Response.ok(vspDetailsDto).build();
}
+ private void submitHealedVsp(String vspId, Version healedVersion, String user)
+ throws IOException {
+ Optional<ValidationResponse>
+ validationResponse = submit(vspId, healedVersion, "Submit healed Vsp", user);
+ if (validationResponse.isPresent()) {
+ // TODO: 8/9/2017 before collaboration checkout was done at this scenario (equivalent
+ // to new version in collaboration). need to decide what should be done now.
+ throw new IllegalStateException("Certified vsp after healing failed on validation");
+ }
+ vendorSoftwareProductManager.createPackage(vspId, healedVersion);
+ }
+
@Override
public Response updateVsp(String vspId, String versionId, VspDescriptionDto vspDescriptionDto,
String user) {
@@ -180,9 +278,9 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
VspDetails vspDetails =
new MapVspDescriptionDtoToVspDetails().applyMapping(vspDescriptionDto, VspDetails.class);
vspDetails.setId(vspId);
- vspDetails.setVersion(resolveVspVersion(vspId, null, user, VersionableEntityAction.Write));
+ vspDetails.setVersion(new Version(versionId));
- vendorSoftwareProductManager.updateVsp(vspDetails, user);
+ vendorSoftwareProductManager.updateVsp(vspDetails);
return Response.ok().build();
}
@@ -190,60 +288,38 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
@Override
public Response deleteVsp(String vspId, String user) {
MdcUtil.initMdc(LoggerServiceName.Delete_VSP.toString());
- vendorSoftwareProductManager.deleteVsp(vspId, user);
+ vendorSoftwareProductManager.deleteVsp(vspId);
return Response.ok().build();
}
@Override
- public Response actOnVendorSoftwareProduct(String vspId, String versionId,
- VersionSoftwareProductActionRequestDto request,
+ public Response actOnVendorSoftwareProduct(VersionSoftwareProductActionRequestDto request,
+ String vspId, String versionId,
String user) throws IOException {
+ Version version = new Version(versionId);
switch (request.getAction()) {
- case Checkout:
- MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Checkout_VSP.toString());
- vendorSoftwareProductManager.checkout(vspId, user);
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_OUT_VSP + vspId);
- break;
- case Undo_Checkout:
- MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Undo_Checkout_VSP.toString());
- vendorSoftwareProductManager.undoCheckout(vspId, user);
- break;
- case Checkin:
- MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Checkin_VSP.toString());
- vendorSoftwareProductManager.checkin(vspId, user);
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_IN_VSP + vspId);
- break;
case Submit:
- MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Submit_VSP.toString());
- ValidationResponse validationResponse = vendorSoftwareProductManager.submit(vspId, user);
- if (!validationResponse.isValid()) {
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP_FAIL + vspId);
- if (validationResponse.getVspErrors() != null) {
- validationResponse.getVspErrors().forEach(errorCode -> logger.audit(AuditMessages
- .AUDIT_MSG + String.format(SUBMIT_VSP_ERROR, errorCode.message(), vspId)));
- }
- if (validationResponse.getUploadDataErrors() != null) {
- validationResponse.getUploadDataErrors().values().forEach(errorMessages
- -> printAuditForErrors(errorMessages, vspId, SUBMIT_VSP_ERROR));
- }
-
- return Response.status(Response.Status.EXPECTATION_FAILED).entity(
- new MapValidationResponseToDto()
- .applyMapping(validationResponse, ValidationResponseDto.class)).build();
+ if (!permissionsManager.isAllowed(vspId, user, SUBMIT_ITEM)) {
+ return Response.status(Response.Status.FORBIDDEN)
+ .entity(new Exception(Messages.PERMISSIONS_ERROR.getErrorMessage())).build();
}
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP + vspId);
+ String message =
+ request.getSubmitRequest() == null ? "" : request.getSubmitRequest().getMessage();
+ Optional<ValidationResponse> validationResponse = submit(vspId, version, message, user);
+
+ if (validationResponse.isPresent()) {
+ ValidationResponseDto validationResponseDto = new MapValidationResponseToDto()
+ .applyMapping(validationResponse.get(), ValidationResponseDto.class);
+ return Response.status(Response.Status.EXPECTATION_FAILED).entity(validationResponseDto)
+ .build();
+ }
+
+ notifyUsers(vspId, version, message, user, NotificationEventTypes.SUBMIT);
break;
case Create_Package:
- MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Create_Package.toString());
-
- PackageInfo packageInfo = vendorSoftwareProductManager.createPackage(vspId,
- resolveVspVersion(vspId, null, user, VersionableEntityAction.Read), user);
- return Response.ok(packageInfo == null
- ? null
- : new MapPackageInfoToPackageInfoDto().applyMapping(packageInfo, PackageInfoDto.class))
- .build();
+ return createPackage(vspId, version);
default:
}
@@ -251,21 +327,41 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
}
@Override
- public Response getValidationVsp(String user)
- throws Exception {
- String validationVspId = vendorSoftwareProductManager.fetchValidationVsp(user);
- StringWrapperResponse response = new StringWrapperResponse(validationVspId);
- return Response.ok(response).build();
- }
+ public Response getValidationVsp(String user) throws Exception {
+ if (validationVsp != null) {
+ return Response.ok(validationVsp).build();
+ }
+ VspRequestDto validationVspRequest = new VspRequestDto();
+ validationVspRequest.setOnboardingMethod("HEAT");
+ validationVspRequest.setName(VALIDATION_VSP_NAME);
+
+ try {
+ validationVsp = (ItemCreationDto) createVsp(validationVspRequest, user).getEntity();
+ return Response.ok(validationVsp).build();
+
+ } catch (CoreException validationVspAlreadyExistException) {
+ // find validationVsp
+ String validationVspId = itemManager.list(item ->
+ ItemType.vsp.name().equals(item.getType()) && VALIDATION_VSP_NAME.equals(item.getName()))
+ .stream().findFirst().orElseThrow(() -> new IllegalStateException("Vsp with name %s " +
+ "does not exist even though the name exists according to unique value util")).getId();
+ Version validationVspVersion = versioningManager.list(validationVspId).iterator().next();
+
+ validationVsp = new ItemCreationDto();
+ validationVsp.setItemId(validationVspId);
+ validationVsp
+ .setVersion(new MapVersionToDto().applyMapping(validationVspVersion, VersionDto.class));
+
+ return Response.ok(validationVsp).build();
+ }
+ }
@Override
public Response getOrchestrationTemplate(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Uploaded_File.toString());
byte[] orchestrationTemplateFile =
- vendorSoftwareProductManager
- .getOrchestrationTemplateFile(vspId,
- resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
+ vendorSoftwareProductManager.getOrchestrationTemplateFile(vspId, new Version(versionId));
if (orchestrationTemplateFile == null) {
return Response.status(Response.Status.NOT_FOUND).build();
@@ -293,24 +389,47 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
}
@Override
- public Response getTranslatedFile(String vspId, String versionId, String user) {
+ public Response getTranslatedFile(String vspId, String versionName, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Translated_File.toString());
- Version version = Version.valueOf(versionId);
- Version resolvedVersion = version == null
- ? getVersionInfo(vspId, VersionableEntityAction.Read, user).getLatestFinalVersion()
- : version;
+ List<Version> versions = versioningManager.list(vspId);
+ Version version;
+ if (versionName == null) {
+ version = versions.stream().filter(ver -> VersionStatus.Certified == ver.getStatus())
+ .max((o1, o2) -> ((Double) Double.parseDouble(o1.getName()))
+ .compareTo(Double.parseDouble(o2.getName()))).orElseThrow(() -> {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Package not found");
+ return new CoreException(new PackageNotFoundErrorBuilder(vspId).build());
+ });
+ } else {
+ version = versions.stream().filter(ver -> versionName.equals(ver.getName()))
+ .findFirst().orElseThrow(() -> {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Package not found");
+ return new CoreException(new PackageNotFoundErrorBuilder(vspId).build());
+ });
+
+ if (version.getStatus() != VersionStatus.Certified) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.GET_VERSION_INFO, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid requested version");
+ throw new CoreException(new RequestedVersionInvalidErrorBuilder().build());
+ }
+ }
- File zipFile = vendorSoftwareProductManager.getTranslatedFile(vspId, resolvedVersion, user);
+ File zipFile = vendorSoftwareProductManager.getTranslatedFile(vspId, version);
Response.ResponseBuilder response = Response.ok(zipFile);
if (zipFile == null) {
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.IMPORT_FAIL + vspId);
+ LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.IMPORT_FAIL + vspId);
return Response.status(Response.Status.NOT_FOUND).build();
}
response.header("Content-Disposition", "attachment; filename=" + zipFile.getName());
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.IMPORT_SUCCESS + vspId);
+ LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.IMPORT_SUCCESS + vspId);
return response.build();
}
@@ -318,8 +437,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
public Response getQuestionnaire(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Questionnaire_VSP.toString());
QuestionnaireResponse questionnaireResponse =
- vendorSoftwareProductManager.getVspQuestionnaire(vspId,
- resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
+ vendorSoftwareProductManager.getVspQuestionnaire(vspId, new Version(versionId));
if (questionnaireResponse.getErrorMessage() != null) {
return Response.status(Response.Status.EXPECTATION_FAILED).entity(
@@ -336,16 +454,15 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
public Response updateQuestionnaire(String questionnaireData, String vspId, String
versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Update_Questionnaire_VSP.toString());
- vendorSoftwareProductManager.updateVspQuestionnaire(vspId,
- resolveVspVersion(vspId, null, user, VersionableEntityAction.Write),
- questionnaireData, user);
+ vendorSoftwareProductManager
+ .updateVspQuestionnaire(vspId, new Version(versionId), questionnaireData);
return Response.ok().build();
}
@Override
public Response heal(String vspId, String versionId, String user) {
- vendorSoftwareProductManager.heal(vspId, Version.valueOf(versionId), user);
-
+ HealingManagerFactory.getInstance().createInterface()
+ .healItemVersion(vspId, new Version(versionId), ItemType.vsp, true);
return Response.ok().build();
}
@@ -353,8 +470,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
public Response getVspInformationArtifact(String vspId, String versionId, String user) {
MdcUtil.initMdc(LoggerServiceName.Get_Information_Artifact.toString());
File textInformationArtifact =
- vendorSoftwareProductManager.getInformationArtifact(vspId,
- resolveVspVersion(vspId, versionId, user, VersionableEntityAction.Read), user);
+ vendorSoftwareProductManager.getInformationArtifact(vspId, new Version(versionId));
Response.ResponseBuilder response = Response.ok(textInformationArtifact);
if (textInformationArtifact == null) {
@@ -365,10 +481,11 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
return response.build();
}
- public Response listCompute(String vspId, String version, String user) {
+ @Override
+ public Response listComputes(String vspId, String version, String user) {
- Collection<ComputeEntity> computes = vendorSoftwareProductManager.getComputeByVsp(vspId,
- resolveVspVersion(vspId, version, user, VersionableEntityAction.Read), user);
+ Collection<ComputeEntity> computes =
+ vendorSoftwareProductManager.getComputeByVsp(vspId, new Version(version));
MapComputeEntityToVspComputeDto mapper = new MapComputeEntityToVspComputeDto();
GenericCollectionWrapper<VspComputeDto> results = new GenericCollectionWrapper<>();
@@ -379,91 +496,152 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
return Response.ok(results).build();
}
- @Override
- public Response reSubmitAll(String user) throws IOException {
-
- MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Re_Submit_ALL_Final_VSPs.toString());
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.RESUBMIT_ALL_FINAL_VSPS);
-
- List<VersionedVendorSoftwareProductInfo> latestFinalVsps = Objects
- .requireNonNull(vendorSoftwareProductManager.listVsps(VersionStatus.Final.name(), user));
-
- List<VersionedVendorSoftwareProductInfo> nonLockedLatestFinalVsps = latestFinalVsps.stream()
- .filter(vsp ->
- !isVspLocked(vsp.getVspDetails().getId(), vsp.getVspDetails().getName(), user))
- .collect(Collectors.toList());
-
- logger.info("Removed {} VSPs out of {} from processing due to status LOCKED.\n" +
- "Total number of VSPs: {}. Performing healing and resubmit for all non-Manual VSPs " +
- "in submitted status.\n No need to pre-set oldVersion field",
- latestFinalVsps.size() - nonLockedLatestFinalVsps.size(), latestFinalVsps.size(),
- nonLockedLatestFinalVsps.size());
-
- int healingCounter = 0;
- int failedCounter = 0;
- for (int counter = 0; counter < nonLockedLatestFinalVsps.size(); counter++) {
- VersionedVendorSoftwareProductInfo versionVspInfo = nonLockedLatestFinalVsps.get(counter);
- try {
- final VspDetails vspDetails = versionVspInfo.getVspDetails();
- if (!OnboardingMethod.Manual.name().equals(vspDetails.getOnboardingMethod())) {
- logger.info("Starting on healing and resubmit for VSP [{}], #{} out of total {}",
- vspDetails.getName(), counter + 1, nonLockedLatestFinalVsps.size());
- reSubmit(vspDetails, user);
- healingCounter++;
- }
- } catch (Exception e) {
- failedCounter++;
+ private Optional<ValidationResponse> submit(String vspId, Version version, String message,
+ String user) throws IOException {
+ MdcUtil.initMdc(LoggerServiceName.Submit_VSP.toString());
+ LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP + vspId);
+
+ ValidationResponse validationResponse = vendorSoftwareProductManager.validate(vspId, version);
+ Map<String, List<ErrorMessage>> compilationErrors =
+ vendorSoftwareProductManager.compile(vspId, version);
+ if (!validationResponse.isValid() || MapUtils.isNotEmpty(compilationErrors)) {
+ LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP_FAIL + vspId);
+ if (validationResponse.getVspErrors() != null) {
+ validationResponse.getVspErrors().forEach(errorCode -> LOGGER.audit(AuditMessages
+ .AUDIT_MSG + String.format(SUBMIT_VSP_ERROR, errorCode.message(), vspId)));
+ }
+ if (validationResponse.getUploadDataErrors() != null) {
+ validationResponse.getUploadDataErrors().values().forEach(errorMessages
+ -> printAuditForErrors(errorMessages, vspId, SUBMIT_VSP_ERROR));
}
+ activityLogManager.logActivity(
+ new ActivityLogEntity(vspId, version, ActivityType.Submit, user, false,
+ "Failed on validation before submit", ""));
+ return Optional.of(validationResponse);
}
- logger.info("Total VSPs processed {}. Completed running healing and resubmit for {} VSPs out" +
- " of total # of {} submitted VSPs. Failures count during resubmitAll: {}",
- nonLockedLatestFinalVsps.size(), healingCounter, latestFinalVsps.size(), failedCounter);
+ versioningManager.submit(vspId, version, message);
- return Response.ok().build();
+ LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP + vspId);
+ activityLogManager.logActivity(
+ new ActivityLogEntity(vspId, version, ActivityType.Submit, user, true, "", message));
+ return Optional.empty();
}
- private boolean isVspLocked(String vspId, String vspName, String user) {
- final VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user);
+ private void notifyUsers(String itemId, Version version, String message,
+ String userName, NotificationEventTypes eventType) {
+ Map<String, Object> eventProperties = new HashMap<>();
+ eventProperties.put(ITEM_NAME, itemManager.get(itemId).getName());
+ eventProperties.put(ITEM_ID, itemId);
+
+ Version ver = versioningManager.get(itemId, version);
+ eventProperties.put(VERSION_NAME, ver.getName());
+ eventProperties.put(VERSION_ID, ver.getId());
+
+ eventProperties.put(SUBMIT_DESCRIPTION, message);
+ eventProperties.put(PERMISSION_USER, userName);
- if (versionInfo.getStatus().equals(VersionStatus.Locked)) {
- logger.info("VSP name [{}]/id [{}] status is LOCKED", vspName, vspId);
- return true;
+ Event syncEvent = new SyncEvent(eventType.getEventName(), itemId, eventProperties, itemId);
+ try {
+ notifier.notifySubscribers(syncEvent, userName);
+ } catch (Exception e) {
+ LOGGER.error("Failed to send sync notification to users subscribed o item '" + itemId);
}
- logger.info("VSP Name {}, VSP id [{}], Active Version {} , Status {}, Latest Final Version {}",
- vspName, vspId, versionInfo.getActiveVersion().toString(), versionInfo.getStatus(),
- versionInfo.getLatestFinalVersion().toString());
- return false;
}
+ private class SyncEvent implements Event {
- private void reSubmit(VspDetails vspDetails, String user) throws Exception {
- final Version versionBefore = vspDetails.getVersion();
- vspDetails.setOldVersion("true");
+ private String eventType;
+ private String originatorId;
+ private Map<String, Object> attributes;
+ private String entityId;
- Version finalVersion;
- try {
- finalVersion =
- vendorSoftwareProductManager
- .healAndAdvanceFinalVersion(vspDetails.getId(), vspDetails, user);
- } catch (Exception e) {
- logger.error("Failed during resubmit, VSP [{}] , version before:{}, version after:{}, " +
- "status after:{}, with exception:{}",
- vspDetails.getName(), versionBefore.toString(), vspDetails.getVersion().toString(),
- vspDetails
- .getVersion().getStatus().name(), e.getMessage());
- throw e;
+ public SyncEvent(String eventType, String originatorId,
+ Map<String, Object> attributes, String entityId) {
+ this.eventType = eventType;
+ this.originatorId = originatorId;
+ this.attributes = attributes;
+ this.entityId = entityId;
+ }
+
+ @Override
+ public String getEventType() {
+ return eventType;
}
- logger.info("Completed healing and resubmit for VSP [{}], version before:{}, version after:" +
- " {}", vspDetails.getName(), versionBefore.toString(), finalVersion);
+ @Override
+ public String getOriginatorId() {
+ return originatorId;
+ }
+
+ @Override
+ public Map<String, Object> getAttributes() {
+ return attributes;
+ }
+
+ @Override
+ public String getEntityId() {
+ return entityId;
+ }
+ }
+
+ private Response createPackage(String vspId, Version version) throws IOException {
+ MdcUtil.initMdc(LoggerServiceName.Create_Package.toString());
+
+ Version retrievedVersion = versioningManager.get(vspId, version);
+ if (retrievedVersion.getStatus() != VersionStatus.Certified) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CREATE_PACKAGE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create package");
+ throw new CoreException(
+ new CreatePackageForNonFinalVendorSoftwareProductErrorBuilder(vspId, version)
+ .build());
+ }
+ PackageInfo packageInfo =
+ vendorSoftwareProductManager.createPackage(vspId, retrievedVersion);
+ return Response.ok(packageInfo == null
+ ? null
+ : new MapPackageInfoToPackageInfoDto().applyMapping(packageInfo, PackageInfoDto.class))
+ .build();
+ }
+
+ private void addNetworkPackageInfo(String vspId, Version version, VspDetailsDto vspDetailsDto) {
+ OrchestrationTemplateEntity orchestrationTemplateInfo =
+ vendorSoftwareProductManager.getOrchestrationTemplateInfo(vspId, version);
+
+ vspDetailsDto.setValidationData(orchestrationTemplateInfo.getValidationDataStructure());
+ vspDetailsDto.setNetworkPackageName(orchestrationTemplateInfo.getFileName());
+ vspDetailsDto.setOnboardingOrigin(orchestrationTemplateInfo.getFileSuffix() == null
+ ? OnboardingTypesEnum.NONE.toString()
+ : orchestrationTemplateInfo.getFileSuffix());
+
+ OrchestrationTemplateCandidateData candidateInfo =
+ OrchestrationTemplateCandidateManagerFactory.getInstance().createInterface()
+ .getInfo(vspId, version);
+
+ //todo - remove after fix missing candidate element
+ if(candidateInfo == null){
+ candidateInfo = new OrchestrationTemplateCandidateData();
+ candidateInfo.setFileSuffix("zip");
+ }
+
+ vspDetailsDto
+ .setCandidateOnboardingOrigin( candidateInfo.getFileSuffix()
+ == null
+ ? OnboardingTypesEnum.NONE.toString()
+ : candidateInfo.getFileSuffix());
+ }
+
+ private boolean userHasPermission(String itemId, String userId) {
+ String permission = permissionsManager.getUserItemPermiission(itemId, userId);
+ return (permission != null && permission
+ .matches(PermissionTypes.Contributor.name() + "|" + PermissionTypes.Owner.name()));
}
- private static void printAuditForErrors(List<ErrorMessage> errorList, String vspId,
- String auditType) {
+ private void printAuditForErrors(List<ErrorMessage> errorList, String vspId, String auditType) {
errorList.forEach(errorMessage -> {
if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) {
- logger.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(),
+ LOGGER.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(),
vspId));
}
});
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VspItemProperty.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VspItemProperty.java
new file mode 100644
index 0000000000..a40f6b167e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VspItemProperty.java
@@ -0,0 +1,7 @@
+package org.openecomp.sdcrests.vsp.rest.services;
+
+public final class VspItemProperty {
+ public static final String VENDOR_ID = "vendorId";
+ public static final String VENDOR_NAME = "vendorName";
+ public static final String ONBOARDING_METHOD = "onboardingMethod";
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml
index 9e3f3f3b46..fca77a8f28 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml
@@ -22,6 +22,11 @@
</dependency>
<dependency>
<groupId>org.openecomp.sdc</groupId>
+ <artifactId>item-rest-services</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-vendor-software-product-manager</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyCreationDto.java
new file mode 100644
index 0000000000..d9f8354887
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyCreationDto.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdcrests.vendorsoftwareproducts.types;
+
+public class ComponentDependencyCreationDto {
+ private String id;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyResponseDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyResponseDto.java
new file mode 100644
index 0000000000..91f89a1eb0
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyResponseDto.java
@@ -0,0 +1,41 @@
+package org.openecomp.sdcrests.vendorsoftwareproducts.types;
+
+public class ComponentDependencyResponseDto {
+
+ private String sourceId;
+ private String targetId;
+ private String relationType;
+ private String id;
+
+ public String getSourceId() {
+ return sourceId;
+ }
+
+ public void setSourceId(String sourceId) {
+ this.sourceId = sourceId;
+ }
+
+ public String getTargetId() {
+ return targetId;
+ }
+
+ public void setTargetId(String targetId) {
+ this.targetId = targetId;
+ }
+
+ public String getRelationType() {
+ return relationType;
+ }
+
+ public void setRelationType(String relationType) {
+ this.relationType = relationType;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java
index 3bc0b95626..a24d01a5a3 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java
@@ -4,8 +4,8 @@ package org.openecomp.sdcrests.vendorsoftwareproducts.types;
import org.hibernate.validator.constraints.NotBlank;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
-import java.util.List;
import javax.validation.constraints.Size;
+import java.util.List;
public class DeploymentFlavorRequestDto {
@NotBlank(message = "is mandatory and should not be empty")
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/FileDataStructureDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/FileDataStructureDto.java
new file mode 100644
index 0000000000..5d1191c52f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/FileDataStructureDto.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.sdcrests.vendorsoftwareproducts.types;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.Module;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Avrahamg
+ * @since November 07, 2016
+ */
+public class FileDataStructureDto {
+ private List<Module> modules = new ArrayList<>();
+ private List<String> unassigned = new ArrayList<>();
+ private List<String> artifacts = new ArrayList<>();
+ private List<String> nested = new ArrayList<>();
+
+ public List<Module> getModules() {
+ return modules;
+ }
+
+ public void setModules(List<Module> modules) {
+ this.modules = modules;
+ }
+
+ public List<String> getUnassigned() {
+ return unassigned;
+ }
+
+ public void setUnassigned(List<String> unassigned) {
+ this.unassigned = unassigned;
+ }
+
+ public List<String> getArtifacts() {
+ return artifacts;
+ }
+
+ public void setArtifacts(List<String> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ public List<String> getNested() {
+ return nested;
+ }
+
+ public void setNested(List<String> nested) {
+ this.nested = nested;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/OnboardingMethod.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/OnboardingMethod.java
deleted file mode 100644
index 0db4b0476d..0000000000
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/OnboardingMethod.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.openecomp.sdcrests.vendorsoftwareproducts.types;
-
-public enum OnboardingMethod {
- NetworkPackage,
- Manual;
-}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/QuestionnaireDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/QuestionnaireDto.java
new file mode 100644
index 0000000000..cb30b50134
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/QuestionnaireDto.java
@@ -0,0 +1,30 @@
+package org.openecomp.sdcrests.vendorsoftwareproducts.types;
+
+import java.util.HashMap;
+
+/**
+ * Created by ayalaben on 9/26/2017
+ */
+public class QuestionnaireDto {
+
+ private String id;
+
+ public HashMap<String, String> getQuestionareData() {
+ return questionareData;
+ }
+
+ public void setQuestionareData(HashMap<String, String> questionareData) {
+ this.questionareData = questionareData;
+ }
+
+ private HashMap<String,String> questionareData;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VendorSoftwareProductAction.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VendorSoftwareProductAction.java
index c652c1cc4e..1ec68e4818 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VendorSoftwareProductAction.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VendorSoftwareProductAction.java
@@ -21,9 +21,6 @@
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
public enum VendorSoftwareProductAction {
- Checkout,
- Undo_Checkout,
- Checkin,
Submit,
Create_Package;
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VersionSoftwareProductActionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VersionSoftwareProductActionRequestDto.java
index dbfdf346e4..f8ea65c477 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VersionSoftwareProductActionRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VersionSoftwareProductActionRequestDto.java
@@ -20,11 +20,14 @@
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
+import org.openecomp.sdcrests.item.types.SubmitRequestDto;
+
/**
* Created by TALIO on 4/20/2016.
*/
public class VersionSoftwareProductActionRequestDto {
private VendorSoftwareProductAction action;
+ private SubmitRequestDto submitRequest;
public VendorSoftwareProductAction getAction() {
return action;
@@ -33,4 +36,12 @@ public class VersionSoftwareProductActionRequestDto {
public void setAction(VendorSoftwareProductAction action) {
this.action = action;
}
+
+ public SubmitRequestDto getSubmitRequest() {
+ return submitRequest;
+ }
+
+ public void setSubmitRequest(SubmitRequestDto submitRequest) {
+ this.submitRequest = submitRequest;
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
index 9062f89d22..a2358a0b48 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
@@ -21,7 +21,6 @@
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
-import org.openecomp.sdcrests.common.types.VersionDto;
import javax.validation.constraints.NotNull;
@@ -39,14 +38,9 @@ public class VspDescriptionDto {
private String vendorName;
@NotNull
private String vendorId; // this will be populated with vlm id
- private VersionDto licensingVersion; // this will be populated with vlm version
+ private String licensingVersion; // this will be populated with vlm version
private LicensingData licensingData;
- @NotNull
- private String onboardingMethod;
- private String onboardingOrigin;
- private String networkPackageName;
-
public String getName() {
return name;
}
@@ -103,11 +97,11 @@ public class VspDescriptionDto {
this.vendorId = vendorId;
}
- public VersionDto getLicensingVersion() {
+ public String getLicensingVersion() {
return licensingVersion;
}
- public void setLicensingVersion(VersionDto licensingVersion) {
+ public void setLicensingVersion(String licensingVersion) {
this.licensingVersion = licensingVersion;
}
@@ -118,28 +112,4 @@ public class VspDescriptionDto {
public void setLicensingData(LicensingData licensingData) {
this.licensingData = licensingData;
}
-
- public String getOnboardingMethod() {
- return onboardingMethod;
- }
-
- public void setOnboardingMethod(String onboardingMethod) {
- this.onboardingMethod = onboardingMethod;
- }
-
- public String getOnboardingOrigin() {
- return onboardingOrigin;
- }
-
- public void setOnboardingOrigin(String onboardingOrigin) {
- this.onboardingOrigin = onboardingOrigin;
- }
-
- public String getNetworkPackageName() {
- return networkPackageName;
- }
-
- public void setNetworkPackageName(String networkPackageName) {
- this.networkPackageName = networkPackageName;
- }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java
index 28a77f2e66..5052442a23 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java
@@ -22,27 +22,20 @@ package org.openecomp.sdcrests.vendorsoftwareproducts.types;
import io.swagger.annotations.ApiModel;
import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdcrests.common.types.VersionDto;
-
-import java.util.List;
/**
* Created by TALIO on 4/25/2016.
*/
@ApiModel(value = "VspDetails")
-public class VspDetailsDto extends VspDescriptionDto {
+public class VspDetailsDto extends VspRequestDto {
private String id;
- private VersionDto version;
- private List<VersionDto> viewableVersions;
- private List<VersionDto> finalVersions;
- private VersionStatus status;
- private String lockingUser;
+ private String version;
private ValidationStructureList validationData;
- private String isOldVersion;
+ private String candidateOnboardingOrigin;
private String onboardingOrigin;
private String networkPackageName;
+
public String getId() {
return id;
}
@@ -51,60 +44,28 @@ public class VspDetailsDto extends VspDescriptionDto {
this.id = id;
}
- public VersionDto getVersion() {
+ public String getVersion() {
return version;
}
- public void setVersion(VersionDto version) {
+ public void setVersion(String version) {
this.version = version;
}
- public List<VersionDto> getViewableVersions() {
- return viewableVersions;
- }
-
- public void setViewableVersions(List<VersionDto> viewableVersions) {
- this.viewableVersions = viewableVersions;
- }
-
- public List<VersionDto> getFinalVersions() {
- return finalVersions;
- }
-
- public void setFinalVersions(List<VersionDto> finalVersions) {
- this.finalVersions = finalVersions;
- }
-
- public VersionStatus getStatus() {
- return status;
- }
-
- public void setStatus(VersionStatus status) {
- this.status = status;
- }
-
- public String getLockingUser() {
- return lockingUser;
- }
-
- public void setLockingUser(String lockingUser) {
- this.lockingUser = lockingUser;
- }
-
public ValidationStructureList getValidationData() {
return validationData;
}
- public String getIsOldVersion() {
- return isOldVersion;
+ public void setValidationData(ValidationStructureList validationData) {
+ this.validationData = validationData;
}
- public void setIsOldVersion(String isOldVersion) {
- this.isOldVersion = isOldVersion;
+ public String getCandidateOnboardingOrigin() {
+ return candidateOnboardingOrigin;
}
- public void setValidationData(ValidationStructureList validationData) {
- this.validationData = validationData;
+ public void setCandidateOnboardingOrigin(String candidateOnboardingOrigin) {
+ this.candidateOnboardingOrigin = candidateOnboardingOrigin;
}
public String getOnboardingOrigin() {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspRequestDto.java
new file mode 100644
index 0000000000..19cad86caf
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspRequestDto.java
@@ -0,0 +1,16 @@
+package org.openecomp.sdcrests.vendorsoftwareproducts.types;
+
+import javax.validation.constraints.NotNull;
+
+public class VspRequestDto extends VspDescriptionDto {
+ @NotNull
+ private String onboardingMethod;
+
+ public String getOnboardingMethod() {
+ return onboardingMethod;
+ }
+
+ public void setOnboardingMethod(String onboardingMethod) {
+ this.onboardingMethod = onboardingMethod;
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/IsValidJson.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/IsValidJson.java
index 5109002978..aa8b32ca23 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/IsValidJson.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/IsValidJson.java
@@ -24,6 +24,14 @@ package org.openecomp.sdcrests.vendorsoftwareproducts.types.validation;
* @since July 13, 2016
*/
+import org.openecomp.sdcrests.common.RestConstants;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
@@ -31,14 +39,6 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import org.openecomp.sdcrests.common.RestConstants;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
/**
* The interface Is valid json.
*/
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/StringValidator.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/StringValidator.java
index 0fc2fd7e82..49b3e91f15 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/StringValidator.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/StringValidator.java
@@ -1,9 +1,9 @@
package org.openecomp.sdcrests.vendorsoftwareproducts.types.validation;
-import java.util.ArrayList;
-import java.util.List;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
+import java.util.ArrayList;
+import java.util.List;
public class StringValidator implements ConstraintValidator<ValidateString, String> {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/ValidateString.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/ValidateString.java
index 1218bb1c22..dab2f25705 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/ValidateString.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/validation/ValidateString.java
@@ -1,5 +1,11 @@
package org.openecomp.sdcrests.vendorsoftwareproducts.types.validation;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
@@ -7,12 +13,6 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-
/**
* The interface Validate string.
*/