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);
}
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());
}
}
});
}
Aggregations