@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(); } }
@Override public String toString() { String res; res = this.getClass().toString() + " / " + this.getXmlId().getDecoded(); res += "\n"; res += "parent: " + this.getParent().toString(); return res; } }
@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(); }
@GET @Path("bordercolor") public String getColor() { return RestUtils.getColor(this.getId().getParent().getXmlId().getDecoded(), QNames.QNAME_BORDER_COLOR, this.otherAttributes); }
@Override public int hashCode() { return this.getParent().hashCode() ^ this.getXmlId().hashCode(); }
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"; } }