Search in sources :

Example 26 with IllegalParameterFault

use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.

the class SaveDragAndDropCommand method execute.

@Override
public SaveDragAndDropResponse execute(SaveDragAndDropRequest request, HttpServletRequest httpServletRequest) {
    logger.debug("##################### Executing {} Command", this.getClass().getSimpleName());
    MementoSaveDragDrop memento = request.getMemento();
    Preconditions.checkNotNull(memento, "The MementoSaveDragDrop 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.saveDragAndDropFolderAndTreeModifications(new WSDDFolderAndTreeModifications(memento.getIdBaseElement(), memento.getIdNewParent(), memento.getNewZIndex(), map));
            } catch (ResourceNotFoundFault ex) {
                logger.error("Failed to save Folder drag&drop : " + ex);
                throw new GeoPlatformException(ex);
            }
            break;
        case LEAF:
            try {
                result = this.geoPlatformServiceClient.saveDragAndDropLayerAndTreeModifications(new WSDDLayerAndTreeModificationsRequest(memento.getIdBaseElement(), memento.getIdNewParent(), memento.getNewZIndex(), map));
            } catch (ResourceNotFoundFault ex) {
                logger.error("Failed to save Layer drag&drop : " + ex);
                throw new GeoPlatformException(ex);
            } catch (IllegalParameterFault ilg) {
                logger.error("Error on SaveDragAndDropCommand: " + ilg);
                throw new GeoPlatformException("Parameter incorrect " + "on saveDragAndDropLayerAndTreeModifications");
            }
            break;
    }
    return new SaveDragAndDropResponse(result);
}
Also used : WSDDFolderAndTreeModifications(org.geosdi.geoplatform.request.folder.WSDDFolderAndTreeModifications) IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) SaveDragAndDropResponse(org.geosdi.geoplatform.gui.client.command.memento.dnd.SaveDragAndDropResponse) GPWebServiceMapData(org.geosdi.geoplatform.response.collection.GPWebServiceMapData) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) WSDDLayerAndTreeModificationsRequest(org.geosdi.geoplatform.request.layer.WSDDLayerAndTreeModificationsRequest) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) MementoSaveDragDrop(org.geosdi.geoplatform.gui.client.model.memento.save.bean.MementoSaveDragDrop)

Example 27 with IllegalParameterFault

use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.

the class GPCatalogFinderService method searchFullRecords.

@Override
public PagingLoadResult<FullRecord> searchFullRecords(PagingLoadConfig config, CatalogFinderBean catalogFinder, HttpServletRequest httpServletRequest) throws Exception {
    logger.debug("\n--------------------------\n{}\n--------------------------\n", catalogFinder);
    int recordsCount;
    ArrayList<FullRecord> searchRecords;
    try {
        recordsCount = geoPlatformCSWClient.getRecordsCount(catalogFinder);
        if (recordsCount == 0) {
            logger.info("\n*** No Full Record found ***");
            searchRecords = new ArrayList<FullRecord>(0);
        } else {
            List<FullRecordDTO> recordList = geoPlatformCSWClient.searchFullRecords(config.getLimit(), config.getOffset() + 1, catalogFinder);
            searchRecords = new ArrayList<FullRecord>(recordList.size());
            for (FullRecordDTO recordDTO : recordList) {
                searchRecords.add(this.convertFullRecordDTO(recordDTO));
            }
        }
    } catch (IllegalParameterFault ex) {
        logger.error("\n*** IllegalParameterFault ***\n{}", ex.getMessage());
        throw new GeoPlatformException(ex.getMessage());
    } catch (ResourceNotFoundFault ex) {
        logger.error("\n*** ResourceNotFoundFault ***\n{}", ex.getMessage());
        throw new GeoPlatformException(ex.getMessage());
    } catch (ServerInternalFault ex) {
        logger.error("\n*** ServerInternalFault ***\n{}", ex.getMessage());
        throw new GeoPlatformException(ex.getMessage());
    }
    return new BasePagingLoadResult<FullRecord>(searchRecords, config.getOffset(), recordsCount);
}
Also used : IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) FullRecord(org.geosdi.geoplatform.gui.client.model.FullRecord) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) FullRecordDTO(org.geosdi.geoplatform.responce.FullRecordDTO) ServerInternalFault(org.geosdi.geoplatform.exception.ServerInternalFault) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) BasePagingLoadResult(com.extjs.gxt.ui.client.data.BasePagingLoadResult)

Example 28 with IllegalParameterFault

use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.

the class GPCatalogFinderService method getRecordById.

