diff options
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java | 117 |
1 files changed, 54 insertions, 63 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java index fa079d2f65..9fba1c7164 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java @@ -17,10 +17,8 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.components.impl; - import javax.servlet.ServletContext; import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; import org.openecomp.sdc.be.impl.WebAppContextWrapper; @@ -30,79 +28,72 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; - //upload Service model by Shiyong1989@hotmail.com @Component("ServiceImportManager") public class ServiceImportManager { - private ServletContext servletContext; - - private ResponseFormatManager responseFormatManager; - - @Autowired - private ServiceBusinessLogic serviceBusinessLogic; - - public ServiceImportBusinessLogic getServiceImportBusinessLogic() { - return serviceImportBusinessLogic; - } - - public void setServiceImportBusinessLogic( - ServiceImportBusinessLogic serviceImportBusinessLogic) { - this.serviceImportBusinessLogic = serviceImportBusinessLogic; - } + private ServletContext servletContext; + private ResponseFormatManager responseFormatManager; + @Autowired + private ServiceBusinessLogic serviceBusinessLogic; + @Autowired + private ServiceImportBusinessLogic serviceImportBusinessLogic; - @Autowired - private ServiceImportBusinessLogic serviceImportBusinessLogic; - - public boolean isServiceExist(String serviceName) { - return serviceBusinessLogic.isServiceExist(serviceName); - } + public ServiceImportBusinessLogic getServiceImportBusinessLogic() { + return serviceImportBusinessLogic; + } + public void setServiceImportBusinessLogic(ServiceImportBusinessLogic serviceImportBusinessLogic) { + this.serviceImportBusinessLogic = serviceImportBusinessLogic; + } - public ServiceBusinessLogic getServiceBusinessLogic() { - return serviceBusinessLogic; - } + public boolean isServiceExist(String serviceName) { + return serviceBusinessLogic.isServiceExist(serviceName); + } - public void setServiceBusinessLogic( - ServiceBusinessLogic serviceBusinessLogic) { - this.serviceBusinessLogic = serviceBusinessLogic; - } + public ServiceBusinessLogic getServiceBusinessLogic() { + return serviceBusinessLogic; + } + public void setServiceBusinessLogic(ServiceBusinessLogic serviceBusinessLogic) { + this.serviceBusinessLogic = serviceBusinessLogic; + } - public void populateServiceMetadata(UploadServiceInfo serviceMetaData, Service service) { - if (service != null && serviceMetaData != null) { - service.setDescription(serviceMetaData.getDescription()); - service.setTags(serviceMetaData.getTags()); - service.setCategories(serviceMetaData.getCategories()); - service.setContactId(serviceMetaData.getContactId()); - service.setName(serviceMetaData.getName()); - service.setIcon(serviceMetaData.getServiceIconPath()); - service.setServiceVendorModelNumber(serviceMetaData.getServiceVendorModelNumber()); - ServiceMetadataDataDefinition serviceMetadataDataDefinition = (ServiceMetadataDataDefinition) service - .getComponentMetadataDefinition().getMetadataDataDefinition(); - serviceMetadataDataDefinition.getServiceVendorModelNumber(); - service.setServiceType(""); - service.setProjectCode(serviceMetaData.getProjectCode()); - if (serviceMetaData.getVendorName() != null) { - service.setVendorName(serviceMetaData.getVendorName()); - } - if (serviceMetaData.getVendorRelease() != null) { - service.setVendorRelease(serviceMetaData.getVendorRelease()); - } + public void populateServiceMetadata(UploadServiceInfo serviceMetaData, Service service) { + if (service != null && serviceMetaData != null) { + service.setDescription(serviceMetaData.getDescription()); + service.setTags(serviceMetaData.getTags()); + service.setCategories(serviceMetaData.getCategories()); + service.setContactId(serviceMetaData.getContactId()); + service.setName(serviceMetaData.getName()); + service.setIcon(serviceMetaData.getServiceIconPath()); + service.setServiceVendorModelNumber(serviceMetaData.getServiceVendorModelNumber()); + ServiceMetadataDataDefinition serviceMetadataDataDefinition = (ServiceMetadataDataDefinition) service.getComponentMetadataDefinition() + .getMetadataDataDefinition(); + serviceMetadataDataDefinition.getServiceVendorModelNumber(); + service.setServiceType(""); + service.setProjectCode(serviceMetaData.getProjectCode()); + if (serviceMetaData.getVendorName() != null) { + service.setVendorName(serviceMetaData.getVendorName()); + } + if (serviceMetaData.getVendorRelease() != null) { + service.setVendorRelease(serviceMetaData.getVendorRelease()); + } + } } - } - public synchronized void init(ServletContext servletContext) { - if (this.servletContext == null) { - this.servletContext = servletContext; - responseFormatManager = ResponseFormatManager.getInstance(); - serviceBusinessLogic = getServiceBL(servletContext); + public synchronized void init(ServletContext servletContext) { + if (this.servletContext == null) { + this.servletContext = servletContext; + responseFormatManager = ResponseFormatManager.getInstance(); + serviceBusinessLogic = getServiceBL(servletContext); + } } - } - private ServiceBusinessLogic getServiceBL(ServletContext context) { - WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(org.openecomp.sdc.common.api.Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); - WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context); - return webApplicationContext.getBean(ServiceBusinessLogic.class); - } + private ServiceBusinessLogic getServiceBL(ServletContext context) { + WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context + .getAttribute(org.openecomp.sdc.common.api.Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); + WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context); + return webApplicationContext.getBean(ServiceBusinessLogic.class); + } } |