/** * @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(); }
/** * 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); }
toInsert = Util.URLencode(toInsert); return IdUtil.getPathFragment(id.getParent()) + toInsert + "/"; } else { throw new IllegalStateException("Unknown subclass of GenericId " + id.getClass());
return getPathInsideRepo(id.getParent()) + id.getXmlId().getEncoded() + "/"; } else { throw new IllegalStateException("Unknown subclass of GenericId " + id.getClass());
git.checkout().setName(gitInfo.BRANCH).call(); String path = "artifacttemplates/" + Util.URLencode(((ArtifactTemplateId) csarEntry.getReference().getParent().getParent()).getQName().getNamespaceURI()) + "/" + ((ArtifactTemplateId) csarEntry.getReference().getParent().getParent()).getQName().getLocalPart() + "/files/"; TArtifactTemplate template = BackendUtils.getTArtifactTemplate((DirectoryId) csarEntry.getReference().getParent());