@GET @Path("id") public String getTOSCAId() { return this.id.getXmlId().getDecoded(); }
public static WineryVersion getVersionWithCurrentFlag(DefinitionsChildId id, DefinitionsChildId requestingElementInSet) { Objects.requireNonNull(id); Objects.requireNonNull(requestingElementInSet); return getVersionWithCurrentFlag(id.getXmlId().getDecoded(), requestingElementInSet.getXmlId().getDecoded()); }
public static String getQNameWithComponentVersionOnly(DefinitionsChildId id) { Matcher m = VERSION_PATTERN.matcher(id.getXmlId().getDecoded()); String componentVersion = ""; if (m.find()) { componentVersion = Objects.nonNull(m.group(COMPONENT_VERSION_GROUP)) ? m.group(COMPONENT_VERSION_GROUP) : ""; } String nameWithoutVersion = getNameWithoutVersion(id.getQName().toString()); if (componentVersion.length() > 0) { nameWithoutVersion += WineryVersion.WINERY_VERSION_SEPARATOR + componentVersion; } return nameWithoutVersion; }
public NameAndQNameApiData(DefinitionsChildId id) { this.name = id.getXmlId().getDecoded(); this.qName = id.getQName(); } }
@Override public String toString() { String res; res = this.getClass().toString() + " / " + this.getXmlId().getDecoded(); res += "\n"; res += "parent: " + this.getParent().toString(); return res; } }
public static String getNameWithoutVersion(DefinitionsChildId id) { return getNameWithoutVersion(id.getXmlId().getDecoded()); }
public static WineryVersion getVersion(DefinitionsChildId id) { return getVersion(id.getXmlId().getDecoded()); }
@GET @Path("bordercolor") public String getColor() { return RestUtils.getColor(this.getId().getParent().getXmlId().getDecoded(), QNames.QNAME_BORDER_COLOR, this.otherAttributes); }
public QName getQName() { return new QName(this.getNamespace().getDecoded(), this.getXmlId().getDecoded()); }
@POST @Path("namespace") @Consumes(MediaType.APPLICATION_JSON) public Response putNamespace(RenameApiData data) { DefinitionsChildId newId = BackendUtils.getDefinitionsChildId(this.getId().getClass(), data.namespace, this.getId().getXmlId().getDecoded(), false); return RestUtils.rename(this.getId(), newId).getResponse(); }
public QNameApiData(DefinitionsChildId newId) { this.localname = newId.getXmlId().getDecoded(); this.namespace = newId.getNamespace().getDecoded(); } }
private void checkId(DefinitionsChildId id) { checkNamespaceUri(id); checkNcname(id, id.getXmlId().getDecoded()); }
@Override public String getName() { String name = this.getServiceTemplate().getName(); if (name == null) { // place default name = this.getId().getXmlId().getDecoded(); } return name; }
@Override public String getName() { String name = this.getCompliancerule().getName(); if (name == null) { // place default name = this.getId().getXmlId().getDecoded(); } return name; }
@Override public String getName() { String name = this.getTRefinementModel().getName(); if (name == null) { // place default name = this.getId().getXmlId().getDecoded(); } return name; }
/** * Copies the given id resource to the appropriate fields in the element. * <p> * For instance, the id is put in the "name" field for EntityTypes */ public static void copyIdToFields(HasIdInIdOrNameField element, DefinitionsChildId id) { element.setId(id.getXmlId().getDecoded()); if (element instanceof HasTargetNamespace) { ((HasTargetNamespace) element).setTargetNamespace(id.getNamespace().getDecoded()); } // Required for creating a new version in order to also update the name if (element instanceof HasName) { ((HasName) element).setName(id.getXmlId().getDecoded()); } }
public String getColor() { return RestUtils.getColor(this.getId().getParent().getXmlId().getDecoded(), QNames.QNAME_COLOR, this.otherAttributes); }
/** * Generates a unique and valid name to be used for the generated maven project name, java project name, class name, * port type name. */ private String generateName(EntityTypeId typeId, String interfaceName) { String name = Util.namespaceToJavaPackage(typeId.getNamespace().getDecoded()); name += Util.FORBIDDEN_CHARACTER_REPLACEMENT; // Winery already ensures that this is a valid NCName // getName() returns the id of the nodeType: A nodeType carries the "id" attribute only (and no name attribute) name += VersionUtils.getNameWithoutVersion(typeId.getXmlId().getDecoded()); // Two separators to distinguish node type and interface part name += Util.FORBIDDEN_CHARACTER_REPLACEMENT; name += Util.FORBIDDEN_CHARACTER_REPLACEMENT; name += Util.namespaceToJavaPackage(interfaceName); // In addition we must replace '.', because Java class names must not // contain dots, but for Winery they are fine. return name.replace(".", Util.FORBIDDEN_CHARACTER_REPLACEMENT); }
public static ResourceResult duplicate(DefinitionsChildId oldComponent, DefinitionsChildId newComponent) { ResourceResult result = create(newComponent, newComponent.getXmlId().getDecoded()); if (result.isSuccess()) { // After successful creation of the new component, copy all files from old version to new version IRepository repository = RepositoryFactory.getRepository(); try { repository.duplicate(oldComponent, newComponent); } catch (IOException e) { result.setStatus(Status.INTERNAL_SERVER_ERROR); } } return result; }
/** * @param oldId the old id * @param newId the new id */ @Override public void rename(DefinitionsChildId oldId, DefinitionsChildId newId) throws IOException { String pathFragment = IdUtil.getURLPathFragment(oldId); NamespaceAndIdAsString namespaceAndIdAsString = new NamespaceAndIdAsString(); namespaceAndIdAsString.namespace = newId.getNamespace().getDecoded(); namespaceAndIdAsString.id = newId.getXmlId().getDecoded(); for (WebResource wr: this.repositoryResources) { // TODO: Check whether namespaceAndIdAsString is the correct data type expected at the resource ClientResponse response = wr.path(pathFragment).path("id").post(ClientResponse.class, namespaceAndIdAsString); if ((response.getClientResponseStatus() != ClientResponse.Status.NO_CONTENT) || (response.getClientResponseStatus() != ClientResponse.Status.NOT_FOUND)) { LOGGER.debug(String.format("Error %d when renaming DefinitionsChildId %s to %s at %s", response.getStatus(), oldId.toString(), newId.toString(), wr.getURI().toString())); } } }