1 package org.openecomp.vid.services;
3 import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
4 import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
5 import org.openecomp.vid.asdc.AsdcCatalogException;
6 import org.openecomp.vid.asdc.AsdcClient;
7 import org.openecomp.vid.asdc.beans.Service;
8 import org.openecomp.vid.asdc.parser.ToscaParser;
9 import org.openecomp.vid.asdc.parser.ToscaParserImpl;
10 import org.openecomp.vid.asdc.parser.ToscaParserImpl2;
11 import org.openecomp.vid.model.ServiceModel;
12 import org.springframework.beans.factory.annotation.Autowired;
14 import java.nio.file.Path;
15 import java.text.DateFormat;
16 import java.text.SimpleDateFormat;
20 * The Class VidController.
23 public class VidServiceImpl implements VidService {
27 private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidServiceImpl.class);
29 * The Constant dateFormat.
31 private final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
32 protected final AsdcClient asdcClient;
34 private ToscaParserImpl2 toscaParser;
36 public VidServiceImpl(AsdcClient asdcClient) {
37 this.asdcClient = asdcClient;
43 * @see org.openecomp.vid.controller.VidService#getServices(java.util.Map)
46 public Collection<Service> getServices(Map<String, String[]> requestParams)
47 throws AsdcCatalogException {
48 return asdcClient.getServices(requestParams);
54 * @see org.openecomp.vid.controller.VidService#getService(java.lang.String)
57 public ServiceModel getService(String uuid) throws AsdcCatalogException {
58 final Path serviceCsar = asdcClient.getServiceToscaModel(UUID.fromString(uuid));
59 ToscaParser tosca = new ToscaParserImpl();
60 serviceCsar.toFile().getAbsolutePath();
61 ServiceModel serviceModel = null;
63 final Service asdcServiceMetadata = asdcClient.getService(UUID.fromString(uuid));
65 serviceModel = toscaParser.makeServiceModel(serviceCsar, asdcServiceMetadata);
67 catch (SdcToscaParserException e){
68 serviceModel = tosca.makeServiceModel(uuid, serviceCsar, asdcServiceMetadata);
70 } catch (Exception e) {