Search in sources :

Example 1 with ResourceNotFoundFault

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);
    }
}
Also used : WMSHeaderParam(org.geosdi.geoplatform.services.request.WMSHeaderParam) ServerDTO(org.geosdi.geoplatform.response.ServerDTO) HttpSession(javax.servlet.http.HttpSession) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GSAccount(org.geosdi.geoplatform.core.model.GSAccount) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) RequestByID(org.geosdi.geoplatform.request.RequestByID)

Example 2 with ResourceNotFoundFault

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);
}
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 3 with ResourceNotFoundFault

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);
}
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 4 with ResourceNotFoundFault

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();
}
Also used : SendSharedProjectNotificationResponse(org.geosdi.geoplatform.gui.client.command.memento.basic.SendSharedProjectNotificationResponse) XmppAttributesMap(org.geosdi.geoplatform.response.collection.XmppAttributesMap) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 5 with ResourceNotFoundFault

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

Aggregations

ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)104 GeoPlatformException (org.geosdi.geoplatform.gui.global.GeoPlatformException)53 GPSessionTimeout (org.geosdi.geoplatform.gui.utility.GPSessionTimeout)35 IllegalParameterFault (org.geosdi.geoplatform.exception.IllegalParameterFault)33 IOException (java.io.IOException)24 GPAccount (org.geosdi.geoplatform.core.model.GPAccount)16 GPWebServiceMapData (org.geosdi.geoplatform.response.collection.GPWebServiceMapData)16 GPFolder (org.geosdi.geoplatform.core.model.GPFolder)13 MalformedURLException (java.net.MalformedURLException)12 GeoPlatformServer (org.geosdi.geoplatform.core.model.GeoPlatformServer)9 FileNotFoundException (java.io.FileNotFoundException)8 FactoryException (org.opengis.referencing.FactoryException)8 GPAccountProject (org.geosdi.geoplatform.core.model.GPAccountProject)7 GPProject (org.geosdi.geoplatform.core.model.GPProject)7 DataSourceException (org.geotools.data.DataSourceException)7 File (java.io.File)6 ZipFile (java.util.zip.ZipFile)6 GPViewport (org.geosdi.geoplatform.core.model.GPViewport)6 SearchRequest (org.geosdi.geoplatform.request.SearchRequest)6 GuiComponentsPermissionMapData (org.geosdi.geoplatform.response.collection.GuiComponentsPermissionMapData)5