Skip to content
Snippets Groups Projects
Commit 972f9788 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

methods retrieving data as images models renamed

parent 8bb34112
No related branches found
No related tags found
1 merge request!11Resolve "Rest API should follow google guidlines"
......@@ -505,69 +505,24 @@ ServerConnector.getOverlaySourceUrl = function(queryParams, filterParams) {
});
};
ServerConnector.getImageUrl = function(params) {
var projectId = params.projectId;
var token = params.token;
var polygonString = params.polygonString;
var modelId = params.modelId;
var handlerClass = params.handlerClass;
var backgroundOverlayId = params.backgroundOverlayId;
var zoomLevel = params.zoomLevel;
var overlayIds = this.idsToString(params.overlayIds);
ServerConnector.getImageUrl = function(queryParams, filterParams) {
return this.getApiUrl({
type : "project",
method : "getModelAsImage",
params : {
polygonString : polygonString,
modelId : modelId,
handlerClass : handlerClass,
backgroundOverlayId : backgroundOverlayId,
zoomLevel : zoomLevel,
overlayIds : overlayIds,
projectId : projectId,
token : token,
},
});
};
ServerConnector.getModelPartUrl = function(params) {
var projectId = params.projectId;
var token = params.token;
var polygonString = params.polygonString;
var modelId = params.modelId;
var handlerClass = params.handlerClass;
var backgroundOverlayId = params.backgroundOverlayId;
var zoomLevel = params.zoomLevel;
var overlayIds = this.idsToString(params.overlayIds);
url : this.getProjectsUrl(queryParams) + "models/" + queryParams.modelId + ":downloadImage",
params : filterParams,
});
};
ServerConnector.getModelPartUrl = function(queryParams, filterParams) {
return this.getApiUrl({
type : "project",
method : "getModelAsModelFile",
params : {
polygonString : polygonString,
modelId : modelId,
handlerClass : handlerClass,
backgroundOverlayId : backgroundOverlayId,
zoomLevel : zoomLevel,
overlayIds : overlayIds,
projectId : projectId,
token : token,
},
url : this.getProjectsUrl(queryParams) + "models/" + queryParams.modelId + ":downloadModel",
params : filterParams,
});
};
ServerConnector.getProjectSourceUrl = function(params) {
var projectId = params.projectId;
var token = params.token;
ServerConnector.getProjectSourceUrl = function(queryParams, filterParams) {
return this.getApiUrl({
type : "project",
method : "getProjectSource",
params : {
projectId : projectId,
token : token
},
type : "projects/" + queryParams.projectId + ":downloadSource",
params : filterParams
});
};
......@@ -1034,23 +989,48 @@ ServerConnector.getOverlaySourceDownloadUrl = function(params) {
ServerConnector.getImageDownloadUrl = function(params) {
var self = this;
var queryParams = {
projectId : params.projectId,
modelId : params.modelId,
};
var filterParams = {
token : params.token,
polygonString : params.polygonString,
handlerClass : params.handlerClass,
backgroundOverlayId : params.backgroundOverlayId,
zoomLevel : params.zoomLevel,
overlayIds : this.idsToString(params.overlayIds),
};
return self.getProjectId(params.projectId).then(function(result) {
params.projectId = result;
queryParams.projectId = result;
return self.getToken();
}).then(function(token) {
params.token = token;
return self.getImageUrl(params);
filterParams.token = token;
return self.getImageUrl(queryParams, filterParams);
});
};
ServerConnector.getModelDownloadUrl = function(params) {
var self = this;
var queryParams = {
projectId : params.projectId,
modelId : params.modelId,
};
var filterParams = {
token : params.token,
polygonString : params.polygonString,
handlerClass : params.handlerClass,
backgroundOverlayId : params.backgroundOverlayId,
zoomLevel : params.zoomLevel,
overlayIds : this.idsToString(params.overlayIds),
};
return self.getProjectId(params.projectId).then(function(result) {
params.projectId = result;
queryParams.projectId = result;
return self.getToken();
}).then(function(token) {
params.token = token;
return self.getModelPartUrl(params);
filterParams.token = token;
return self.getModelPartUrl(queryParams, filterParams);
});
};
......@@ -1071,13 +1051,15 @@ ServerConnector.getProjectSourceDownloadUrl = function(params) {
if (params === undefined) {
params = {};
}
var queryParams = {};
var filterParams = {};
var self = this;
return self.getProjectId(params.projectId).then(function(result) {
params.projectId = result;
queryParams.projectId = result;
return self.getToken();
}).then(function(token) {
params.token = token;
return self.getProjectSourceUrl(params);
filterParams.token = token;
return self.getProjectSourceUrl(queryParams, filterParams);
});
};
......
......@@ -26,14 +26,18 @@ public class ProjectController extends BaseController {
private ProjectRestImpl projectController;
@RequestMapping(value = "/projects/{projectId}", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public ProjectMetaData getMetaData(@PathVariable(value = "projectId") String projectId, @RequestParam(value = "token") String token)
throws SecurityException {
public ProjectMetaData getMetaData(//
@PathVariable(value = "projectId") String projectId, //
@RequestParam(value = "token") String token //
) throws SecurityException {
return projectController.getMetaData(projectId, token);
}
@RequestMapping(value = "/project/getProjectSource", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<byte[]> getProjectSource(@RequestParam(value = "token") String token, @RequestParam(value = "projectId") String projectId)
throws SecurityException, QueryException {
@RequestMapping(value = "/projects/{projectId}:downloadSource", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<byte[]> getProjectSource(//
@RequestParam(value = "token") String token, //
@PathVariable(value = "projectId") String projectId //
) throws SecurityException, QueryException {
FileEntry file = projectController.getSource(token, projectId);
MediaType type = MediaType.TEXT_PLAIN;
......@@ -47,13 +51,18 @@ public class ProjectController extends BaseController {
.body(file.getFileContent());
}
@RequestMapping(value = "/project/getModelAsImage", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<byte[]> getModelAsImage(@RequestParam(value = "token") String token, @RequestParam(value = "projectId") String projectId,
@RequestParam(value = "modelId") String modelId, @RequestParam(value = "handlerClass") String handlerClass,
@RequestParam(value = "backgroundOverlayId", defaultValue = "") String backgroundOverlayId,
@RequestParam(value = "overlayIds", defaultValue = "") String overlayIds, @RequestParam(value = "zoomLevel", defaultValue = "") String zoomLevel,
@RequestParam(value = "polygonString", defaultValue = "") String polygonString)
throws SecurityException, QueryException, IOException, InvalidColorSchemaException, CommandExecutionException {
@RequestMapping(value = "/projects/{projectId}/models/{modelId}:downloadImage", method = { RequestMethod.GET },
produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<byte[]> getModelAsImage(//
@RequestParam(value = "token") String token, //
@PathVariable(value = "projectId") String projectId, //
@PathVariable(value = "modelId") String modelId, //
@RequestParam(value = "handlerClass") String handlerClass, //
@RequestParam(value = "backgroundOverlayId", defaultValue = "") String backgroundOverlayId, //
@RequestParam(value = "overlayIds", defaultValue = "") String overlayIds, //
@RequestParam(value = "zoomLevel", defaultValue = "") String zoomLevel, //
@RequestParam(value = "polygonString", defaultValue = "") String polygonString//
) throws SecurityException, QueryException, IOException, InvalidColorSchemaException, CommandExecutionException {
FileEntry file = projectController.getModelAsImage(token, projectId, modelId, handlerClass, backgroundOverlayId, overlayIds, zoomLevel, polygonString);
MediaType type = MediaType.APPLICATION_OCTET_STREAM;
......@@ -62,13 +71,19 @@ public class ProjectController extends BaseController {
.body(file.getFileContent());
}
@RequestMapping(value = "/project/getModelAsModelFile", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<byte[]> getModelAsModelFile(@RequestParam(value = "token") String token, @RequestParam(value = "projectId") String projectId,
@RequestParam(value = "modelId") String modelId, @RequestParam(value = "handlerClass") String handlerClass,
@RequestParam(value = "backgroundOverlayId", defaultValue = "") String backgroundOverlayId,
@RequestParam(value = "overlayIds", defaultValue = "") String overlayIds, @RequestParam(value = "zoomLevel", defaultValue = "") String zoomLevel,
@RequestParam(value = "polygonString") String polygonString) throws SecurityException, QueryException, IOException, InvalidColorSchemaException,
CommandExecutionException, ConverterException, InconsistentModelException {
@RequestMapping(value = "/projects/{projectId}/models/{modelId}:downloadModel", method = { RequestMethod.GET },
produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<byte[]> getModelAsModelFile(//
@RequestParam(value = "token") String token, //
@PathVariable(value = "projectId") String projectId, //
@PathVariable(value = "modelId") String modelId, //
@RequestParam(value = "handlerClass") String handlerClass, //
@RequestParam(value = "backgroundOverlayId", defaultValue = "") String backgroundOverlayId, //
@RequestParam(value = "overlayIds", defaultValue = "") String overlayIds, //
@RequestParam(value = "zoomLevel", defaultValue = "") String zoomLevel, //
@RequestParam(value = "polygonString") String polygonString//
) throws SecurityException, QueryException, IOException, InvalidColorSchemaException, CommandExecutionException, ConverterException,
InconsistentModelException {
FileEntry file = projectController.getModelAsModelFile(token, projectId, modelId, handlerClass, backgroundOverlayId, overlayIds, zoomLevel, polygonString);
MediaType type = MediaType.APPLICATION_OCTET_STREAM;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment