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