use of org.geosdi.geoplatform.core.model.GPViewport in project geo-platform by geosdi.
the class MapService method convertServerViewportToDTO.
private List<GPClientViewport> convertServerViewportToDTO(Collection<GPViewport> viewportCollection) {
List<GPClientViewport> clientViewportList = Lists.<GPClientViewport>newArrayList();
GPClientViewport clientViewport;
GPBBox serverBBOX;
BBoxClientInfo clientBBOX;
if (viewportCollection != null) {
for (GPViewport viewport : viewportCollection) {
serverBBOX = viewport.getBbox();
clientBBOX = new BBoxClientInfo(serverBBOX.getMinX(), serverBBOX.getMinY(), serverBBOX.getMaxX(), serverBBOX.getMaxY());
clientViewport = new GPClientViewport(viewport.getName(), viewport.getDescription(), clientBBOX, viewport.getZoomLevel(), viewport.isIsDefault());
clientViewportList.add(clientViewport);
}
}
return clientViewportList;
}
use of org.geosdi.geoplatform.core.model.GPViewport in project geo-platform by geosdi.
the class GPViewportDelegate method replaceViewportList.
@Override
public void replaceViewportList(ManageViewportRequest request) throws ResourceNotFoundFault, IllegalParameterFault {
if (request == null) {
throw new IllegalParameterFault("The ManageViewportRequest must " + "not be null.");
}
Long accountProjectID = request.getAccountProjectID();
ArrayList<GPViewport> viewportList = request.getViewportList();
GPAccountProject accountProject = this.accountProjectDao.find(accountProjectID);
if (accountProject == null) {
throw new ResourceNotFoundFault("AccountProject not found", accountProjectID);
}
List<GPViewport> oldViewportList = this.viewportDao.findByAccountProjectID(accountProjectID);
for (GPViewport viewport : oldViewportList) {
this.viewportDao.removeById(viewport.getId());
}
if (viewportList != null) {
for (GPViewport viewport : viewportList) {
this.insertViewport(accountProjectID, viewport);
}
}
}
use of org.geosdi.geoplatform.core.model.GPViewport in project geo-platform by geosdi.
the class GPViewportDelegate method deleteViewport.
@Override
public Boolean deleteViewport(Long viewportID) throws ResourceNotFoundFault {
GPViewport viewport = viewportDao.find(viewportID);
if (viewport == null) {
throw new ResourceNotFoundFault("Viewport not found", viewportID);
}
// TODO assert
EntityCorrectness.checkViewportLog(viewport);
return viewportDao.removeById(viewport.getId());
}
use of org.geosdi.geoplatform.core.model.GPViewport in project geo-platform by geosdi.
the class RSViewportTest method updateViewportTestRest.
@Test
public void updateViewportTestRest() throws Exception {
Long idViewportDefault = gpWSClient.insertViewport(new InsertViewportRequest(idAccountProject, new GPViewport("Viewport-To-Save-RS", "This is the viewport to save", 22, new GPBBox(10, 10, 20, 20), Boolean.TRUE)));
Assert.assertNotNull(idViewportDefault);
Long idViewport = gpWSClient.insertViewport(new InsertViewportRequest(idAccountProject, new GPViewport("Viewport-To-Save-New-RS", "This is the viewport to save New", 18, new GPBBox(18, 20, 40, 29), Boolean.FALSE)));
Assert.assertNotNull(idViewport);
Long idViewport1 = gpWSClient.insertViewport(new InsertViewportRequest(idAccountProject, new GPViewport("Viewport-To-Save-New-1-RS", "This is the viewport to save New", 31, new GPBBox(21, 33, 50, 79), Boolean.FALSE)));
Assert.assertNotNull(idViewport1);
Collection<GPViewport> viewports = gpWSClient.getAccountProjectViewports(idAccountProject).getViewports();
Assert.assertEquals(3, viewports.size());
GPViewport viewport = gpWSClient.getDefaultViewport(idAccountProject);
Assert.assertEquals(Boolean.TRUE, viewport.isIsDefault());
Assert.assertEquals("Viewport-To-Save-RS", viewport.getName());
viewport.setName("Viewport-Updated-RS");
viewport.setDescription("New Description");
viewport.setIsDefault(Boolean.FALSE);
gpWSClient.updateViewport(viewport);
GPViewport v = gpWSClient.getViewportById(idViewport1);
v.setIsDefault(Boolean.TRUE);
gpWSClient.updateViewport(v);
GPViewport df = gpWSClient.getDefaultViewport(idAccountProject);
Assert.assertEquals(idViewport1, df.getId());
}
use of org.geosdi.geoplatform.core.model.GPViewport in project geo-platform by geosdi.
the class RSViewportTest method deleteViewportTestRest.
@Test
public void deleteViewportTestRest() throws Exception {
Long idViewport = gpWSClient.insertViewport(new InsertViewportRequest(idAccountProject, new GPViewport("Viewport-To-Delete-RS", "This is the viewport to Delete", 26, new GPBBox(15, 15, 22, 30), Boolean.TRUE)));
Assert.assertNotNull(idViewport);
GPViewport viewport = gpWSClient.getViewportById(idViewport);
Assert.assertNotNull(viewport);
logger.trace("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@VIEWPORT_FOUND :" + " {}\n\n", viewport);
Assert.assertTrue(gpWSClient.deleteViewport(idViewport));
}
Aggregations