Search in sources :

Example 1 with ServiceArtifact

use of org.onap.so.db.catalog.beans.ServiceArtifact in project so by onap.

the class QueryServiceArtifact method toString.

@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    int i = 1;
    for (ServiceArtifact o : serviceArtifactList) {
        sb.append(i).append("\t");
        if (!first)
            sb.append("\n");
        first = false;
        sb.append(o);
    }
    return sb.toString();
}
Also used : ServiceArtifact(org.onap.so.db.catalog.beans.ServiceArtifact)

Example 2 with ServiceArtifact

use of org.onap.so.db.catalog.beans.ServiceArtifact in project so by onap.

the class QueryServiceArtifact method JSON2.

@Override
public String JSON2(boolean isArray, boolean isEmbed) {
    StringBuilder sb = new StringBuilder();
    if (!isEmbed && isArray)
        sb.append("{ ");
    if (isArray)
        sb.append("\"serviceArtifact\": [");
    Map<String, String> valueMap = new HashMap<>();
    String sep = "";
    boolean first = true;
    for (ServiceArtifact o : serviceArtifactList) {
        if (first)
            sb.append("\n");
        first = false;
        boolean vrNull = o == null;
        put(valueMap, "ARTIFACT_UUID", vrNull ? null : o.getArtifactUUID());
        put(valueMap, "TYPE", vrNull ? null : o.getType());
        put(valueMap, "NAME", vrNull ? null : o.getName());
        put(valueMap, "VERSION", vrNull ? null : o.getVersion());
        put(valueMap, "DESCRIPTION", vrNull ? null : o.getDescription());
        put(valueMap, "CONTENT", vrNull ? null : o.getContent());
        put(valueMap, "CHECKSUM", vrNull ? null : o.getChecksum());
        sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
        sep = ",\n";
    }
    if (!first)
        sb.append("\n");
    if (isArray)
        sb.append("]");
    if (!isEmbed && isArray)
        sb.append("}");
    return sb.toString();
}
Also used : HashMap(java.util.HashMap) ServiceArtifact(org.onap.so.db.catalog.beans.ServiceArtifact)

Example 3 with ServiceArtifact

use of org.onap.so.db.catalog.beans.ServiceArtifact in project so by onap.

the class QueryServiceArtifactTest method createList.

private List<ServiceArtifact> createList() {
    List<ServiceArtifact> artifacts = new ArrayList<>();
    Service service = mock(Service.class);
    ServiceArtifact artifact = new ServiceArtifact();
    artifact.setService(service);
    artifact.setArtifactUUID("b170dbeb-2954-4a4f-ad12-6bc84b3e089e");
    artifact.setChecksum("ZWRkMGM3NzNjMmE3NzliYTFiZGNmZjVlMDE4OWEzMTA=");
    artifact.setDescription("embbCn");
    artifact.setType("OTHER");
    artifact.setName("eMBB.zip");
    artifact.setVersion("1");
    artifacts.add(artifact);
    return artifacts;
}
Also used : ServiceArtifact(org.onap.so.db.catalog.beans.ServiceArtifact) ArrayList(java.util.ArrayList) Service(org.onap.so.db.catalog.beans.Service)

Example 4 with ServiceArtifact

use of org.onap.so.db.catalog.beans.ServiceArtifact in project so by onap.

the class ToscaResourceInstaller method createServiceArtifact.

