Search in sources :

Example 1 with GPWebServiceMapData

use of org.geosdi.geoplatform.response.collection.GPWebServiceMapData in project geo-platform by geosdi.

the class DeleteTreeElementCommand method execute.

@Override
public DeleteTreeElementResponse execute(DeleteTreeElementRequest request, HttpServletRequest httpServletRequest) {
    logger.debug("##################### Executing {} Command", this.getClass().getSimpleName());
    MementoSaveRemove memento = request.getMemento();
    Preconditions.checkNotNull(memento, "The MementoSaveRemove must not be " + "null.");
    try {
        this.sessionUtility.getLoggedAccount(httpServletRequest);
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    }
    GPWebServiceMapData map = this.dtoMementoConverter.convertDescendantMap(memento.getWsDescendantMap());
    boolean result = false;
    switch(request.getElementType()) {
        case COMPOSITE:
            try {
                result = this.geoPlatformServiceClient.saveDeletedFolderAndTreeModifications(new WSDeleteFolderAndTreeModifications(memento.getIdBaseElement(), map));
            } catch (ResourceNotFoundFault ex) {
                logger.error("Failed to Delete Folder Element : " + ex);
                throw new GeoPlatformException(ex);
            }
            break;
        case LEAF:
            try {
                result = this.geoPlatformServiceClient.saveDeletedLayerAndTreeModifications(new WSDeleteLayerAndTreeModificationsRequest(memento.getIdBaseElement(), map));
            } catch (ResourceNotFoundFault ex) {
                logger.error("Failed to Delete Layer Element : " + ex);
                throw new GeoPlatformException(ex);
            }
            break;
    }
    return new DeleteTreeElementResponse(result);
}
Also used : DeleteTreeElementResponse(org.geosdi.geoplatform.gui.client.command.memento.toolbar.DeleteTreeElementResponse) WSDeleteLayerAndTreeModificationsRequest(org.geosdi.geoplatform.request.layer.WSDeleteLayerAndTreeModificationsRequest) GPWebServiceMapData(org.geosdi.geoplatform.response.collection.GPWebServiceMapData) WSDeleteFolderAndTreeModifications(org.geosdi.geoplatform.request.folder.WSDeleteFolderAndTreeModifications) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) MementoSaveRemove(org.geosdi.geoplatform.gui.client.model.memento.save.bean.MementoSaveRemove)

Example 2 with GPWebServiceMapData

use of org.geosdi.geoplatform.response.collection.GPWebServiceMapData in project geo-platform by geosdi.

the class LayerService method saveDragAndDropFolderAndTreeModifications.

@Override
public boolean saveDragAndDropFolderAndTreeModifications(MementoSaveDragDrop memento, HttpServletRequest httpServletRequest) throws GeoPlatformException {
    GPWebServiceMapData map = this.dtoMementoConverter.convertDescendantMap(memento.getWsDescendantMap());
    boolean result;
    try {
        this.sessionUtility.getLoggedAccount(httpServletRequest);
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    }
    try {
        result = this.geoPlatformServiceClient.saveDragAndDropFolderAndTreeModifications(new WSDDFolderAndTreeModifications(memento.getIdBaseElement(), memento.getIdNewParent(), memento.getNewZIndex(), map));
    } catch (ResourceNotFoundFault ex) {
        this.logger.error("Failed to save folder drag&drop on LayerService: " + ex);
        throw new GeoPlatformException(ex);
    }
    return result;
}
Also used : WSDDFolderAndTreeModifications(org.geosdi.geoplatform.request.folder.WSDDFolderAndTreeModifications) GPWebServiceMapData(org.geosdi.geoplatform.response.collection.GPWebServiceMapData) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 3 with GPWebServiceMapData

use of org.geosdi.geoplatform.response.collection.GPWebServiceMapData in project geo-platform by geosdi.

the class LayerService method saveAddedFolderAndTreeModifications.

@Override
public Long saveAddedFolderAndTreeModifications(MementoSaveAddedFolder memento, HttpServletRequest httpServletRequest) throws GeoPlatformException {
    try {
        this.sessionUtility.getLoggedAccount(httpServletRequest);
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    }
    GPWebServiceMapData map = this.dtoMementoConverter.convertDescendantMap(memento.getWsDescendantMap());
    Long idSavedFolder;
    try {
        Long projectId = this.sessionUtility.getDefaultProject(httpServletRequest);
        GPFolder gpFolder = this.dtoLayerConverter.convertMementoFolder(memento.getAddedFolder());
        idSavedFolder = this.geoPlatformServiceClient.saveAddedFolderAndTreeModifications(new WSAddFolderAndTreeModificationsRequest(projectId, memento.getAddedFolder().getIdParent(), gpFolder, map));
    } catch (ResourceNotFoundFault ex) {
        this.logger.error("Failed to save folder on LayerService: " + ex);
        throw new GeoPlatformException(ex);
    } catch (IllegalParameterFault ilg) {
        logger.error("Error on LayerService: " + ilg);
        throw new GeoPlatformException("Parameter incorrect on saveAddedFolderAndTreeModifications");
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    } catch (Exception ex) {
        throw new GeoPlatformException(ex.getMessage());
    }
    return idSavedFolder;
}
Also used : GPFolder(org.geosdi.geoplatform.core.model.GPFolder) WSAddFolderAndTreeModificationsRequest(org.geosdi.geoplatform.request.folder.WSAddFolderAndTreeModificationsRequest) IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) GPWebServiceMapData(org.geosdi.geoplatform.response.collection.GPWebServiceMapData) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Example 4 with GPWebServiceMapData

use of org.geosdi.geoplatform.response.collection.GPWebServiceMapData in project geo-platform by geosdi.

