-
- private String nodeToString(Node node) throws TransformerException {
- StringWriter sw = new StringWriter();
- Transformer t = TransformerFactory.newInstance().newTransformer();
- t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- t.transform(new DOMSource(node), new StreamResult(sw));
- System.out.println(sw.toString());
- return sw.toString();
- }
-
- private String getURL(ModelArtifact model) {
- String baseURL = config.getAaiBaseUrl().trim();
- String subURL = null;
- String instance = null;
- if (model.getType().equals(ArtifactType.MODEL)) {
- subURL = config.getAaiModelUrl(model.getModelNamespaceVersion()).trim();
- instance = model.getModelInvariantId();
- }
- else {
- subURL = config.getAaiNamedQueryUrl(model.getModelNamespaceVersion()).trim();
- instance = model.getNameVersionId();
- }
-
- if ( (!baseURL.endsWith("/")) && (!subURL.startsWith("/")) ) {
- baseURL = baseURL + "/";
- }
-
- if ( baseURL.endsWith("/") && subURL.startsWith("/") ) {
- baseURL = baseURL.substring(0, baseURL.length()-1);
- }
-
- if (!subURL.endsWith("/")) {
- subURL = subURL + "/";
- }
-
- String url = baseURL + subURL + instance;
- return url;
- }
-
- private String getModelVerURL(ModelArtifact model) {
- String baseURL = config.getAaiBaseUrl().trim();
- String subURL = null;
- String instance = null;
- if (model.getType().equals(ArtifactType.MODEL)) {
- subURL = config.getAaiModelUrl(model.getModelNamespaceVersion()).trim() + model.getModelInvariantId() + AAI_MODEL_VER;
- instance = model.getModelVerId();
- }
- else {
- subURL = config.getAaiNamedQueryUrl(model.getModelNamespaceVersion()).trim();
- instance = model.getNameVersionId();
- }
-
- if ( (!baseURL.endsWith("/")) && (!subURL.startsWith("/")) ) {
- baseURL = baseURL + "/";
- }
-
- if ( baseURL.endsWith("/") && subURL.startsWith("/") ) {
- baseURL = baseURL.substring(0, baseURL.length()-1);
- }
-
- if (!subURL.endsWith("/")) {
- subURL = subURL + "/";
- }
-
- String url = baseURL + subURL + instance;
- return url;
- }
-