/** * Convenience method for clearing the current elements and setting the given one as single element */ public void setElement(TExtensibleElements element) { this.getServiceTemplateOrNodeTypeOrNodeTypeImplementation().clear(); this.getServiceTemplateOrNodeTypeOrNodeTypeImplementation().add(element); }
public TDefinitions build() { return new TDefinitions(this); }
List<TImport> imports = defs.getImport(); this.importImports(defsPath.getParent(), tmf, imports, errors, options); String defaultNamespace = defs.getTargetNamespace(); List<TExtensibleElements> componentInstanceList = defs.getServiceTemplateOrNodeTypeOrNodeTypeImplementation(); for (final TExtensibleElements ci : componentInstanceList) {
Iterator<TExtensibleElements> iterator = defs.getServiceTemplateOrNodeTypeOrNodeTypeImplementation().iterator(); boolean found = false; TExtensibleElements next = null; String namespace = serviceTemplate.getTargetNamespace(); if (namespace == null) { namespace = defs.getTargetNamespace();
Types typesContainer = defs.getTypes(); if (typesContainer != null) { List<Object> types = typesContainer.getAny(); String id = defs.getId(); imp.setImportType(XMLConstants.W3C_XML_SCHEMA_NS_URI); imp.setNamespace(ns); wrapperDefs.getImport().add(imp); CsarImporter.storeDefinitions(importId, wrapperDefs); defs.getImport().add(imp); } else {
public static void storeTypes(Path path, String namespace, String id) { LOGGER.debug("Store type: {}", id); try { MediaType mediaType = MediaTypes.MEDIATYPE_XSD; TImport.Builder builder = new TImport.Builder(Namespaces.XML_NS); builder.setNamespace(namespace); builder.setLocation(id + ".xsd"); GenericImportId rid = new XSDImportId(namespace, id, false); TDefinitions definitions = BackendUtils.createWrapperDefinitions(rid); definitions.getImport().add(builder.build()); CsarImporter.storeDefinitions(rid, definitions); RepositoryFileReference ref = BackendUtils.getRefOfDefinitions(rid); List<File> files = Files.list(path).filter(Files::isRegularFile) .map(Path::toFile).collect(Collectors.toList()); for (File file : files) { BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file)); RepositoryFileReference fileRef = new RepositoryFileReference(ref.getParent(), file.getName()); RepositoryFactory.getRepository().putContentToFile(fileRef, stream, mediaType); } } catch (IllegalArgumentException | IOException e) { throw new IllegalStateException(e); } }
public static Response.ResponseBuilder persistWithResponseBuilder(IPersistable res) { try { NamespaceManager namespaceManager = RepositoryFactory.getRepository().getNamespaceManager(); namespaceManager.addPermanentNamespace(res.getDefinitions().getTargetNamespace()); BackendUtils.persist(res.getDefinitions(), res.getRepositoryFileReference(), MediaTypes.MEDIATYPE_TOSCA_DEFINITIONS); } catch (IOException e) { LOGGER.debug("Could not persist resource", e); throw new WebApplicationException(e); } return Response.noContent(); }
defs.getImport().add(imp);
/** * Convenience method for <code>this.getServiceTemplateOrNodeTypeOrNodeTypeImplementation().get(0)</code> */ @XmlTransient @JsonIgnore public TExtensibleElements getElement() { return this.getServiceTemplateOrNodeTypeOrNodeTypeImplementation().get(0); }
@JsonIgnore @NonNull public List<TRelationshipTypeImplementation> getRelationshipTypeImplementations() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TRelationshipTypeImplementation) .map(TRelationshipTypeImplementation.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TArtifactType> getArtifactTypes() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TArtifactType) .map(TArtifactType.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TNodeTypeImplementation> getNodeTypeImplementations() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TNodeTypeImplementation) .map(TNodeTypeImplementation.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TPolicyTemplate> getPolicyTemplates() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TPolicyTemplate) .map(TPolicyTemplate.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TNodeType> getNodeTypes() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TNodeType) .map(TNodeType.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TServiceTemplate> getServiceTemplates() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TServiceTemplate) .map(TServiceTemplate.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TCapabilityType> getCapabilityTypes() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TCapabilityType) .map(TCapabilityType.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TRelationshipType> getRelationshipTypes() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TRelationshipType) .map(TRelationshipType.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TArtifactTemplate> getArtifactTemplates() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TArtifactTemplate) .map(TArtifactTemplate.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TRequirementType> getRequirementTypes() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TRequirementType) .map(TRequirementType.class::cast) .collect(Collectors.toList()); }
@JsonIgnore @NonNull public List<TPolicyType> getPolicyTypes() { return getServiceTemplateOrNodeTypeOrNodeTypeImplementation().stream() .filter(x -> x instanceof TPolicyType) .map(TPolicyType.class::cast) .collect(Collectors.toList()); }