Search in sources :

Example 1 with ManageViewportRequest

use of org.geosdi.geoplatform.request.viewport.ManageViewportRequest in project geo-platform by geosdi.

the class RSViewportTest method replaceViewportListTestRest.

@Test
public void replaceViewportListTestRest() throws Exception {
    Collection<GPViewport> viewports = super.createMassiveViewports();
    gpWSClient.saveOrUpdateViewportList(new ManageViewportRequest(idAccountProject, new ArrayList<>(viewports)));
    Assert.assertEquals(80, gpWSClient.getAccountProjectViewports(idAccountProject).getViewports().size());
    gpWSClient.replaceViewportList(new ManageViewportRequest(idAccountProject, new ArrayList<>(createViewportListToReplace())));
    Collection<GPViewport> viewportsReplacedFound = gpWSClient.getAccountProjectViewports(idAccountProject).getViewports();
    Assert.assertEquals(20, viewportsReplacedFound.size());
    logger.trace("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ COLLECTION_" + "VIEWPORT_REPLACED : {}", viewportsReplacedFound);
}
Also used : GPViewport(org.geosdi.geoplatform.core.model.GPViewport) ManageViewportRequest(org.geosdi.geoplatform.request.viewport.ManageViewportRequest) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with ManageViewportRequest

use of org.geosdi.geoplatform.request.viewport.ManageViewportRequest in project geo-platform by geosdi.

the class MapService method replaceViewportList.

@Override
public void replaceViewportList(List<GPClientViewport> viewportList, HttpServletRequest httpServletRequest) throws GeoPlatformException {
    GPAccount account;
    Long projectID;
    try {
        account = this.sessionUtility.getLoggedAccount(httpServletRequest);
        projectID = this.sessionUtility.getDefaultProject(httpServletRequest);
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    }
    try {
        GPAccountProject accountProject = this.geoPlatformServiceClient.getAccountProjectByAccountAndProjectIDs(account.getId(), projectID);
        this.geoPlatformServiceClient.replaceViewportList(new ManageViewportRequest(accountProject.getId(), convertClientViewportToDTO(viewportList)));
    } catch (ResourceNotFoundFault | IllegalParameterFault rnff) {
        logger.error("Error on MapService: " + rnff);
        throw new GeoPlatformException(rnff);
    }
}
Also used : GPAccount(org.geosdi.geoplatform.core.model.GPAccount) GPAccountProject(org.geosdi.geoplatform.core.model.GPAccountProject) IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) ManageViewportRequest(org.geosdi.geoplatform.request.viewport.ManageViewportRequest) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 3 with ManageViewportRequest

use of org.geosdi.geoplatform.request.viewport.ManageViewportRequest in project geo-platform by geosdi.

the class RSViewportTest method insertMassiveViewportTestRest.

@Test
public void insertMassiveViewportTestRest() throws Exception {
    Collection<GPViewport> viewports = super.createMassiveViewports();
    gpWSClient.saveOrUpdateViewportList(new ManageViewportRequest(idAccountProject, new ArrayList<>(viewports)));
    Collection<GPViewport> viewportsFound = gpWSClient.getAccountProjectViewports(idAccountProject).getViewports();
    logger.trace("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@FOUND {} " + "@@@@@@@@@@@@@@@@@@@@@@@@@\n\n", viewportsFound);
    Assert.assertEquals(80, viewportsFound.size());
    GPViewport defaultVieport = gpWSClient.getDefaultViewport(idAccountProject);
    logger.trace("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@DEFAULT_VIEWPORT " + "Found : {}@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\n", defaultVieport);
    Assert.assertEquals("Viewport0-Rest", defaultVieport.getName());
    Assert.assertEquals(0.0, defaultVieport.getZoomLevel(), 0.0);
}
Also used : GPViewport(org.geosdi.geoplatform.core.model.GPViewport) ManageViewportRequest(org.geosdi.geoplatform.request.viewport.ManageViewportRequest) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

ManageViewportRequest (org.geosdi.geoplatform.request.viewport.ManageViewportRequest)3 ArrayList (java.util.ArrayList)2 GPViewport (org.geosdi.geoplatform.core.model.GPViewport)2 Test (org.junit.Test)2 GPAccount (org.geosdi.geoplatform.core.model.GPAccount)1 GPAccountProject (org.geosdi.geoplatform.core.model.GPAccountProject)1 IllegalParameterFault (org.geosdi.geoplatform.exception.IllegalParameterFault)1 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)1 GeoPlatformException (org.geosdi.geoplatform.gui.global.GeoPlatformException)1 GPSessionTimeout (org.geosdi.geoplatform.gui.utility.GPSessionTimeout)1