Search in sources :

Example 6 with IllegalParameterFault

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

the class GPCatalogFinderService method searchSummaryRecords.

@Override
public PagingLoadResult<SummaryRecord> searchSummaryRecords(PagingLoadConfig config, CatalogFinderBean catalogFinder, HttpServletRequest httpServletRequest) throws Exception {
    int recordsCount;
    ArrayList<SummaryRecord> searchRecords;
    try {
        recordsCount = geoPlatformCSWClient.getRecordsCount(catalogFinder);
        if (recordsCount == 0) {
            logger.info("\n*** No Summary Record found ***");
            searchRecords = new ArrayList<SummaryRecord>(0);
        } else {
            List<SummaryRecordDTO> recordList = geoPlatformCSWClient.searchSummaryRecords(config.getLimit(), config.getOffset() + 1, catalogFinder);
            searchRecords = new ArrayList<SummaryRecord>(recordList.size());
            for (SummaryRecordDTO recordDTO : recordList) {
                searchRecords.add(this.convertSummaryRecordDTO(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<SummaryRecord>(searchRecords, config.getOffset(), recordsCount);
}
Also used : IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) SummaryRecord(org.geosdi.geoplatform.gui.client.model.SummaryRecord) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) SummaryRecordDTO(org.geosdi.geoplatform.responce.SummaryRecordDTO) ServerInternalFault(org.geosdi.geoplatform.exception.ServerInternalFault) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) BasePagingLoadResult(com.extjs.gxt.ui.client.data.BasePagingLoadResult)

Example 7 with IllegalParameterFault

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

the class UserService method updateOwnUser.

@Override
public Long updateOwnUser(IGPUserManageDetail userDetail, String currentPlainPassword, String newPlainPassword, HttpServletRequest httpServletRequest) throws GeoPlatformException {
    this.getCheckLoggedUser(httpServletRequest);
    logger.debug("\nOWN User to update:\n{}", userDetail);
    Long userID = null;
    try {
        UserDTO userDTO = new UserDTO();
        userDTO.setId(userDetail.getId());
        userDTO.setName(userDetail.getName());
        userDTO.setEmailAddress(userDetail.getEmail());
        userID = geoPlatformServiceClient.updateOwnUser(userDTO, currentPlainPassword, newPlainPassword);
        sessionUtility.storeLoggedAccount(this.dtoUserConverter.convertToGPUser(userDetail), httpServletRequest);
    } catch (IllegalParameterFault ipf) {
        throw new GeoPlatformException(ipf.getMessage());
    } catch (ResourceNotFoundFault rnnf) {
        throw new GeoPlatformException(rnnf.getMessage());
    }
    return userID;
}
Also used : IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) UserDTO(org.geosdi.geoplatform.response.UserDTO) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 8 with IllegalParameterFault

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

the class MapService method saveBaseLayer.

// @Override
// public String layerAuthenticate(String userName, String password, String url) throws GeoPlatformException {
// HTTPUtils hTTPUtils = new HTTPUtils(userName, password);
// String responce = null;
// try {
// logger.info("Layer: " + url);
// responce = hTTPUtils.get("http://localhost:8989/geoserver");
// logger.info("Auth Responce: " + responce);
// } catch (MalformedURLException mfe) {
// System.out.println("Url tazzo: " + mfe);
// }
// return responce;
// }
@Override
public void saveBaseLayer(String baseLayer, HttpServletRequest httpServletRequest) throws GeoPlatformException {
    GPAccount account;
    Long projectID;
    try {
        account = this.sessionUtility.getLoggedAccount(httpServletRequest);
        projectID = this.sessionUtility.getDefaultProject(httpServletRequest);
    } catch (GPSessionTimeout timeout) {
        throw new GeoPlatformException(timeout);
    }
    try {
        GPAccountProject accountProject = this.geoPlatformServiceClient.getAccountProjectByAccountAndProjectIDs(account.getId(), projectID);
        accountProject.setBaseLayer(baseLayer);
        this.geoPlatformServiceClient.updateAccountProject(accountProject);
    } catch (ResourceNotFoundFault rnff) {
        logger.error("Error on MapService: " + rnff);
        throw new GeoPlatformException(rnff);
    } catch (IllegalParameterFault ipf) {
        logger.error("Error on MapService: " + ipf);
        throw new GeoPlatformException(ipf);
    }
}
Also used : GPAccount(org.geosdi.geoplatform.core.model.GPAccount) GPAccountProject(org.geosdi.geoplatform.core.model.GPAccountProject) 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)

Example 9 with IllegalParameterFault

use of org.geosdi.geoplatform.exception.IllegalParameterFault 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());
    }
}
Also used : GPFolder(org.geosdi.geoplatform.core.model.GPFolder) WSAddFolderAndTreeModificationsRequest(org.geosdi.geoplatform.request.folder.WSAddFolderAndTreeModificationsRequest) IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) GPWebServiceMapData(org.geosdi.geoplatform.response.collection.GPWebServiceMapData) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) SaveAddedFolderAndTreeModificationsResponse(org.geosdi.geoplatform.gui.client.command.memento.toolbar.SaveAddedFolderAndTreeModificationsResponse) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException) MementoSaveAddedFolder(org.geosdi.geoplatform.gui.client.model.memento.save.bean.MementoSaveAddedFolder) GeoPlatformException(org.geosdi.geoplatform.gui.global.GeoPlatformException)

Example 10 with IllegalParameterFault

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

the class SecurityService method createNewCASUser.

private IGPAccountDetail createNewCASUser(String casUserName, HttpServletRequest httpServletRequest) {
    IGPUserManageDetail newCASAccount = this.fillNewCASAccount(casUserName);
    logger.info("A new user from CAS login will be created with username: " + casUserName);
    userService.insertUser(newCASAccount, this.casOrganization, httpServletRequest, Boolean.FALSE, Boolean.TRUE);
    StringTokenizer tokenizer = new StringTokenizer(this.casAdminEmails, ";");
    List<String> emailList = Lists.<String>newArrayListWithExpectedSize(tokenizer.countTokens());
    while (tokenizer.hasMoreElements()) {
        emailList.add(tokenizer.nextToken());
    }
    try {
        geoPlatformServiceClient.sendCASNewUserNotification(emailList, casUserName);
    } catch (IllegalParameterFault ex) {
        logger.error("SecurityService", "Unable to send email to: " + this.casAdminEmails + " after new cas user creation. Error: " + ex);
    }
    return this.casLogin(httpServletRequest);
}
Also used : StringTokenizer(java.util.StringTokenizer) IllegalParameterFault(org.geosdi.geoplatform.exception.IllegalParameterFault) IGPUserManageDetail(org.geosdi.geoplatform.gui.global.security.IGPUserManageDetail)

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