@Override
public String getRecordById(Long serverID, String identifier, String moduleName, HttpServletRequest httpServletRequest) throws Exception {
    try {
        String url = httpServletRequest.getSession().getServletContext().getRealPath("/" + moduleName + "/csw-template");
        logger.trace("PATH @@@@@@@@@@@@@@@@@@ {}", url);
        String response = geoPlatformCSWClient.getRecordById(serverID, identifier);
        response = this.deAccent(response);
        String fileName = url + "/" + System.currentTimeMillis() + "-" + identifier + ".xml";
        File file = new File(fileName);
        FileUtils.writeStringToFile(file, response);
        logger.debug("Name FILE Created  @@@@@@@@@@@@@@@@@@@@@@@@@@@ {}", file.getName());
        return file.getName();
    } catch (IOException ex) {
        logger.error("\n*** IOException ***\n{}", ex.getMessage());
        throw new GeoPlatformException(ex.getMessage());
    } catch (IllegalParameterFault ex) {
        logger.error("\n*** IllegalParameterFault ***\n{}", ex.getMessage());
        throw new GeoPlatformException(ex.getMessage());
    } catch (ResourceNotFoundFault ex) {
        logger.error("\n*** ResourceNotFoundFault ***\n{}", ex.getMessage());
        throw new GeoPlatformException(ex.getMessage());
    } catch (ServerInternalFault ex) {
        logger.error("\n*** ServerInternalFault ***\n{}", ex.getMessage());
        throw new GeoPlatformException(ex.getMessage());
    }
}
Also used : IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) IOException(java.io.IOException) ServerInternalFault(org.geosdi.geoplatform.exception.ServerInternalFault) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) File(java.io.File)

Example 29 with IllegalParameterFault

use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.

the class LayerService method updateProject.

@Override
public void updateProject(GPClientProject project, HttpServletRequest httpServletRequest) throws GeoPlatformException {
    try {
        GPAccount account = this.sessionUtility.getLoggedAccount(httpServletRequest);
        AccountProjectPropertiesDTO dto = this.dtoLayerConverter.convertToAccountProjectPropertiesDTO(account.getId(), project);
        if (this.geoPlatformServiceClient.saveAccountProjectProperties(dto)) {
            this.sessionUtility.storeLoggedAccountAndDefaultProject(account, project.getId(), httpServletRequest);
        }
    } catch (ResourceNotFoundFault rnf) {
        logger.error("Failed to update project on SecurityService: " + rnf);
        throw new GeoPlatformException(rnf);
    } catch (IllegalParameterFault ilg) {
        logger.error("Error on SecurityService: {}", ilg.getMessage());
        throw new GeoPlatformException("Parameter incorrect on updateProject");
    } catch (GPSessionTimeout timeout) {
        logger.error("Session timeout");
        throw new GeoPlatformException(timeout);
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new GeoPlatformException(ex.getMessage());
    }
}
Also used : GPAccount(org.geosdi.geoplatform.core.model.GPAccount) 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) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Example 30 with IllegalParameterFault

use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.

the class LayerService method saveFolderForUser.

@Override
public Long saveFolderForUser(String folderName, int position, int numberOfDescendants, boolean isChecked, HttpServletRequest httpServletRequest) throws GeoPlatformException {
    GPFolder folder = new GPFolder();
    folder.setName(folderName);
    folder.setPosition(position);
    folder.setShared(false);
    Long projectId;
    try {
        projectId = this.sessionUtility.getDefaultProject(httpServletRequest);
        this.sessionUtility.getLoggedAccount(httpServletRequest);
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    }
    folder.setNumberOfDescendants(numberOfDescendants);
    folder.setChecked(isChecked);
    Long savedFolderId;
    try {
        savedFolderId = this.geoPlatformServiceClient.insertFolder(new InsertFolderRequest(projectId, folder));
    } catch (IllegalParameterFault ilg) {
        logger.error("Error on LayerService: " + ilg);
        throw new GeoPlatformException("Parameter incorrect on saveFoldeForUser");
    } catch (ResourceNotFoundFault rnff) {
        logger.error("Error on LayerService: " + rnff);
        throw new GeoPlatformException(rnff);
    }
    return savedFolderId;
}
Also used : GPFolder(org.geosdi.geoplatform.core.model.GPFolder) InsertFolderRequest(org.geosdi.geoplatform.request.folder.InsertFolderRequest) 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)

Aggregations

IllegalParameterFault (org.geosdi.geoplatform.exception.IllegalParameterFault)56 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)32 GeoPlatformException (org.geosdi.geoplatform.gui.global.GeoPlatformException)22 GPSessionTimeout (org.geosdi.geoplatform.gui.utility.GPSessionTimeout)15 GPWebServiceMapData (org.geosdi.geoplatform.response.collection.GPWebServiceMapData)11 IOException (java.io.IOException)8 MalformedURLException (java.net.MalformedURLException)8 GPFolder (org.geosdi.geoplatform.core.model.GPFolder)7 GPUser (org.geosdi.geoplatform.core.model.GPUser)7 GPOrganization (org.geosdi.geoplatform.core.model.GPOrganization)6 GPAccount (org.geosdi.geoplatform.core.model.GPAccount)5 GPAccountProject (org.geosdi.geoplatform.core.model.GPAccountProject)4 Test (org.junit.Test)4 URL (java.net.URL)3 InsertAccountRequest (org.geosdi.geoplatform.request.InsertAccountRequest)3 BasePagingLoadResult (com.extjs.gxt.ui.client.data.BasePagingLoadResult)2 GPCSWConnectorBuilder (org.geosdi.geoplatform.connector.GPCSWConnectorBuilder)2 GPCatalogConnectorStore (org.geosdi.geoplatform.connector.GPCatalogConnectorStore)2 BasicPreemptiveSecurityConnector (org.geosdi.geoplatform.connector.server.security.BasicPreemptiveSecurityConnector)2 GPSecurityConnector (org.geosdi.geoplatform.connector.server.security.GPSecurityConnector)2