default TPatternRefinementModel getElement(PatternRefinementModelId id) { return (TPatternRefinementModel) this.getDefinitions(id).getElement(); }
default TServiceTemplate getElement(ServiceTemplateId id) { return (TServiceTemplate) this.getDefinitions(id).getElement(); }
default TArtifactTemplate getElement(ArtifactTemplateId id) { return (TArtifactTemplate) this.getDefinitions(id).getElement(); }
default TArtifactType getElement(ArtifactTypeId id) { return (TArtifactType) this.getDefinitions(id).getElement(); }
default TRequirementType getElement(RequirementTypeId id) { return (TRequirementType) this.getDefinitions(id).getElement(); }
default TComplianceRule getElement(ComplianceRuleId id) { return (TComplianceRule) this.getDefinitions(id).getElement(); }
default TNodeTypeImplementation getElement(NodeTypeImplementationId id) { return (TNodeTypeImplementation) this.getDefinitions(id).getElement(); }
default TNodeType getElement(NodeTypeId id) { return (TNodeType) this.getDefinitions(id).getElement(); }
default TRelationshipType getElement(RelationshipTypeId id) { return (TRelationshipType) this.getDefinitions(id).getElement(); }
default TCapabilityType getElement(CapabilityTypeId id) { return (TCapabilityType) this.getDefinitions(id).getElement(); }
default TRefinementModel getElement(RefinementId id) { return (TRefinementModel) this.getDefinitions(id).getElement(); }
default TRelationshipTypeImplementation getElement(RelationshipTypeImplementationId id) { return (TRelationshipTypeImplementation) this.getDefinitions(id).getElement(); }
default TPolicyTemplate getElement(PolicyTemplateId id) { return (TPolicyTemplate) this.getDefinitions(id).getElement(); }
default TPolicyType getElement(PolicyTypeId id) { return (TPolicyType) this.getDefinitions(id).getElement(); }
default TTestRefinementModel getElement(TestRefinementModelId id) { return (TTestRefinementModel) this.getDefinitions(id).getElement(); }
/** * @return the file extension associated with this artifact type. May be null */ @GET @Path("/fileextension") public String getAssociatedFileExtension() { return this.getDefinitions().getElement().getOtherAttributes().get(this.qnameFileExtension); }
public static ToscaDiff compare(DefinitionsChildId id, WineryVersion versionToCompareTo) { IRepository repository = RepositoryFactory.getRepository(); DefinitionsChildId versionToCompare = VersionUtils.getDefinitionInTheGivenVersion(id, versionToCompareTo); TExtensibleElements workingVersion = repository.getDefinitions(id).getElement(); TExtensibleElements baseVersion = repository.getDefinitions(versionToCompare).getElement(); return VersionUtils.calculateDifferences(baseVersion, workingVersion); }
/** * Checks all references QNames whether they are valid */ private void checkReferencedQNames(DefinitionsChildId id) { final QNameValidator qNameValidator = new QNameValidator(error -> printAndAddError(id, error)); try { configuration.getRepository().getDefinitions(id).getElement().accept(qNameValidator); } catch (IllegalStateException e) { LOGGER.debug("Illegal State Exception during reading of id {}", id.toReadableString(), e); printAndAddError(id, "Reading error " + e.getMessage()); } }
/** * This is a quick helper method. The code should be refactored to use HasType on the element directly instead of * going through the resource. The method was implemented, because it is not that easy to get the id of the element * belonging to a resource. * * @param res a resource, where the associated element has a type. Example: EntityTypeImplementationResource * @return the QName of the associated type */ public static QName getType(IPersistable res) { DefinitionsChildId id = (DefinitionsChildId) res.getRepositoryFileReference().getParent(); final HasType element = (HasType) RepositoryFactory.getRepository().getDefinitions(id).getElement(); return element.getTypeAsQName(); }
public static String getName(DefinitionsChildId instanceId) throws RepositoryCorruptException { IRepository repository = RepositoryFactory.getRepository(); if (!repository.exists(instanceId)) { throw new RepositoryCorruptException("Definitions does not exist for instance"); } TExtensibleElements instanceElement = RepositoryFactory.getRepository().getDefinitions(instanceId).getElement(); return ModelUtilities.getNameWithIdFallBack(instanceElement); }