Search in sources :

Example 1 with SaveFolderPropertiesResponse

use of org.geosdi.geoplatform.gui.client.command.memento.basic.SaveFolderPropertiesResponse in project geo-platform by geosdi.

the class SaveFolderPropertiesCommand method execute.

@Override
public SaveFolderPropertiesResponse execute(SaveFolderPropertiesRequest request, HttpServletRequest httpServletRequest) {
    logger.info("##################### Executing {} Command", this.getClass().getSimpleName());
    try {
        this.sessionUtility.getLoggedAccount(httpServletRequest);
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    }
    try {
        MementoFolderOriginalProperties memento = request.getMementoFolderOriginalProperties();
        geoPlatformServiceClient.saveFolderProperties(memento.getIdBaseElement(), memento.getName(), memento.isChecked(), memento.isExpanded());
    } catch (ResourceNotFoundFault ex) {
        SaveFolderPropertiesCommand.logger.error("Failed to save folder on LayerService: " + ex);
        throw new GeoPlatformException(ex);
    } catch (IllegalParameterFault ex) {
        SaveFolderPropertiesCommand.logger.error("Failed to save folder on LayerService: " + ex);
        throw new GeoPlatformException(ex);
    }
    logger.debug("#################### After sending project notification");
    return new SaveFolderPropertiesResponse(Boolean.TRUE);
}
Also used : IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) MementoFolderOriginalProperties(org.geosdi.geoplatform.gui.client.model.memento.save.storage.MementoFolderOriginalProperties) SaveFolderPropertiesResponse(org.geosdi.geoplatform.gui.client.command.memento.basic.SaveFolderPropertiesResponse)

Example 2 with SaveFolderPropertiesResponse

use of org.geosdi.geoplatform.gui.client.command.memento.basic.SaveFolderPropertiesResponse in project geo-platform by geosdi.

the class SaveFoldersPropertiesAction method executeSave.

@Override
public void executeSave(final MementoFolderOriginalProperties memento) {
    // Warning: the conversion update the memento fields on the last refBean properties
    memento.convertMementoToWs();
    final SaveFolderPropertiesRequest saveFolderPropertiesRequest = GWT.<SaveFolderPropertiesRequest>create(SaveFolderPropertiesRequest.class);
    saveFolderPropertiesRequest.setMementoFolderOriginalProperties(memento);
    ClientCommandDispatcher.getInstance().execute(new GPClientCommand<SaveFolderPropertiesResponse>() {

        private static final long serialVersionUID = 2964764575887864168L;

        {
            super.setCommandRequest(saveFolderPropertiesRequest);
        }

        @Override
        public void onCommandSuccess(SaveFolderPropertiesResponse response) {
            IMementoSave mementoSave = MementoModuleInjector.MainInjector.getInstance().getMementoSave();
            mementoSave.remove(memento);
            LayoutManager.getInstance().getStatusMap().setStatus(MementoPersistenceConstants.INSTANCE.SaveFoldersPropertiesAction_statusSaveSuccessText(), EnumSearchStatus.STATUS_SEARCH.toString());
            LayerHandlerManager.fireEvent(peekCacheEvent);
        }

        @Override
        public void onCommandFailure(Throwable exception) {
            if (exception.getCause() instanceof GPSessionTimeout) {
                GPHandlerManager.fireEvent(new GPLoginEvent(peekCacheEvent));
            } else {
                LayerHandlerManager.fireEvent(new DisplayLayersProgressBarEvent(false));
                GeoPlatformMessage.errorMessage(MementoPersistenceConstants.INSTANCE.SaveFoldersPropertiesAction_errorSaveFolderTitleText(), MementoPersistenceConstants.INSTANCE.SaveFoldersPropertiesAction_errorSaveFolderBodyText());
            }
        }
    });
}
Also used : GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) SaveFolderPropertiesRequest(org.geosdi.geoplatform.gui.client.command.memento.basic.SaveFolderPropertiesRequest) GPLoginEvent(org.geosdi.geoplatform.gui.impl.map.event.GPLoginEvent) DisplayLayersProgressBarEvent(org.geosdi.geoplatform.gui.puregwt.progressbar.layers.event.DisplayLayersProgressBarEvent) SaveFolderPropertiesResponse(org.geosdi.geoplatform.gui.client.command.memento.basic.SaveFolderPropertiesResponse)

Aggregations

SaveFolderPropertiesResponse (org.geosdi.geoplatform.gui.client.command.memento.basic.SaveFolderPropertiesResponse)2 GPSessionTimeout (org.geosdi.geoplatform.gui.utility.GPSessionTimeout)2 IllegalParameterFault (org.geosdi.geoplatform.exception.IllegalParameterFault)1 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)1 SaveFolderPropertiesRequest (org.geosdi.geoplatform.gui.client.command.memento.basic.SaveFolderPropertiesRequest)1 MementoFolderOriginalProperties (org.geosdi.geoplatform.gui.client.model.memento.save.storage.MementoFolderOriginalProperties)1 GeoPlatformException (org.geosdi.geoplatform.gui.global.GeoPlatformException)1 GPLoginEvent (org.geosdi.geoplatform.gui.impl.map.event.GPLoginEvent)1 DisplayLayersProgressBarEvent (org.geosdi.geoplatform.gui.puregwt.progressbar.layers.event.DisplayLayersProgressBarEvent)1