@Override public boolean equals(Object obj) { if (obj instanceof ToscaElementId) { ToscaElementId otherId = (ToscaElementId) obj; // the XML id has to be equal and the parents have to be equal return (otherId.getXmlId().equals(this.getXmlId())) && (otherId.getParent().equals(this.getParent())); } else { return false; } }
/** * @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(); }
PlansId plansContainerId = new PlansId(id); SortedSet<PlanId> nestedPlans = repository.getNestedIds(plansContainerId, PlanId.class); continue; PlanId planId = new PlanId(plansContainerId, new XmlId(plan.getId(), false)); if (nestedPlans.contains(planId)) { plan.setId(planId.getXmlId().getDecoded()); plan.setName(planId.getXmlId().getDecoded()); plan.setPlanType(org.eclipse.winery.repository.Constants.TOSCA_PLANTYPE_BUILD_PLAN); plan.setPlanLanguage(Namespaces.URI_BPEL20_EXECUTABLE);
/** * Synchronizes the plan model references and adds the plans to the csar (putRefAsReferencedItemInCsar) */ private void prepareForExport(IRepository repository, ServiceTemplateId id) throws IOException { // ensure that the plans stored locally are the same ones as stored in the definitions BackendUtils.synchronizeReferences(id); // add all plans as reference in the CSAR // the data model is consistent with the repository // we crawl through the repository to as putRefAsReferencedItemInCsar expects a repository file reference PlansId plansContainerId = new PlansId(id); SortedSet<PlanId> nestedPlans = repository.getNestedIds(plansContainerId, PlanId.class); for (PlanId planId : nestedPlans) { SortedSet<RepositoryFileReference> containedFiles = repository.getContainedFiles(planId); // even if we currently support only one file in the directory, we just add everything for (RepositoryFileReference ref : containedFiles) { putRefAsReferencedItemInCsar(ref); } } }
@Override public int compareTo(GenericId o1) { if (o1 instanceof ToscaElementId) { ToscaElementId o = (ToscaElementId) o1; if (this.getParent().equals(o.getParent())) { return this.getXmlId().compareTo(o.getXmlId()); } else { return this.getParent().compareTo(o.getParent()); } } else { // comparing TOSCAcomponentIDs with non-TOSCAcomponentIDs is not // possible throw new IllegalStateException(); } }
@GET @Path("bordercolor") public String getColor() { return RestUtils.getColor(this.getId().getParent().getXmlId().getDecoded(), QNames.QNAME_BORDER_COLOR, this.otherAttributes); }
public String getColor() { return RestUtils.getColor(this.getId().getParent().getXmlId().getDecoded(), QNames.QNAME_COLOR, this.otherAttributes); }
public VisualsApiData(GenericVisualAppearanceResource visuals) { IRepository repository = RepositoryFactory.getRepository(); DefinitionsChildId parent = (DefinitionsChildId) visuals.getId().getParent(); this.color = visuals.getColor(); this.typeId = parent.getQName(); this.pattern = repository.getNamespaceManager().isPatternNamespace(parent.getNamespace().getDecoded()); RepositoryFileReference iconRef = new RepositoryFileReference(visuals.getId(), Filename.FILENAME_SMALL_ICON); if (repository.exists(iconRef)) { iconUrl = visuals.getAbsoluteURL() + "16x16"; } RepositoryFileReference imageRef = new RepositoryFileReference(visuals.getId(), Filename.FILENAME_BIG_ICON); if (repository.exists(imageRef)) { imageUrl = visuals.getAbsoluteURL() + "50x50"; } }