/** * Convenience method for getId().getNamespace() */ public final Namespace getNamespace() { return this.id.getNamespace(); }
/** * Convenience method for getId().getXmlId() */ public final XmlId getXmlId() { return this.id.getXmlId(); }
@Override public final int compareTo(AbstractComponentInstanceResource o) { return this.id.compareTo(o.id); }
(otherVersion.toString().length() > 0 ? WineryVersion.WINERY_NAME_FROM_VERSION_SEPARATOR + otherVersion.toString() : ""); QName qName = new QName(childId.getNamespace().getDecoded(), localPart); if (childId instanceof RelationshipTypeImplementationId) { return new RelationshipTypeImplementationId(qName); } else if (childId instanceof NodeTypeImplementationId) { return new NodeTypeImplementationId(qName); } else if (childId instanceof RequirementTypeId) { return new RequirementTypeId(qName); } else if (childId instanceof NodeTypeId) { return new NodeTypeId(qName); } else if (childId instanceof RelationshipTypeId) { return new RelationshipTypeId(qName); } else if (childId instanceof CapabilityTypeId) { return new CapabilityTypeId(qName); } else if (childId instanceof ArtifactTypeId) { return new ArtifactTypeId(qName); } else if (childId instanceof PolicyTypeId) { return new PolicyTypeId(qName); } else if (childId instanceof PolicyTemplateId) { return new PolicyTemplateId(qName); } else if (childId instanceof ServiceTemplateId) { return new ServiceTemplateId(qName); } else if (childId instanceof ArtifactTemplateId) { return new ArtifactTemplateId(qName); } else { throw new IllegalStateException("Unhandled id branch. Could happen for XSDImportId");
public QName convert(TEntityType.DerivedFrom node, Class<? extends TEntityType> clazz) { if (Objects.isNull(node)) return null; DefinitionsChildId id; if (clazz.equals(org.eclipse.winery.model.tosca.TNodeType.class)) { id = new NodeTypeId(node.getTypeRef()); } else if (clazz.equals(org.eclipse.winery.model.tosca.TRelationshipType.class)) { id = new RelationshipTypeId(node.getTypeRef()); } else if (clazz.equals(TRequirementType.class)) { id = new RequirementTypeId(node.getTypeRef()); } else if (clazz.equals(org.eclipse.winery.model.tosca.TCapabilityType.class)) { id = new CapabilityTypeId(node.getTypeRef()); } else if (clazz.equals(org.eclipse.winery.model.tosca.TArtifactType.class)) { id = new ArtifactTypeId(node.getTypeRef()); } else { id = new PolicyTypeId(node.getTypeRef()); } return getQName( id, node.getTypeRef().getNamespaceURI(), node.getTypeRef().getLocalPart()); }
private Optional<EntityTypeId> getTypeId(QName type) { if (this.res instanceof NodeTypeImplementationResource || this.res instanceof NodeTypeImplementationsResource) { return Optional.of(new NodeTypeId(type)); } else if (this.res instanceof RelationshipTypeImplementationResource || this.res instanceof RelationshipTypeImplementationsResource) { return Optional.of(new RelationshipTypeId(type)); } return Optional.empty(); }
public QNameApiData(DefinitionsChildId newId) { this.localname = newId.getXmlId().getDecoded(); this.namespace = newId.getNamespace().getDecoded(); } }
/** * Converts the given collection of definition children Ids to a collection of QNames by using the getQName() * method. * <p> * This is required for QNameChooser.tag */ public static Collection<QName> convertDefinitionsChildIdCollectionToQNameCollection(Collection<? extends DefinitionsChildId> col) { Collection<QName> res = new ArrayList<>(); for (DefinitionsChildId id : col) { res.add(id.getQName()); } return res; }
public TArtifactDefinition convertArtifactReference(QName ref) { if (Objects.isNull(ref)) return null; return convert(new ArtifactTemplateId(ref)); }
private void loadDefinitions() { this.repository.getAllDefinitionsChildIds(NodeTypeId.class) .forEach(id -> this.nodeTypes.put(id.getQName(), this.repository.getElement(id)) ); this.repository.getAllDefinitionsChildIds(RelationshipTypeId.class) .forEach(id -> this.relationshipTypes.put(id.getQName(), this.repository.getElement(id)) ); }
@Override public Collection<PolicyTemplateId> getAllImplementations() { return RepositoryFactory.getRepository().getAllElementsReferencingGivenType(PolicyTemplateId.class, this.policyTypeId.getQName()); } }
@Override public Collection<ArtifactTemplateId> getAllImplementations() { return RepositoryFactory.getRepository().getAllElementsReferencingGivenType(ArtifactTemplateId.class, this.artifactTypeId.getQName()); } }
@Override public final int hashCode() { return this.getId().hashCode(); }
default Collection<DefinitionsChildId> getReferencingDefinitionsChildIds(PolicyTemplateId id) { // ServiceTemplates > BoundaryDefinitions > TPolicies return new HashSet<>(this.getAllElementsReferencingGivenType(ServiceTemplateId.class, id.getQName())); }
default Collection<DefinitionsChildId> getReferencingDefinitionsChildIds(NodeTypeImplementationId id) { // NodeTypeImplementations return new HashSet<>(this.getAllElementsReferencingGivenType(NodeTypeImplementationId.class, id.getQName())); }
default Collection<DefinitionsChildId> getReferencingDefinitionsChildIds(RelationshipTypeImplementationId id) { // RelationshipTypeImplementations return new HashSet<>(this.getAllElementsReferencingGivenType(RelationshipTypeImplementationId.class, id.getQName())); }
protected static TEntityType getEntityType(QName qName, Class<? extends TEntityType> tEntityTypeClass) { if (tEntityTypeClass.isAssignableFrom(TNodeType.class)) { return RepositoryFactory.getRepository().getElement(new NodeTypeId(qName)); } if (tEntityTypeClass.isAssignableFrom(TRelationshipType.class)) { return RepositoryFactory.getRepository().getElement(new RelationshipTypeId(qName)); } return null; } }
/** * @param id the id to determine the namespace of the parent for * @return the namespace of the first DefinitionsChildId found in the ID hierarchy */ public static Namespace getNamespace(ToscaElementId id) { GenericId parent = id.getParent(); while (!(parent instanceof DefinitionsChildId)) { parent = parent.getParent(); } return ((DefinitionsChildId) parent).getNamespace(); }
private void checkId(DefinitionsChildId id) { checkNamespaceUri(id); checkNcname(id, id.getXmlId().getDecoded()); }