/** * Creates a new id based on strings. This constructor is required for @see org.eclipse.winery.repository.resources.AbstractComponentsResource * * @param ns the namespace to be used * @param id the id to be used * @param URLencoded true: both Strings are URLencoded, false: both Strings are not URLencoded */ public DefinitionsChildId(String ns, String id, boolean URLencoded) { this(new Namespace(ns, URLencoded), new XmlId(id, URLencoded)); }
/** * Returns the fragment of the URL path belonging to the id * <p> * For instance, an Id of type ServiceTemplateId has * <code>servicetemplates/{double encoded ns}/{double encoded name}/</code> * * @param id the element to return the path fragment for * @return the path fragment to be used inside an URL */ public static String getURLPathFragment(GenericId id) { return IdUtil.getPathFragment(id, true); }
public QNameApiData(DefinitionsChildId newId) { this.localname = newId.getXmlId().getDecoded(); this.namespace = newId.getNamespace().getDecoded(); } }
/** * Returns the namespace where the given Id is nested in. As the id is not a * DefinitionsChildId, it cannot be directly asked for its parent. Merely, the * parent has to be asked for its namespace. The parent, in turn, if it is * no DefinitionsChildId has to ask his parent. * * @param id the id refering to an element, where the namespace has to be * checked for * @return the namespace of the element denoted by id */ public static Namespace getNamespace(GenericId id) { if (id instanceof DefinitionsChildId) { return ((DefinitionsChildId) id).getNamespace(); } else { return IdUtil.getNamespace(id.getParent()); } }
/** * Zips the folder reference given by the id. As filename the parent id is used. * * @param id the id of the folder */ public static Response getZippedContents(final GenericId id) { final String name = id.getParent().getXmlId().getEncoded(); return getZippedContents(id, name + Constants.SUFFIX_ZIP); }
@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; } }
public VisualAppearanceId(DefinitionsChildId parent) { super(parent, new XmlId("appearance", true)); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof DefinitionsChildId)) return false; // only the same component instances might be equal if (!o.getClass().equals(this.getClass())) { return false; } if (!super.equals(o)) return false; DefinitionsChildId that = (DefinitionsChildId) o; return namespace.equals(that.namespace); }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof GenericId)) return false; GenericId genericId = (GenericId) o; return xmlId.equals(genericId.xmlId); }
@Override public int hashCode() { return xmlId.hashCode(); } }
@Override public int compareTo(RepositoryFileReference o) { int res; res = this.parent.compareTo(o.parent); if (res == 0) { res = this.fileName.compareTo(o.fileName); } return res; }
public DirectoryId(GenericId parent, String directoryId, boolean URLencoded) { super(parent, new XmlId(directoryId, URLencoded)); } }
/** * Returns the fragment of the path belonging to the id * <p> * For instance, an Id of type ServiceTemplateId has * <code>servicetemplates/{encoded ns}/{encoded name}/</code> * * @param id the element to return the path fragment for * @return the path fragment. This is <em>not</em> intended to be used * inside a URL */ public static String getPathFragment(GenericId id) { return IdUtil.getPathFragment(id, false); }
public DirectoryId(GenericId parent, String directoryId) { super(parent, new XmlId(directoryId, false)); }
public SelfServiceMetaDataId(ServiceTemplateId parent) { super(parent, new XmlId(Constants.DIRNAME_SELF_SERVICE_METADATA, true)); }
public PlansId(ServiceTemplateId parent) { super(parent, new XmlId("plans", true)); }