use of org.geosdi.geoplatform.exception.ResourceNotFoundFault in project geo-platform by geosdi.
the class OGCService method getCapabilitiesAuth.
@Override
public ArrayList<? extends GPLayerGrid> getCapabilitiesAuth(String serverUrl, HttpServletRequest httpServletRequest, Long idServer) throws GeoPlatformException {
try {
HttpSession session = httpServletRequest.getSession();
String token = (String) session.getAttribute("GOOGLE_TOKEN");
/**
*@TODO think a way to have this configured*
*/
String authValue = httpServletRequest.getHeader("iv-user");
// Enumeration<String> headerNames = httpServletRequest.getHeaderNames();
List<WMSHeaderParam> headerParams = Lists.newArrayList();
if ((authValue != null) && !(authValue.trim().isEmpty())) {
headerParams.add(new WMSHeaderParam("iv-user", authValue));
}
// List<WMSHeaderParam> headerKeyValues = Collections.list(headerNames)
// .stream()
// .filter(key -> ((httpServletRequest.getHeader(key) != null)))
// .map(key -> new WMSHeaderParam(key, httpServletRequest.getHeader(key)))
// .collect(toList());
logger.trace("###########################HEADERS_TO_PASS_TO_SERVICE : {}\n", headerParams);
RequestByID req = new RequestByID(idServer);
GSAccount gsAccount = this.sessionUtility.getLoggedAccount(httpServletRequest).getGsAccount();
String authKey = null;
if (gsAccount != null) {
authKey = gsAccount.getAuthkey();
}
ServerDTO server = geoPlatformWMSServiceClient.getCapabilitiesAuth(serverUrl, req, token, authKey, headerParams);
return dtoServerConverter.createRasterLayerList(server.getLayerList());
} catch (ResourceNotFoundFault ex) {
logger.error("Error GetCapabilities: " + ex);
throw new GeoPlatformException(ex.getMessage());
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
}
use of org.geosdi.geoplatform.exception.ResourceNotFoundFault 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.exception.ResourceNotFoundFault 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.exception.ResourceNotFoundFault in project geo-platform by geosdi.
the class SendSharedProjectNotificationCommand method execute.
@Override
public SendSharedProjectNotificationResponse execute(SendSharedProjectNotificationRequest request, HttpServletRequest httpServletRequest) {
logger.debug("##################### Executing {} Command", this.getClass().getSimpleName());
try {
this.sessionUtility.getLoggedAccount(httpServletRequest);
logger.debug("Request to send shared project message for projectID: " + request.getProjectId() + " - with subject: " + request.getSubject());
this.geoPlatformTrackingClient.sendSharedProjectNotification(request.getProjectId(), request.getSubject(), request.getText(), new XmppAttributesMap(request.getAttributesMap()));
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
} catch (ResourceNotFoundFault rnff) {
logger.error("An Error Occured on sendSharedProjectNotification: " + rnff);
throw new GeoPlatformException(rnff);
}
logger.debug("#################### After sending project notification");
return new SendSharedProjectNotificationResponse();
}
use of org.geosdi.geoplatform.exception.ResourceNotFoundFault 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;
}
Aggregations