use of org.geosdi.geoplatform.core.model.GPViewport in project geo-platform by geosdi.
the class GPViewportDelegate method saveOrUpdateViewportList.
@Override
public void saveOrUpdateViewportList(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);
}
for (GPViewport viewport : viewportList) {
long idViewport = 0;
if (viewport != null && viewport.getId() != null) {
GPViewport orig = viewportDao.find(viewport.getId());
if (orig != null) {
// TODO assert
EntityCorrectness.checkViewport(orig);
viewport.setAccountProject(accountProject);
idViewport = this.updateAndMergeFields(orig, viewport);
}
} else if (idViewport == 0) {
idViewport = this.insertViewport(accountProjectID, viewport);
}
}
}
use of org.geosdi.geoplatform.core.model.GPViewport in project geo-platform by geosdi.
the class GPViewportDelegate method getDefaultViewport.
// <editor-fold defaultstate="collapsed" desc="Viewport">
// =========================================================================
// === Viewport
// =========================================================================
@Override
public GPViewport getDefaultViewport(Long accountProjectID) throws ResourceNotFoundFault {
List<GPViewport> viewportList = viewportDao.findByAccountProjectID(accountProjectID);
if (viewportList == null) {
throw new ResourceNotFoundFault("Viewport not found using the accountProject id", accountProjectID);
}
GPViewport viewport = null;
for (GPViewport viewportElement : viewportList) {
if (viewportElement.isIsDefault()) {
viewport = viewportElement;
break;
}
}
return viewport;
}
use of org.geosdi.geoplatform.core.model.GPViewport 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);
}
Aggregations