removing redundant experiment search API methods
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/c9ddaeb3 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/c9ddaeb3 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/c9ddaeb3 Branch: refs/heads/master Commit: c9ddaeb3de586a71d026a81e24eb1c7fe801b40d Parents: 10b7b12 Author: scnakandala <[email protected]> Authored: Mon Jun 27 15:49:57 2016 -0400 Committer: scnakandala <[email protected]> Committed: Mon Jun 27 15:49:57 2016 -0400 ---------------------------------------------------------------------- .../server/handler/AiravataServerHandler.java | 311 - .../java/org/apache/airavata/api/Airavata.java | 15067 +++------------- .../main/resources/lib/airavata/Airavata.cpp | 15252 +++++++---------- .../src/main/resources/lib/airavata/Airavata.h | 1405 +- .../lib/airavata/Airavata_server.skeleton.cpp | 177 - .../resources/lib/Airavata/API/Airavata.php | 3644 +--- .../lib/apache/airavata/api/Airavata-remote | 35 - .../lib/apache/airavata/api/Airavata.py | 2581 +-- .../airavata-apis/airavata_api.thrift | 167 - 9 files changed, 9647 insertions(+), 28992 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/c9ddaeb3/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java index f4edd91..7ff89d7 100644 --- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java +++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java @@ -876,317 +876,6 @@ public class AiravataServerHandler implements Airavata.Iface { } /** - * Search Experiments by experiment name with pagination. Results will be sorted - * based on creation time DESC - * - * @param gatewayId - * Identifier of the requested gateway - * @param userName - * Username of the requested user - * @param expName - * Experiment name to be matched - * @param limit - * Amount of results to be fetched - * @param offset - * The starting point of the results to be fetched - */ - @Override - @SecurityCheck - public List<ExperimentSummaryModel> searchExperimentsByName(AuthzToken authzToken, String gatewayId, String userName, - String expName, int limit, int offset) - throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { - if (!validateString(userName)){ - logger.error("Username cannot be empty. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Username cannot be empty. Please provide a valid user.."); - throw exception; - } - if (!isGatewayExistInternal(gatewayId)){ - logger.error("Gateway does not exist.Please provide a valid gateway id..."); - throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); - } - try { - if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){ - logger.error("User does not exist in the system. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("User does not exist in the system. Please provide a valid user.."); - throw exception; - } - List<ExperimentSummaryModel> summaries = new ArrayList<ExperimentSummaryModel>(); - experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId); - Map<String, String> filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName); - filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID, gatewayId); - filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME, expName); - List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit, - offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC); - for (Object object : results) { - summaries.add((ExperimentSummaryModel) object); - } - logger.debug("Airavata retrieved experiments for user : " + userName + " and gateway id : " + gatewayId + " with experiment name : " + expName); - return summaries; - }catch (Exception e) { - logger.error("Error while retrieving experiments", e); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage()); - throw exception; - } - } - - /** - * Search Experiments by experiment name with pagination. Results will be sorted - * based on creation time DESC - * - * @param gatewayId - * Identifier of the requested gateway - * @param userName - * Username of the requested user - * @param description - * Experiment description to be matched - * @param limit - * Amount of results to be fetched - * @param offset - * The starting point of the results to be fetched - */ - @Override - @SecurityCheck - public List<ExperimentSummaryModel> searchExperimentsByDesc(AuthzToken authzToken, String gatewayId, String userName, - String description, int limit, int offset) - throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { - if (!validateString(userName)){ - logger.error("Username cannot be empty. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Username cannot be empty. Please provide a valid user.."); - throw exception; - } - if (!isGatewayExistInternal(gatewayId)){ - logger.error("Gateway does not exist.Please provide a valid gateway id..."); - throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); - } - try { - if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){ - logger.error("User does not exist in the system. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("User does not exist in the system. Please provide a valid user.."); - throw exception; - } - List<ExperimentSummaryModel> summaries = new ArrayList<ExperimentSummaryModel>(); - experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId); - Map<String, String> filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName); - filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID, gatewayId); - filters.put(Constants.FieldConstants.ExperimentConstants.DESCRIPTION, description); - List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit, - offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC); - for (Object object : results) { - summaries.add((ExperimentSummaryModel) object); - } - logger.debug("Airavata retrieved experiments for user : " + userName + " and gateway id : " + gatewayId + " with experiment description : " + description); - return summaries; - }catch (Exception e) { - logger.error("Error while retrieving experiments", e); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage()); - throw exception; - } - } - - /** - * Search Experiments by application id with pagination. Results will be sorted - * based on creation time DESC - * - * @param gatewayId - * Identifier of the requested gateway - * @param userName - * Username of the requested user - * @param applicationId - * Application id to be matched - * @param limit - * Amount of results to be fetched - * @param offset - * The starting point of the results to be fetched - */ - @Override - @SecurityCheck - public List<ExperimentSummaryModel> searchExperimentsByApplication(AuthzToken authzToken, String gatewayId, - String userName, String applicationId, - int limit, int offset) - throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { - if (!validateString(userName)){ - logger.error("Username cannot be empty. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Username cannot be empty. Please provide a valid user.."); - throw exception; - } - if (!isGatewayExistInternal(gatewayId)){ - logger.error("Gateway does not exist.Please provide a valid gateway id..."); - throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); - } - try { - if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){ - logger.error("User does not exist in the system. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("User does not exist in the system. Please provide a valid user.."); - throw exception; - } - List<ExperimentSummaryModel> summaries = new ArrayList<ExperimentSummaryModel>(); - experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId); - Map<String, String> filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName); - filters.put(Constants.FieldConstants.ExperimentConstants.EXECUTION_ID, applicationId); - filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID, gatewayId); - List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit, - offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC); - for (Object object : results) { - summaries.add((ExperimentSummaryModel) object); - } - logger.debug("Airavata retrieved experiments for user : " + userName + " and gateway id : " + gatewayId + " with application id : " + applicationId); - return summaries; - }catch (Exception e) { - logger.error("Error while retrieving experiments", e); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage()); - throw exception; - } - } - - /** - * Search Experiments by experiment status with pagination. Results will be sorted - * based on creation time DESC - * - * @param gatewayId - * Identifier of the requested gateway - * @param userName - * Username of the requested user - * @param experimentState - * Experiement state to be matched - * @param limit - * Amount of results to be fetched - * @param offset - * The starting point of the results to be fetched - */ - @Override - @SecurityCheck - public List<ExperimentSummaryModel> searchExperimentsByStatus(AuthzToken authzToken, String gatewayId, - String userName, ExperimentState experimentState, - int limit, int offset) - throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { - if (!validateString(userName)){ - logger.error("Username cannot be empty. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Username cannot be empty. Please provide a valid user.."); - throw exception; - } - if (!isGatewayExistInternal(gatewayId)){ - logger.error("Gateway does not exist.Please provide a valid gateway id..."); - throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); - } - try { - if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){ - logger.error("User does not exist in the system. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("User does not exist in the system. Please provide a valid user.."); - throw exception; - } - List<ExperimentSummaryModel> summaries = new ArrayList<ExperimentSummaryModel>(); - experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId); - Map<String, String> filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName); - filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS, experimentState.toString()); - filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID, gatewayId); - List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit, - offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC); - for (Object object : results) { - summaries.add((ExperimentSummaryModel) object); - } - logger.debug("Airavata retrieved experiments for user : " + userName + " and gateway id : " + gatewayId + " with experiment status : " + experimentState); - return summaries; - }catch (Exception e) { - logger.error("Error while retrieving experiments", e); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage()); - throw exception; - } - } - - /** - * Search Experiments by experiment creation time with pagination. Results will be sorted - * based on creation time DESC - * - * @param gatewayId - * Identifier of the requested gateway - * @param userName - * Username of the requested user - * @param fromTime - * Start time of the experiments creation time - * @param toTime - * End time of the experiement creation time - * @param limit - * Amount of results to be fetched - * @param offset - * The starting point of the results to be fetched - */ - @Override - @SecurityCheck - public List<ExperimentSummaryModel> searchExperimentsByCreationTime(AuthzToken authzToken, String gatewayId, - String userName, long fromTime, - long toTime, int limit, int offset) - throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { - if (!validateString(userName)){ - logger.error("Username cannot be empty. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Username cannot be empty. Please provide a valid user.."); - throw exception; - } - if (!isGatewayExistInternal(gatewayId)){ - logger.error("Gateway does not exist.Please provide a valid gateway id..."); - throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); - } - try { - if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)){ - logger.error("User does not exist in the system. Please provide a valid user.."); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("User does not exist in the system. Please provide a valid user.."); - throw exception; - } - List<ExperimentSummaryModel> summaries = new ArrayList<ExperimentSummaryModel>(); - experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId); - Map<String, String> filters = new HashMap<String, String>(); - filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName); - filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, String.valueOf(fromTime)); - filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, String.valueOf(toTime)); - filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID, gatewayId); - List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT, filters, limit, - offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC); - for (Object object : results) { - summaries.add((ExperimentSummaryModel) object); - } - logger.debug("Airavata retrieved experiments for user : " + userName + " and gateway id : " + gatewayId + " with experiment creation time : " + AiravataUtils.getTime(fromTime)); - return summaries; - }catch (Exception e) { - logger.error("Error while retrieving experiments", e); - AiravataSystemException exception = new AiravataSystemException(); - exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); - exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage()); - throw exception; - } - } - - /** * Search Experiments by using multiple filter criteria with pagination. Results will be sorted * based on creation time DESC *