the class LayerService method saveDeletedLayerAndTreeModifications.

@Override
@Deprecated
public boolean saveDeletedLayerAndTreeModifications(MementoSaveRemove memento, HttpServletRequest httpServletRequest) throws GeoPlatformException {
    try {
        this.sessionUtility.getLoggedAccount(httpServletRequest);
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    }
    GPWebServiceMapData map = this.dtoMementoConverter.convertDescendantMap(memento.getWsDescendantMap());
    boolean result;
    try {
        result = this.geoPlatformServiceClient.saveDeletedLayerAndTreeModifications(new WSDeleteLayerAndTreeModificationsRequest(memento.getIdBaseElement(), map));
    } catch (ResourceNotFoundFault ex) {
        this.logger.error("Failed to delete layer on LayerService: " + ex);
        throw new GeoPlatformException(ex);
    }
    return result;
}
Also used : WSDeleteLayerAndTreeModificationsRequest(org.geosdi.geoplatform.request.layer.WSDeleteLayerAndTreeModificationsRequest) GPWebServiceMapData(org.geosdi.geoplatform.response.collection.GPWebServiceMapData) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 5 with GPWebServiceMapData

use of org.geosdi.geoplatform.response.collection.GPWebServiceMapData in project geo-platform by geosdi.

the class SaveAddedFolderAndTreeModificationsCommand method execute.

@Override
public SaveAddedFolderAndTreeModificationsResponse execute(SaveAddedFolderAndTreeModificationsRequest request, HttpServletRequest httpServletRequest) {
    logger.debug("##################### Executing {} Command", this.getClass().getSimpleName());
    MementoSaveAddedFolder memento = request.getMemento();
    checkNotNull(memento, "MementoSaveAddedFolder must not be null.");
    try {
        this.sessionUtility.getLoggedAccount(httpServletRequest);
        GPFolder gpFolder = this.dtoLayerConverter.convertMementoFolder(memento.getAddedFolder());
        GPWebServiceMapData map = this.dtoMementoConverter.convertDescendantMap(memento.getWsDescendantMap());
        Long projectId = this.sessionUtility.getDefaultProject(httpServletRequest);
        Long idSavedFolder = this.geoPlatformServiceClient.saveAddedFolderAndTreeModifications(new WSAddFolderAndTreeModificationsRequest(projectId, memento.getAddedFolder().getIdParent(), gpFolder, map));
        logger.debug("\n\n@@@@@@@@@@@@@@@@SaveAddedFolderAndTreeModificationsCommand");
        return new SaveAddedFolderAndTreeModificationsResponse(idSavedFolder);
    } catch (ResourceNotFoundFault ex) {
        logger.error("Failed to save folder on LayerService: " + ex);
        throw new GeoPlatformException(ex);
    } catch (IllegalParameterFault ilg) {
        logger.error("Error on LayerService: " + ilg);
        throw new GeoPlatformException("Parameter incorrect on saveAddedFolderAndTreeModifications");
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new GeoPlatformException(ex.getMessage());
    }
}
Also used : GPFolder(org.geosdi.geoplatform.core.model.GPFolder) WSAddFolderAndTreeModificationsRequest(org.geosdi.geoplatform.request.folder.WSAddFolderAndTreeModificationsRequest) IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) GPWebServiceMapData(org.geosdi.geoplatform.response.collection.GPWebServiceMapData) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) SaveAddedFolderAndTreeModificationsResponse(org.geosdi.geoplatform.gui.client.command.memento.toolbar.SaveAddedFolderAndTreeModificationsResponse) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) MementoSaveAddedFolder(org.geosdi.geoplatform.gui.client.model.memento.save.bean.MementoSaveAddedFolder) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Aggregations

GPWebServiceMapData (org.geosdi.geoplatform.response.collection.GPWebServiceMapData)45 Test (org.junit.Test)26 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)16 HashMap (java.util.HashMap)14 WSDDFolderAndTreeModifications (org.geosdi.geoplatform.request.folder.WSDDFolderAndTreeModifications)12 IllegalParameterFault (org.geosdi.geoplatform.exception.IllegalParameterFault)11 GPFolder (org.geosdi.geoplatform.core.model.GPFolder)9 GeoPlatformException (org.geosdi.geoplatform.gui.global.GeoPlatformException)9 GPSessionTimeout (org.geosdi.geoplatform.gui.utility.GPSessionTimeout)9 WSAddFolderAndTreeModificationsRequest (org.geosdi.geoplatform.request.folder.WSAddFolderAndTreeModificationsRequest)6 WSDeleteFolderAndTreeModifications (org.geosdi.geoplatform.request.folder.WSDeleteFolderAndTreeModifications)6 WSAddLayerAndTreeModificationsRequest (org.geosdi.geoplatform.request.layer.WSAddLayerAndTreeModificationsRequest)6 WSDDLayerAndTreeModificationsRequest (org.geosdi.geoplatform.request.layer.WSDDLayerAndTreeModificationsRequest)6 WSAddLayersAndTreeModificationsRequest (org.geosdi.geoplatform.request.layer.WSAddLayersAndTreeModificationsRequest)5 WSDeleteLayerAndTreeModificationsRequest (org.geosdi.geoplatform.request.layer.WSDeleteLayerAndTreeModificationsRequest)4 ClientErrorException (javax.ws.rs.ClientErrorException)3 NotFoundException (javax.ws.rs.NotFoundException)3 GPLayer (org.geosdi.geoplatform.core.model.GPLayer)2 GPProject (org.geosdi.geoplatform.core.model.GPProject)2 FolderDTO (org.geosdi.geoplatform.response.FolderDTO)2