summaryrefslogtreecommitdiffstats
path: root/gui-editors/gui-editor-apex
diff options
context:
space:
mode:
Diffstat (limited to 'gui-editors/gui-editor-apex')
-rw-r--r--gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/ApexEditorRestResource.java8
-rw-r--r--gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/plugin/upload/PolicyUploadHandler.java2
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js2
3 files changed, 9 insertions, 3 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/ApexEditorRestResource.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/ApexEditorRestResource.java
index ba3d5e7..dc27d49 100644
--- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/ApexEditorRestResource.java
+++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/ApexEditorRestResource.java
@@ -32,9 +32,11 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
+import org.apache.commons.lang3.StringUtils;
import org.onap.policy.apex.model.modelapi.ApexApiResult;
import org.onap.policy.apex.model.modelapi.ApexApiResult.Result;
import org.onap.policy.common.utils.resources.TextFileUtils;
+import org.onap.policy.gui.editors.apex.rest.ApexEditorMain;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -229,11 +231,15 @@ public class ApexEditorRestResource implements RestCommandHandler {
/**
* Uploads a TOSCA Policy Model to a configured endpoint.
*
+ * @param userid the userid to use for upload
* @return an ApexAPIResult that contains the operation status and success/error messages
*/
@GET
@Path("Model/Upload")
- public ApexApiResult uploadModel() {
+ public ApexApiResult uploadModel(@QueryParam("userId") final String userid) {
+ if (!StringUtils.isBlank(userid)) {
+ ApexEditorMain.getParameters().setUploadUserid(userid);
+ }
return processRestCommand(RestCommandType.MODEL, RestCommand.UPLOAD);
}
diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/plugin/upload/PolicyUploadHandler.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/plugin/upload/PolicyUploadHandler.java
index 5e3cf56..6d8b803 100644
--- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/plugin/upload/PolicyUploadHandler.java
+++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/plugin/upload/PolicyUploadHandler.java
@@ -56,7 +56,7 @@ public class PolicyUploadHandler {
if (StringUtils.isBlank(ApexEditorMain.getParameters().getUploadUrl())) {
final ApexApiResult apexApiResult = new ApexApiResult(Result.FAILED);
- apexApiResult.addMessage("Model download is disabled, parameter upload-url is not set on server");
+ apexApiResult.addMessage("Model upload is disabled, parameter upload-url is not set on server");
LOGGER.exit(MODEL_UPLOAD_NOT_OK);
return apexApiResult;
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js
index a8726e7..93b1183 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js
@@ -51,7 +51,7 @@ function files_fileDownload() {
}
function files_fileUpload() {
- var requestURL = restRootURL + "/Model/Upload";
+ var requestURL = restRootURL + "/Model/Upload?userId=" + new URLSearchParams(window.location.search).get('userId');
ajax_getOKOrFail(requestURL, function(data) {
var uploadResultString = "";