private void createServiceArtifact(Service service, VfResourceStructure vfResourceStruct, String artifactContent) {
    if (null == vfResourceStruct) {
        return;
    }
    List<ServiceArtifact> serviceArtifactList = new ArrayList<>();
    ServiceArtifact serviceArtifact;
    List<IArtifactInfo> artifactInfoList = vfResourceStruct.getNotification().getServiceArtifacts().stream().filter(artifact -> artifact.getArtifactType().equalsIgnoreCase("WORKFLOW")).collect(Collectors.toList());
    for (IArtifactInfo artifactInfo : artifactInfoList) {
        serviceArtifact = new ServiceArtifact();
        serviceArtifact.setArtifactUUID(artifactInfo.getArtifactUUID());
        serviceArtifact.setName(artifactInfo.getArtifactName());
        serviceArtifact.setType("OTHER");
        serviceArtifact.setVersion(artifactInfo.getArtifactVersion());
        serviceArtifact.setDescription(artifactInfo.getArtifactDescription());
        serviceArtifact.setChecksum(artifactInfo.getArtifactChecksum());
        serviceArtifact.setContent(artifactContent);
        serviceArtifact.setService(service);
        serviceArtifactList.add(serviceArtifact);
    }
    service.setServiceArtifactList(serviceArtifactList);
}
Also used : NetworkInstanceGroup(org.onap.so.db.catalog.beans.NetworkInstanceGroup) ObjectOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException) Property(org.onap.sdc.toscaparser.api.Property) VfModule(org.onap.so.db.catalog.beans.VfModule) PnfResourceRepository(org.onap.so.db.catalog.data.repository.PnfResourceRepository) Autowired(org.springframework.beans.factory.annotation.Autowired) WatchdogComponentDistributionStatusRepository(org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository) EntityQueryBuilder(org.onap.sdc.tosca.parser.elements.queries.EntityQuery.EntityQueryBuilder) Matcher(java.util.regex.Matcher) VnfcCustomizationRepository(org.onap.so.db.catalog.data.repository.VnfcCustomizationRepository) Service(org.onap.so.db.catalog.beans.Service) VFModuleRepository(org.onap.so.db.catalog.data.repository.VFModuleRepository) Map(java.util.Map) ResourceStructure(org.onap.so.asdc.installer.ResourceStructure) EntityQuery(org.onap.sdc.tosca.parser.elements.queries.EntityQuery) VFCInstanceGroup(org.onap.so.db.catalog.beans.VFCInstanceGroup) ExternalServiceToInternalServiceRepository(org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) VnfcInstanceGroupCustomizationRepository(org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository) VnfcCustomization(org.onap.so.db.catalog.beans.VnfcCustomization) VfResourceStructure(org.onap.so.asdc.installer.VfResourceStructure) HeatEnvironment(org.onap.so.db.catalog.beans.HeatEnvironment) WatchdogDistributionStatus(org.onap.so.db.request.beans.WatchdogDistributionStatus) VfModuleArtifact(org.onap.so.asdc.installer.VfModuleArtifact) SdcTypes(org.onap.sdc.tosca.parser.enums.SdcTypes) HeatFiles(org.onap.so.db.catalog.beans.HeatFiles) HeatEnvironmentRepository(org.onap.so.db.catalog.data.repository.HeatEnvironmentRepository) Set(java.util.Set) CollectionResourceInstanceGroupCustomization(org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization) PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) ASDCConfiguration(org.onap.so.asdc.client.ASDCConfiguration) ConfigurationResource(org.onap.so.db.catalog.beans.ConfigurationResource) NodeTemplate(org.onap.sdc.toscaparser.api.NodeTemplate) AllottedResource(org.onap.so.db.catalog.beans.AllottedResource) IArtifactInfo(org.onap.sdc.api.notification.IArtifactInfo) NetworkResourceCustomizationRepository(org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository) CollectionUtils(org.springframework.util.CollectionUtils) ConfigurationResourceCustomizationRepository(org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository) NetworkResource(org.onap.so.db.catalog.beans.NetworkResource) LockAcquisitionException(org.hibernate.exception.LockAcquisitionException) CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) InstanceGroupRepository(org.onap.so.db.catalog.data.repository.InstanceGroupRepository) CollectionResourceRepository(org.onap.so.db.catalog.data.repository.CollectionResourceRepository) IVfModuleData(org.onap.so.asdc.installer.IVfModuleData) ASDCElementInfo(org.onap.so.asdc.installer.ASDCElementInfo) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) IResourceInstance(org.onap.sdc.api.notification.IResourceInstance) VFModuleCustomizationRepository(org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository) TopologyTemplateQueryBuilder(org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery.TopologyTemplateQueryBuilder) InstanceGroupType(org.onap.so.db.catalog.beans.InstanceGroupType) AllottedResourceRepository(org.onap.so.db.catalog.data.repository.AllottedResourceRepository) VnfResource(org.onap.so.db.catalog.beans.VnfResource) HeatFilesRepository(org.onap.so.db.catalog.data.repository.HeatFilesRepository) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) ErrorCode(org.onap.logging.filter.base.ErrorCode) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) ISdcCsarHelper(org.onap.sdc.tosca.parser.api.ISdcCsarHelper) InstanceGroup(org.onap.so.db.catalog.beans.InstanceGroup) CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) ArtifactInstallerException(org.onap.so.asdc.client.exceptions.ArtifactInstallerException) HeatTemplate(org.onap.so.db.catalog.beans.HeatTemplate) RequirementAssignment(org.onap.sdc.toscaparser.api.RequirementAssignment) PnfResource(org.onap.so.db.catalog.beans.PnfResource) ToscaCsarRepository(org.onap.so.db.catalog.data.repository.ToscaCsarRepository) TopologyTemplateQuery(org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery) Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) PnfResourceStructure(org.onap.so.asdc.installer.PnfResourceStructure) IEntityDetails(org.onap.sdc.tosca.parser.api.IEntityDetails) ServiceProxyResourceCustomization(org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization) CapabilityAssignment(org.onap.sdc.toscaparser.api.CapabilityAssignment) Input(org.onap.sdc.toscaparser.api.parameters.Input) MessageEnum(org.onap.so.logger.MessageEnum) SubType(org.onap.so.db.catalog.beans.SubType) NetworkResourceRepository(org.onap.so.db.catalog.data.repository.NetworkResourceRepository) ConstraintViolationException(org.hibernate.exception.ConstraintViolationException) WatchdogServiceModVerIdLookupRepository(org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository) Timestamp(java.sql.Timestamp) Collection(java.util.Collection) YamlEditor(org.onap.so.asdc.util.YamlEditor) TempNetworkHeatTemplateRepository(org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository) Collectors(java.util.stream.Collectors) List(java.util.List) ServiceInfo(org.onap.so.db.catalog.beans.ServiceInfo) Optional(java.util.Optional) LoggingAnchor(org.onap.so.logger.LoggingAnchor) Pattern(java.util.regex.Pattern) BigDecimalVersion(org.onap.so.asdc.installer.BigDecimalVersion) WatchdogDistributionStatusRepository(org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository) TempNetworkHeatTemplateLookup(org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup) ServiceArtifact(org.onap.so.db.catalog.beans.ServiceArtifact) WatchdogServiceModVerIdLookup(org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup) HashMap(java.util.HashMap) CvnfcCustomizationRepository(org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository) ServiceProxyResourceCustomizationRepository(org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository) HeatTemplateParam(org.onap.so.db.catalog.beans.HeatTemplateParam) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) ConfigurationResourceRepository(org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository) HashSet(java.util.HashSet) AllottedResourceCustomizationRepository(org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository) PnfCustomizationRepository(org.onap.so.db.catalog.data.repository.PnfCustomizationRepository) CollectionResourceCustomizationRepository(org.onap.so.db.catalog.data.repository.CollectionResourceCustomizationRepository) DistributionStatusEnum(org.onap.sdc.utils.DistributionStatusEnum) WatchdogComponentDistributionStatus(org.onap.so.db.request.beans.WatchdogComponentDistributionStatus) Logger(org.slf4j.Logger) EntityTemplateType(org.onap.sdc.tosca.parser.enums.EntityTemplateType) IStatusData(org.onap.sdc.api.notification.IStatusData) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) VnfResourceRepository(org.onap.so.db.catalog.data.repository.VnfResourceRepository) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) HeatTemplateRepository(org.onap.so.db.catalog.data.repository.HeatTemplateRepository) VfModuleStructure(org.onap.so.asdc.installer.VfModuleStructure) VnfcInstanceGroupCustomization(org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization) ToscaCsar(org.onap.so.db.catalog.beans.ToscaCsar) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) Metadata(org.onap.sdc.toscaparser.api.elements.Metadata) ToscaResourceStructure(org.onap.so.asdc.installer.ToscaResourceStructure) Component(org.springframework.stereotype.Component) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) ServiceRepository(org.onap.so.db.catalog.data.repository.ServiceRepository) SdcPropertyNames(org.onap.sdc.tosca.parser.impl.SdcPropertyNames) AllottedResourceCustomization(org.onap.so.db.catalog.beans.AllottedResourceCustomization) GetInput(org.onap.sdc.toscaparser.api.functions.GetInput) Collections(java.util.Collections) WorkflowResource(org.onap.so.asdc.installer.bpmn.WorkflowResource) Transactional(org.springframework.transaction.annotation.Transactional) ServiceArtifact(org.onap.so.db.catalog.beans.ServiceArtifact) ArrayList(java.util.ArrayList) IArtifactInfo(org.onap.sdc.api.notification.IArtifactInfo)

Aggregations

ServiceArtifact (org.onap.so.db.catalog.beans.ServiceArtifact)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Service (org.onap.so.db.catalog.beans.Service)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Timestamp (java.sql.Timestamp)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1 ConstraintViolationException (org.hibernate.exception.ConstraintViolationException)1