use of org.eclipse.winery.repository.datatypes.ids.elements.GenericDirectoryId in project winery by eclipse.
the class NodeTypeResource method uploadArtifact.
@Path("artifacts/{name}")
public GenericFileResource uploadArtifact(@PathParam("name") String name) {
DirectoryId dir = new GenericDirectoryId(this.getId(), IdNames.FILES_DIRECTORY);
DirectoryId files = new GenericDirectoryId(dir, name);
return new GenericFileResource(files);
}
use of org.eclipse.winery.repository.datatypes.ids.elements.GenericDirectoryId in project winery by eclipse.
the class NodeTemplateResource method postYamlArtifactFile.
@Path("yamlartifacts/{artifactId}")
public GenericFileResource postYamlArtifactFile(@PathParam("artifactId") String id) {
DirectoryId serviceTemplateYamlArtifactsDir = new GenericDirectoryId(getServiceTemplateResource().getId(), IdNames.FILES_DIRECTORY);
DirectoryId nodeTemplateYamlArtifactsDir = new GenericDirectoryId(serviceTemplateYamlArtifactsDir, nodeTemplate.getId());
DirectoryId yamlArtifactFilesDirectoryId = new GenericDirectoryId(nodeTemplateYamlArtifactsDir, id);
return new GenericFileResource(yamlArtifactFilesDirectoryId);
}
use of org.eclipse.winery.repository.datatypes.ids.elements.GenericDirectoryId in project winery by eclipse.
the class YamlCsarImporter method importArtifacts.
private void importArtifacts(Path rootPath, TExtensibleElements ci, DefinitionsChildId wid, TOSCAMetaFile tmf, final List<String> errors) {
if (ci instanceof TServiceTemplate) {
TServiceTemplate st = (TServiceTemplate) ci;
if (st.getTopologyTemplate() != null) {
st.getTopologyTemplate().getNodeTemplates().forEach(node -> {
if (Objects.nonNull(node.getArtifacts()) && !node.getArtifacts().isEmpty()) {
node.getArtifacts().stream().map(this::fixForwardSlash).filter(a -> this.isImportable(rootPath, a)).forEach(a -> {
DirectoryId stFilesDir = new GenericDirectoryId(wid, IdNames.FILES_DIRECTORY);
DirectoryId ntFilesDir = new GenericDirectoryId(stFilesDir, node.getId());
DirectoryId artifactDir = new GenericDirectoryId(ntFilesDir, a.getName());
importArtifact(rootPath, a, artifactDir, tmf, errors);
fixArtifactRefName(rootPath, a);
});
}
});
}
} else if (ci instanceof TNodeType) {
TNodeType nt = (TNodeType) ci;
fixOperationImplFileRef(nt);
if (Objects.nonNull(nt.getArtifacts()) && !nt.getArtifacts().isEmpty()) {
nt.getArtifacts().stream().map(this::fixForwardSlash).filter(a -> this.isImportable(rootPath, a)).forEach(a -> {
DirectoryId typeFilesDir = new GenericDirectoryId(wid, IdNames.FILES_DIRECTORY);
DirectoryId artifactDir = new GenericDirectoryId(typeFilesDir, a.getName());
importArtifact(rootPath, a, artifactDir, tmf, errors);
fixArtifactRefName(rootPath, a);
});
}
}
}
Aggregations