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();
}
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();
}
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;
}
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);
}
Aggregations