Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
core
Commits
972f9788
Commit
972f9788
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
methods retrieving data as images models renamed
parent
8bb34112
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!11
Resolve "Rest API should follow google guidlines"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend-js/src/main/js/ServerConnector.js
+47
-65
47 additions, 65 deletions
frontend-js/src/main/js/ServerConnector.js
rest-api/src/main/java/lcsb/mapviewer/api/projects/ProjectController.java
+34
-19
34 additions, 19 deletions
...n/java/lcsb/mapviewer/api/projects/ProjectController.java
with
81 additions
and
84 deletions
frontend-js/src/main/js/ServerConnector.js
+
47
−
65
View file @
972f9788
...
...
@@ -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
)
{
p
arams
.
projectId
=
result
;
queryP
arams
.
projectId
=
result
;
return
self
.
getToken
();
}).
then
(
function
(
token
)
{
p
arams
.
token
=
token
;
return
self
.
getImageUrl
(
p
arams
);
filterP
arams
.
token
=
token
;
return
self
.
getImageUrl
(
queryParams
,
filterP
arams
);
});
};
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
)
{
p
arams
.
projectId
=
result
;
queryP
arams
.
projectId
=
result
;
return
self
.
getToken
();
}).
then
(
function
(
token
)
{
p
arams
.
token
=
token
;
return
self
.
getModelPartUrl
(
p
arams
);
filterP
arams
.
token
=
token
;
return
self
.
getModelPartUrl
(
queryParams
,
filterP
arams
);
});
};
...
...
@@ -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
)
{
p
arams
.
projectId
=
result
;
queryP
arams
.
projectId
=
result
;
return
self
.
getToken
();
}).
then
(
function
(
token
)
{
p
arams
.
token
=
token
;
return
self
.
getProjectSourceUrl
(
p
arams
);
filterP
arams
.
token
=
token
;
return
self
.
getProjectSourceUrl
(
queryParams
,
filterP
arams
);
});
};
...
...
This diff is collapsed.
Click to expand it.
rest-api/src/main/java/lcsb/mapviewer/api/projects/ProjectController.java
+
34
−
19
View file @
972f9788
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment