Search in sources :

Example 1 with TSchema

use of org.eclipse.winery.model.tosca.TSchema in project winery by eclipse.

the class IRepository method getReferencedDefinitionsOfProperties.

default void getReferencedDefinitionsOfProperties(Collection<DefinitionsChildId> ids, TEntityType.PropertiesDefinition properties) {
    if (Objects.nonNull(properties)) {
        // Only the YamlPropertiesDefinitions are referencing additional elements
        if (properties instanceof TEntityType.YamlPropertiesDefinition) {
            List<TEntityType.YamlPropertyDefinition> props = ((TEntityType.YamlPropertiesDefinition) properties).getProperties();
            Queue<TSchema> schemata = new LinkedList<>();
            for (TEntityType.YamlPropertyDefinition def : props) {
                if (!def.getType().getNamespaceURI().isEmpty()) {
                    ids.add(new DataTypeId(def.getType()));
                }
                schemata.add(def.getKeySchema());
                schemata.add(def.getEntrySchema());
            }
            while (!schemata.isEmpty()) {
                TSchema current = schemata.poll();
                if (current == null) {
                    continue;
                }
                if (!current.getType().getNamespaceURI().isEmpty()) {
                    ids.add(new DataTypeId(current.getType()));
                }
                schemata.add(current.getKeySchema());
                schemata.add(current.getEntrySchema());
            }
        }
    }
}
Also used : TSchema(org.eclipse.winery.model.tosca.TSchema) TEntityType(org.eclipse.winery.model.tosca.TEntityType) DataTypeId(org.eclipse.winery.model.ids.definitions.DataTypeId) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 DataTypeId (org.eclipse.winery.model.ids.definitions.DataTypeId)1 TEntityType (org.eclipse.winery.model.tosca.TEntityType)1 TSchema (org.eclipse.winery.model.tosca.TSchema)1