Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2A0F8200B92 for ; Tue, 13 Sep 2016 12:41:26 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 28BF9160ADD; Tue, 13 Sep 2016 10:41:26 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C2020160AD8 for ; Tue, 13 Sep 2016 12:41:23 +0200 (CEST) Received: (qmail 87917 invoked by uid 500); 13 Sep 2016 10:41:22 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 85280 invoked by uid 99); 13 Sep 2016 10:41:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Sep 2016 10:41:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B4708E08B8; Tue, 13 Sep 2016 10:41:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: oleewere@apache.org To: commits@ambari.apache.org Date: Tue, 13 Sep 2016 10:41:52 -0000 Message-Id: <2092a90263f24508a1c8be1095e828c1@git.apache.org> In-Reply-To: <10d77c3352364029bcbcc7a7ac6c1261@git.apache.org> References: <10d77c3352364029bcbcc7a7ac6c1261@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [35/51] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere) archived-at: Tue, 13 Sep 2016 10:41:26 -0000 http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java new file mode 100644 index 0000000..7430770 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java @@ -0,0 +1,276 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.ambari.logsearch.manager; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.common.MessageEnums; +import org.apache.ambari.logsearch.dao.UserConfigSolrDao; +import org.apache.ambari.logsearch.query.QueryGeneration; +import org.apache.ambari.logsearch.util.JSONUtil; +import org.apache.ambari.logsearch.util.RESTErrorUtil; +import org.apache.ambari.logsearch.util.SolrUtil; +import org.apache.ambari.logsearch.view.VLogfeederFilterWrapper; +import org.apache.ambari.logsearch.view.VUserConfig; +import org.apache.ambari.logsearch.view.VUserConfigList; +import org.apache.ambari.logsearch.query.model.SearchCriteria; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.apache.solr.client.solrj.SolrQuery; +import org.apache.solr.client.solrj.SolrServerException; +import org.apache.solr.client.solrj.response.FacetField.Count; +import org.apache.solr.client.solrj.response.QueryResponse; +import org.apache.solr.common.SolrDocument; +import org.apache.solr.common.SolrDocumentList; +import org.apache.solr.common.SolrException; +import org.apache.solr.common.SolrInputDocument; +import org.springframework.stereotype.Component; + +import javax.inject.Inject; + +@Component +public class UserConfigManager extends JsonManagerBase { + + private static final Logger logger = Logger.getLogger(UserConfigManager.class); + + @Inject + private UserConfigSolrDao userConfigSolrDao; + @Inject + private QueryGeneration queryGenerator; + + public String saveUserConfig(VUserConfig vHistory) { + + SolrInputDocument solrInputDoc = new SolrInputDocument(); + if (!isValid(vHistory)) { + throw RESTErrorUtil.createRESTException("No FilterName Specified", MessageEnums.INVALID_INPUT_DATA); + } + + if (isNotUnique(vHistory) && !vHistory.isOverwrite()) { + throw RESTErrorUtil.createRESTException( "Name '" + vHistory.getFiltername() + "' already exists", MessageEnums.INVALID_INPUT_DATA); + } + String loggedInUserName = vHistory.getUserName(); + String filterName = vHistory.getFiltername(); + + solrInputDoc.addField(LogSearchConstants.ID, vHistory.getId()); + solrInputDoc.addField(LogSearchConstants.USER_NAME, loggedInUserName); + solrInputDoc.addField(LogSearchConstants.VALUES, vHistory.getValues()); + solrInputDoc.addField(LogSearchConstants.FILTER_NAME, filterName); + solrInputDoc.addField(LogSearchConstants.ROW_TYPE, vHistory.getRowType()); + List shareNameList = vHistory.getShareNameList(); + if (shareNameList != null && !shareNameList.isEmpty()) { + solrInputDoc.addField(LogSearchConstants.SHARE_NAME_LIST, shareNameList); + } + // Check whether the Filter Name exists in solr + SolrQuery solrQuery = new SolrQuery(); + SolrUtil.setMainQuery(solrQuery, null); + queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName)); + queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.USER_NAME, loggedInUserName); + try { + QueryResponse queryResponse = userConfigSolrDao.process(solrQuery); + if (queryResponse != null) { + SolrDocumentList documentList = queryResponse.getResults(); + if (documentList != null && !documentList.isEmpty() && !vHistory.isOverwrite()) { + logger.error("Filtername is already present"); + throw RESTErrorUtil.createRESTException("Filtername is already present", MessageEnums.INVALID_INPUT_DATA); + } + } + } catch (SolrException | SolrServerException | IOException e) { + logger.error("Error in checking same filtername config", e); + throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); + } + + try { + userConfigSolrDao.addDocs(solrInputDoc); + return convertObjToString(solrInputDoc); + } catch (SolrException | SolrServerException | IOException e) { + logger.error("Error saving user config. solrDoc=" + solrInputDoc, e); + throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); + } + } + + private boolean isNotUnique(VUserConfig vHistory) { + String filterName = vHistory.getFiltername(); + String rowType = vHistory.getRowType(); + + if (filterName != null && rowType != null) { + SolrQuery solrQuery = new SolrQuery(); + filterName = SolrUtil.makeSearcableString(filterName); + solrQuery.setQuery(LogSearchConstants.COMPOSITE_KEY + ":" + filterName + "-" + rowType); + SolrUtil.setRowCount(solrQuery, 0); + try { + Long numFound = userConfigSolrDao.process(solrQuery).getResults().getNumFound(); + if (numFound > 0) { + return true; + } + } catch (SolrException | SolrServerException | IOException e) { + logger.error("Error while checking if userConfig is unique.", e); + } + } + return false; + } + + private boolean isValid(VUserConfig vHistory) { + return !StringUtils.isBlank(vHistory.getFiltername()) + && !StringUtils.isBlank(vHistory.getRowType()) + && !StringUtils.isBlank(vHistory.getUserName()) + && !StringUtils.isBlank(vHistory.getValues()); + } + + public void deleteUserConfig(String id) { + try { + userConfigSolrDao.deleteUserConfig(id); + } catch (SolrException | SolrServerException | IOException e) { + throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); + } + } + + @SuppressWarnings("unchecked") + public String getUserConfig(SearchCriteria searchCriteria) { + + SolrDocumentList solrList = new SolrDocumentList(); + VUserConfigList userConfigList = new VUserConfigList(); + + String rowType = (String) searchCriteria.getParamValue(LogSearchConstants.ROW_TYPE); + if (StringUtils.isBlank(rowType)) { + throw RESTErrorUtil.createRESTException("row type was not specified", MessageEnums.INVALID_INPUT_DATA); + } + + String userName = (String) searchCriteria.getParamValue(LogSearchConstants.USER_NAME); + if (StringUtils.isBlank(userName)) { + throw RESTErrorUtil.createRESTException("user name was not specified", MessageEnums.INVALID_INPUT_DATA); + } + String filterName = (String) searchCriteria.getParamValue(LogSearchConstants.FILTER_NAME); + filterName = StringUtils.isBlank(filterName) ? "*" : "*" + filterName + "*"; + + try { + + SolrQuery userConfigQuery = new SolrQuery(); + SolrUtil.setMainQuery(userConfigQuery, null); + queryGenerator.setPagination(userConfigQuery, searchCriteria); + queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.ROW_TYPE, rowType); + queryGenerator.setSingleORFilter(userConfigQuery, LogSearchConstants.USER_NAME, userName, LogSearchConstants.SHARE_NAME_LIST, userName); + queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName)); + + if (StringUtils.isBlank(searchCriteria.getSortBy())) { + searchCriteria.setSortBy(LogSearchConstants.FILTER_NAME); + } + if (StringUtils.isBlank(searchCriteria.getSortType())) { + searchCriteria.setSortType("" + SolrQuery.ORDER.asc); + } + + queryGenerator.setSingleSortOrder(userConfigQuery, searchCriteria); + solrList = userConfigSolrDao.process(userConfigQuery).getResults(); + + Collection configList = new ArrayList(); + + for (SolrDocument solrDoc : solrList) { + VUserConfig userConfig = new VUserConfig(); + userConfig.setFiltername("" + solrDoc.get(LogSearchConstants.FILTER_NAME)); + userConfig.setId("" + solrDoc.get(LogSearchConstants.ID)); + userConfig.setValues("" + solrDoc.get(LogSearchConstants.VALUES)); + userConfig.setRowType("" + solrDoc.get(LogSearchConstants.ROW_TYPE)); + try { + List shareNameList = (List) solrDoc.get(LogSearchConstants.SHARE_NAME_LIST); + userConfig.setShareNameList(shareNameList); + } catch (Exception e) { + // do nothing + } + + userConfig.setUserName("" + solrDoc.get(LogSearchConstants.USER_NAME)); + + configList.add(userConfig); + } + + userConfigList.setName("historyList"); + userConfigList.setUserConfigList(configList); + + userConfigList.setStartIndex(searchCriteria.getStartIndex()); + userConfigList.setPageSize((int) searchCriteria.getMaxRows()); + + userConfigList.setTotalCount((long) solrList.getNumFound()); + } catch (SolrException | SolrServerException | IOException e) { + // do nothing + logger.error(e); + throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); + } + + return convertObjToString(userConfigList); + + } + + public String updateUserConfig(VUserConfig vuserConfig) { + return saveUserConfig(vuserConfig); + } + + // ////////////////////////////LEVEL FILTER///////////////////////////////////// + + public String getUserFilter() { + VLogfeederFilterWrapper userFilter; + try { + userFilter = userConfigSolrDao.getUserFilter(); + } catch (SolrServerException | IOException e) { + logger.error(e); + throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); + } + return convertObjToString(userFilter); + } + + public String saveUserFiter(String json) { + if (!StringUtils.isBlank(json)) { + VLogfeederFilterWrapper logfeederFilterWrapper = (VLogfeederFilterWrapper) JSONUtil.jsonToObj(json, VLogfeederFilterWrapper.class); + try { + if (logfeederFilterWrapper == null) { + logger.error(json + " is a invalid json"); + } + userConfigSolrDao.saveUserFilter(logfeederFilterWrapper); + } catch (SolrException | SolrServerException | IOException e) { + logger.error("user config not able to save", e); + throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); + } + } + return getUserFilter(); + } + + public String getAllUserName() { + List userList = new ArrayList(); + try { + SolrQuery userListQuery = new SolrQuery(); + SolrUtil.setMainQuery(userListQuery, null); + SolrUtil.setFacetField(userListQuery, LogSearchConstants.USER_NAME); + QueryResponse queryResponse = userConfigSolrDao.process(userListQuery); + if (queryResponse == null) { + return convertObjToString(userList); + } + List counList = queryResponse.getFacetField(LogSearchConstants.USER_NAME).getValues(); + for (Count cnt : counList) { + String userName = cnt.getName(); + userList.add(userName); + } + } catch (SolrException | SolrServerException | IOException e) { + logger.warn("Error getting all users.", e); + throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); + } + return convertObjToString(userList); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigMgr.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigMgr.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigMgr.java deleted file mode 100644 index 59c1bbd..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigMgr.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.ambari.logsearch.manager; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.ambari.logsearch.common.LogSearchConstants; -import org.apache.ambari.logsearch.common.MessageEnums; -import org.apache.ambari.logsearch.common.SearchCriteria; -import org.apache.ambari.logsearch.dao.UserConfigSolrDao; -import org.apache.ambari.logsearch.query.QueryGeneration; -import org.apache.ambari.logsearch.util.JSONUtil; -import org.apache.ambari.logsearch.util.RESTErrorUtil; -import org.apache.ambari.logsearch.util.SolrUtil; -import org.apache.ambari.logsearch.view.VLogfeederFilterWrapper; -import org.apache.ambari.logsearch.view.VUserConfig; -import org.apache.ambari.logsearch.view.VUserConfigList; -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; -import org.apache.solr.client.solrj.SolrQuery; -import org.apache.solr.client.solrj.SolrServerException; -import org.apache.solr.client.solrj.response.FacetField.Count; -import org.apache.solr.client.solrj.response.QueryResponse; -import org.apache.solr.common.SolrDocument; -import org.apache.solr.common.SolrDocumentList; -import org.apache.solr.common.SolrException; -import org.apache.solr.common.SolrInputDocument; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class UserConfigMgr extends MgrBase { - - private static final Logger logger = Logger.getLogger(UserConfigMgr.class); - - @Autowired - private UserConfigSolrDao userConfigSolrDao; - @Autowired - private QueryGeneration queryGenerator; - - public String saveUserConfig(VUserConfig vHistory) { - - SolrInputDocument solrInputDoc = new SolrInputDocument(); - if (!isValid(vHistory)) { - throw RESTErrorUtil.createRESTException("No FilterName Specified", MessageEnums.INVALID_INPUT_DATA); - } - - if (isNotUnique(vHistory) && !vHistory.isOverwrite()) { - throw RESTErrorUtil.createRESTException( "Name '" + vHistory.getFiltername() + "' already exists", MessageEnums.INVALID_INPUT_DATA); - } - String loggedInUserName = vHistory.getUserName(); - String filterName = vHistory.getFiltername(); - - solrInputDoc.addField(LogSearchConstants.ID, vHistory.getId()); - solrInputDoc.addField(LogSearchConstants.USER_NAME, loggedInUserName); - solrInputDoc.addField(LogSearchConstants.VALUES, vHistory.getValues()); - solrInputDoc.addField(LogSearchConstants.FILTER_NAME, filterName); - solrInputDoc.addField(LogSearchConstants.ROW_TYPE, vHistory.getRowType()); - List shareNameList = vHistory.getShareNameList(); - if (shareNameList != null && !shareNameList.isEmpty()) { - solrInputDoc.addField(LogSearchConstants.SHARE_NAME_LIST, shareNameList); - } - // Check whether the Filter Name exists in solr - SolrQuery solrQuery = new SolrQuery(); - SolrUtil.setMainQuery(solrQuery, null); - queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName)); - queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.USER_NAME, loggedInUserName); - try { - QueryResponse queryResponse = userConfigSolrDao.process(solrQuery); - if (queryResponse != null) { - SolrDocumentList documentList = queryResponse.getResults(); - if (documentList != null && !documentList.isEmpty() && !vHistory.isOverwrite()) { - logger.error("Filtername is already present"); - throw RESTErrorUtil.createRESTException("Filtername is already present", MessageEnums.INVALID_INPUT_DATA); - } - } - } catch (SolrException | SolrServerException | IOException e) { - logger.error("Error in checking same filtername config", e); - throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); - } - - try { - userConfigSolrDao.addDocs(solrInputDoc); - return convertObjToString(solrInputDoc); - } catch (SolrException | SolrServerException | IOException e) { - logger.error("Error saving user config. solrDoc=" + solrInputDoc, e); - throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); - } - } - - private boolean isNotUnique(VUserConfig vHistory) { - String filterName = vHistory.getFiltername(); - String rowType = vHistory.getRowType(); - - if (filterName != null && rowType != null) { - SolrQuery solrQuery = new SolrQuery(); - filterName = SolrUtil.makeSearcableString(filterName); - solrQuery.setQuery(LogSearchConstants.COMPOSITE_KEY + ":" + filterName + "-" + rowType); - SolrUtil.setRowCount(solrQuery, 0); - try { - Long numFound = userConfigSolrDao.process(solrQuery).getResults().getNumFound(); - if (numFound > 0) { - return true; - } - } catch (SolrException | SolrServerException | IOException e) { - logger.error("Error while checking if userConfig is unique.", e); - } - } - return false; - } - - private boolean isValid(VUserConfig vHistory) { - return !StringUtils.isBlank(vHistory.getFiltername()) - && !StringUtils.isBlank(vHistory.getRowType()) - && !StringUtils.isBlank(vHistory.getUserName()) - && !StringUtils.isBlank(vHistory.getValues()); - } - - public void deleteUserConfig(String id) { - try { - userConfigSolrDao.deleteUserConfig(id); - } catch (SolrException | SolrServerException | IOException e) { - throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); - } - } - - @SuppressWarnings("unchecked") - public String getUserConfig(SearchCriteria searchCriteria) { - - SolrDocumentList solrList = new SolrDocumentList(); - VUserConfigList userConfigList = new VUserConfigList(); - - String rowType = (String) searchCriteria.getParamValue(LogSearchConstants.ROW_TYPE); - if (StringUtils.isBlank(rowType)) { - throw RESTErrorUtil.createRESTException("row type was not specified", MessageEnums.INVALID_INPUT_DATA); - } - - String userName = (String) searchCriteria.getParamValue(LogSearchConstants.USER_NAME); - if (StringUtils.isBlank(userName)) { - throw RESTErrorUtil.createRESTException("user name was not specified", MessageEnums.INVALID_INPUT_DATA); - } - String filterName = (String) searchCriteria.getParamValue(LogSearchConstants.FILTER_NAME); - filterName = StringUtils.isBlank(filterName) ? "*" : "*" + filterName + "*"; - - try { - - SolrQuery userConfigQuery = new SolrQuery(); - SolrUtil.setMainQuery(userConfigQuery, null); - queryGenerator.setPagination(userConfigQuery, searchCriteria); - queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.ROW_TYPE, rowType); - queryGenerator.setSingleORFilter(userConfigQuery, LogSearchConstants.USER_NAME, userName, LogSearchConstants.SHARE_NAME_LIST, userName); - queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName)); - - if (StringUtils.isBlank(searchCriteria.getSortBy())) { - searchCriteria.setSortBy(LogSearchConstants.FILTER_NAME); - } - if (StringUtils.isBlank(searchCriteria.getSortType())) { - searchCriteria.setSortType("" + SolrQuery.ORDER.asc); - } - - queryGenerator.setSingleSortOrder(userConfigQuery, searchCriteria); - solrList = userConfigSolrDao.process(userConfigQuery).getResults(); - - Collection configList = new ArrayList(); - - for (SolrDocument solrDoc : solrList) { - VUserConfig userConfig = new VUserConfig(); - userConfig.setFiltername("" + solrDoc.get(LogSearchConstants.FILTER_NAME)); - userConfig.setId("" + solrDoc.get(LogSearchConstants.ID)); - userConfig.setValues("" + solrDoc.get(LogSearchConstants.VALUES)); - userConfig.setRowType("" + solrDoc.get(LogSearchConstants.ROW_TYPE)); - try { - List shareNameList = (List) solrDoc.get(LogSearchConstants.SHARE_NAME_LIST); - userConfig.setShareNameList(shareNameList); - } catch (Exception e) { - // do nothing - } - - userConfig.setUserName("" + solrDoc.get(LogSearchConstants.USER_NAME)); - - configList.add(userConfig); - } - - userConfigList.setName("historyList"); - userConfigList.setUserConfigList(configList); - - userConfigList.setStartIndex(searchCriteria.getStartIndex()); - userConfigList.setPageSize((int) searchCriteria.getMaxRows()); - - userConfigList.setTotalCount((long) solrList.getNumFound()); - } catch (SolrException | SolrServerException | IOException e) { - // do nothing - logger.error(e); - throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); - } - - return convertObjToString(userConfigList); - - } - - public String updateUserConfig(VUserConfig vuserConfig) { - return saveUserConfig(vuserConfig); - } - - // ////////////////////////////LEVEL FILTER///////////////////////////////////// - - public String getUserFilter() { - VLogfeederFilterWrapper userFilter; - try { - userFilter = userConfigSolrDao.getUserFilter(); - } catch (SolrServerException | IOException e) { - logger.error(e); - throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); - } - return convertObjToString(userFilter); - } - - public String saveUserFiter(String json) { - if (!StringUtils.isBlank(json)) { - VLogfeederFilterWrapper logfeederFilterWrapper = (VLogfeederFilterWrapper) JSONUtil.jsonToObj(json, VLogfeederFilterWrapper.class); - try { - if (logfeederFilterWrapper == null) { - logger.error(json + " is a invalid json"); - } - userConfigSolrDao.saveUserFilter(logfeederFilterWrapper); - } catch (SolrException | SolrServerException | IOException e) { - logger.error("user config not able to save", e); - throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); - } - } - return getUserFilter(); - } - - public String getAllUserName() { - List userList = new ArrayList(); - try { - SolrQuery userListQuery = new SolrQuery(); - SolrUtil.setMainQuery(userListQuery, null); - SolrUtil.setFacetField(userListQuery, LogSearchConstants.USER_NAME); - QueryResponse queryResponse = userConfigSolrDao.process(userListQuery); - if (queryResponse == null) { - return convertObjToString(userList); - } - List counList = queryResponse.getFacetField(LogSearchConstants.USER_NAME).getValues(); - for (Count cnt : counList) { - String userName = cnt.getName(); - userList.add(userName); - } - } catch (SolrException | SolrServerException | IOException e) { - logger.warn("Error getting all users.", e); - throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM); - } - return convertObjToString(userList); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/AnyGraphParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/AnyGraphParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/AnyGraphParamDefinition.java new file mode 100644 index 0000000..e92d7bf --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/AnyGraphParamDefinition.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.X_AXIS_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.Y_AXIS_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.STACK_BY_D; + +public interface AnyGraphParamDefinition { + + String getxAxis(); + + @ApiParam(value = X_AXIS_D, name = LogSearchConstants.REQUEST_PARAM_XAXIS) + void setxAxis(String xAxis); + + String getyAxis(); + + @ApiParam(value = Y_AXIS_D, name = LogSearchConstants.REQUEST_PARAM_YAXIS) + void setyAxis(String yAxis); + + String getStackBy(); + + @ApiParam(value = STACK_BY_D, name = LogSearchConstants.REQUEST_PARAM_STACK_BY) + void setStackBy(String stackBy); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/BundleIdParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/BundleIdParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/BundleIdParamDefinition.java new file mode 100644 index 0000000..aa1a393 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/BundleIdParamDefinition.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.BUNDLE_ID; + +public interface BundleIdParamDefinition { + + String getBundleId(); + + @ApiParam(value = BUNDLE_ID, name = LogSearchConstants.REQUEST_PARAM_BUNDLE_ID) + void setBundleId(String bundleId); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/CommonSearchParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/CommonSearchParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/CommonSearchParamDefinition.java new file mode 100644 index 0000000..ef334d1 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/CommonSearchParamDefinition.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.START_TIME_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.END_TIME_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.START_INDEX_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.PAGE_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.PAGE_SIZE_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.SORT_BY_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.SORT_TYPE_D; + + +public interface CommonSearchParamDefinition { + + String getStartIndex(); + + @ApiParam(value = START_INDEX_D, name = LogSearchConstants.REQUEST_PARAM_START_INDEX) + void setStartIndex(String startIndex); + + String getPage(); + + @ApiParam(value = PAGE_D, name = LogSearchConstants.REQUEST_PARAM_PAGE) + void setPage(String page); + + String getPageSize(); + + @ApiParam(value = PAGE_SIZE_D, name = LogSearchConstants.REQUEST_PARAM_PAGE_SIZE) + void setPageSize(String pageSize); + + String getSortBy(); + + @ApiParam(value = SORT_BY_D, name = LogSearchConstants.REQUEST_PARAM_SORT_BY) + void setSortBy(String sortBy); + + String getSortType(); + + @ApiParam(value = SORT_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_SORT_TYPE) + void setSortType(String sortType); + + String getStartTime(); + + @ApiParam(value = START_TIME_D, name = LogSearchConstants.REQUEST_PARAM_START_TIME) + void setStartTime(String startTime); + + String getEndTime(); + + @ApiParam(value = END_TIME_D, name = LogSearchConstants.REQUEST_PARAM_END_TIME) + void setEndTime(String endTime); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/DateRangeParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/DateRangeParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/DateRangeParamDefinition.java new file mode 100644 index 0000000..e6edf7c --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/DateRangeParamDefinition.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.FROM_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.TO_D; + +public interface DateRangeParamDefinition { + + String getFrom(); + + @ApiParam(value = FROM_D, name = LogSearchConstants.REQUEST_PARAM_FROM) + void setFrom(String from); + + String getTo(); + + @ApiParam(value = TO_D, name = LogSearchConstants.REQUEST_PARAM_TO) + void setTo(String to); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java new file mode 100644 index 0000000..396fa93 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.FIELD_D; + +public interface FieldParamDefinition { + + String getField(); + + @ApiParam(value = FIELD_D, name = LogSearchConstants.REQUEST_PARAM_FIELD) + void setField(String field); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FormatParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FormatParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FormatParamDefinition.java new file mode 100644 index 0000000..47f0620 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FormatParamDefinition.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.FORMAT_D; + +public interface FormatParamDefinition { + + String getFormat(); + + @ApiParam(value = FORMAT_D, name = LogSearchConstants.REQUEST_PARAM_FORMAT) + void setFormat(String format); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LastPageParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LastPageParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LastPageParamDefinition.java new file mode 100644 index 0000000..c8531db --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LastPageParamDefinition.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.IS_LAST_PAGE_D; + +public interface LastPageParamDefinition { + boolean isLastPage(); + + @ApiParam(value = IS_LAST_PAGE_D, name = LogSearchConstants.REQUEST_PARAM_LAST_PAGE) + void setLastPage(boolean lastPage); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java new file mode 100644 index 0000000..c355989 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.COMPONENT_D; +import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.HOST_D; +import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.LOG_TYPE_D; + + +public interface LogFileParamDefinition { + + String getComponent(); + + @ApiParam(value = COMPONENT_D, name = LogSearchConstants.REQUEST_PARAM_COMPONENT) + void setComponent(String component); + + String getHost(); + + @ApiParam(value = HOST_D, name = LogSearchConstants.REQUEST_PARAM_HOST) + void setHost(String host); + + String getLogType(); + + @ApiParam(value = LOG_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_LOG_TYPE) + void setLogType(String logType); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java new file mode 100644 index 0000000..a527c48 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.TAIL_SIZE_D; + +public interface LogFileTailParamDefinition { + + String getTailSize(); + + @ApiParam(value = TAIL_SIZE_D, name = LogSearchConstants.REQUEST_PARAM_TAIL_SIZE) + void setTailSize(String tailSize); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java new file mode 100644 index 0000000..e503ff5 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.COLUMN_QUERY_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.I_MESSAGE_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.G_E_MESSAGE_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.MUST_BE_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.MUST_NOT_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.INCLUDE_QUERY_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.EXCLUDE_QUERY_D; + +public interface LogParamDefinition { + + String getColumnQuery(); + + @ApiParam(value = COLUMN_QUERY_D, name = LogSearchConstants.REQUEST_PARAM_COLUMN_QUERY) + void setColumnQuery(String columnQuery); + + String getiMessage(); + + @ApiParam(value = I_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_I_MESSAGE) + void setiMessage(String iMessage); + + String getgEMessage(); + + @ApiParam(value = G_E_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_G_E_MESSAGE) + void setgEMessage(String gEMessage); + + String getMustBe(); + + @ApiParam(value = MUST_BE_D, name = LogSearchConstants.REQUEST_PARAM_MUST_BE) + void setMustBe(String mustBe); + + String getMustNot(); + + @ApiParam(value = MUST_NOT_D, name = LogSearchConstants.REQUEST_PARAM_MUST_NOT) + void setMustNot(String mustNot); + + String getIncludeQuery(); + + @ApiParam(value = INCLUDE_QUERY_D, name = LogSearchConstants.REQUEST_PARAM_INCLUDE_QUERY) + void setIncludeQuery(String includeQuery); + + String getExcludeQuery(); + + @ApiParam(value = EXCLUDE_QUERY_D, name = LogSearchConstants.REQUEST_PARAM_EXCLUDE_QUERY) + void setExcludeQuery(String excludeQuery); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java new file mode 100644 index 0000000..c3e2998 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.ID_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.SCROLL_TYPE_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.NUMBER_ROWS_D; + +public interface LogTruncatedParamDefinition { + + String getId(); + + @ApiParam(value = ID_D, name = LogSearchConstants.REQUEST_PARAM_ID) + void setId(String id); + + String getScrollType(); + + @ApiParam(value = SCROLL_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_SCROLL_TYPE) + void setScrollType(String scrollType); + + String getNumberRows(); + + @ApiParam(value = NUMBER_ROWS_D, name = LogSearchConstants.REQUEST_PARAM_NUMBER_ROWS) + void setNumberRows(String numberRows); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java new file mode 100644 index 0000000..3fcdbc0 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.QUERY_D; + +public interface QueryParamDefinition { + + String getQuery(); + + @ApiParam(value = QUERY_D, name = LogSearchConstants.REQUEST_PARAM_QUERY) + void setQuery(String query); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/SearchRequest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/SearchRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/SearchRequest.java new file mode 100644 index 0000000..0015c09 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/SearchRequest.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import org.apache.ambari.logsearch.common.Marker; + +@Marker +public interface SearchRequest { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java new file mode 100644 index 0000000..a266b3e --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.HOST_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.COMPONENT_D; + +public interface ServiceLogFileParamDefinition { + + String getHostLogFile(); + + @ApiParam(value = HOST_D, name = LogSearchConstants.REQUEST_PARAM_HOST_LOG_FILE) + void setHostLogFile(String hostLogFile); + + String getComponentLogFile(); + + @ApiParam(value = COMPONENT_D, name = LogSearchConstants.REQUEST_PARAM_COMPONENT_LOG_FILE) + void setComponentLogFile(String componentLogFile); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java new file mode 100644 index 0000000..f280ac2 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.LEVEL_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.ADVANCED_SEARCH_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.TREE_PARAMS_D; +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.E_MESSAGE_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.G_MUST_NOT_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.HOST_NAME_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.COMPONENT_NAME_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.FILE_NAME_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.DATE_RANGE_LABEL_D; + +public interface ServiceLogParamDefinition { + + String getLevel(); + + @ApiParam(value = LEVEL_D, name = LogSearchConstants.REQUEST_PARAM_LEVEL) + void setLevel(String level); + + String getAdvancedSearch(); + + @ApiParam(value = ADVANCED_SEARCH_D, name = LogSearchConstants.REQUEST_PARAM_ADVANCED_SEARCH) + void setAdvancedSearch(String advancedSearch); + + String getTreeParams(); + + @ApiParam(value = TREE_PARAMS_D, name = LogSearchConstants.REQUEST_PARAM_TREE_PARAMS) + void setTreeParams(String treeParams); + + String geteMessage(); + + @ApiParam(value = E_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_E_MESSAGE) + void seteMessage(String eMessage); + + String getgMustNot(); + + @ApiParam(value = G_MUST_NOT_D, name = LogSearchConstants.REQUEST_PARAM_G_MUST_NOT) + void setgMustNot(String gMustNot); + + String getHostName(); + + @ApiParam(value = HOST_NAME_D, name = LogSearchConstants.REQUEST_PARAM_HOST_NAME) + void setHostName(String hostName); + + String getComponentName(); + + @ApiParam(value = COMPONENT_NAME_D, name = LogSearchConstants.REQUEST_PARAM_COMPONENT_NAME) + void setComponentName(String componentName); + + String getFileName(); + + @ApiParam(value = FILE_NAME_D, name = LogSearchConstants.REQUEST_PARAM_FILE_NAME) + void setFileName(String fileName); + + String getDateRangeLabel(); + + @ApiParam(value = DATE_RANGE_LABEL_D, name = LogSearchConstants.REQUEST_PARAM_DATE_RANGE_LABEL) + void setDateRangeLabel(String dateRangeLabel); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogSearchParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogSearchParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogSearchParamDefinition.java new file mode 100644 index 0000000..9d8f1a6 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogSearchParamDefinition.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.FIND_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.KEYWORD_TYPE_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.SOURCE_LOG_ID_D; +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.TOKEN_D; + +public interface ServiceLogSearchParamDefinition { + + String getKeyWord(); + + @ApiParam(value = FIND_D, name = LogSearchConstants.REQUEST_PARAM_KEYWORD) + void setKeyWord(String keyWord); + + String getSourceLogId(); + + @ApiParam(value = SOURCE_LOG_ID_D, name = LogSearchConstants.REQUEST_PARAM_SOURCE_LOG_ID) + void setSourceLogId(String sourceLogId); + + String getKeywordType(); + + @ApiParam(value = KEYWORD_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_KEYWORD_TYPE) + void setKeywordType(String keywordType); + + String getToken(); + + @ApiParam(value = TOKEN_D, name = LogSearchConstants.REQUEST_PARAM_TOKEN) + void setToken(String token); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UnitParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UnitParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UnitParamDefinition.java new file mode 100644 index 0000000..3f493da --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UnitParamDefinition.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.UNIT_D; + +public interface UnitParamDefinition { + + String getUnit(); + + @ApiParam(value = UNIT_D, name = LogSearchConstants.REQUEST_PARAM_UNIT) + void setUnit(String unit); + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java new file mode 100644 index 0000000..23b350a --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigDescriptions.USER_ID_D; +import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigDescriptions.FILTER_NAME_D; +import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigDescriptions.ROW_TYPE_D; + +public interface UserConfigParamDefinition { + + String getUserId(); + + @ApiParam(value = USER_ID_D, name = LogSearchConstants.REQUEST_PARAM_USER_ID) + void setUserId(String userId); + + String getFilterName(); + + @ApiParam(value = FILTER_NAME_D, name = LogSearchConstants.REQUEST_PARAM_FILTER_NAME) + void setFilterName(String filterName); + + String getRowType(); + + @ApiParam(value = ROW_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_ROW_TYPE) + void setRowType(String rowType); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UtcOffsetParamDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UtcOffsetParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UtcOffsetParamDefinition.java new file mode 100644 index 0000000..aa2be71 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UtcOffsetParamDefinition.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; + +import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.UTC_OFFSET_D; + +public interface UtcOffsetParamDefinition { + + String getUtcOffset(); + + @ApiParam(value = UTC_OFFSET_D, name = LogSearchConstants.REQUEST_PARAM_UTC_OFFSET) + void setUtcOffset(String utcOffset); +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java new file mode 100644 index 0000000..41da712 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request.impl; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.model.request.AnyGraphParamDefinition; +import org.apache.ambari.logsearch.model.request.DateRangeParamDefinition; +import org.apache.ambari.logsearch.model.request.UnitParamDefinition; + +import javax.ws.rs.QueryParam; + +public class AnyGraphRequest extends CommonSearchRequest + implements AnyGraphParamDefinition, DateRangeParamDefinition, UnitParamDefinition{ + + @QueryParam(LogSearchConstants.REQUEST_PARAM_XAXIS) + private String xAxis; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_YAXIS) + private String yAxis; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_STACK_BY) + private String stackBy; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM) + private String from; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_TO) + private String to; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT) + private String unit; + + @Override + public String getxAxis() { + return xAxis; + } + + @Override + public void setxAxis(String xAxis) { + this.xAxis = xAxis; + } + + @Override + public String getyAxis() { + return yAxis; + } + + @Override + public void setyAxis(String yAxis) { + this.yAxis = yAxis; + } + + @Override + public String getStackBy() { + return stackBy; + } + + @Override + public void setStackBy(String stackBy) { + this.stackBy = stackBy; + } + + @Override + public String getFrom() { + return from; + } + + @Override + public void setFrom(String from) { + this.from = from; + } + + @Override + public String getTo() { + return to; + } + + @Override + public void setTo(String to) { + this.to = to; + } + + @Override + public String getUnit() { + return unit; + } + + @Override + public void setUnit(String unit) { + this.unit = unit; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java new file mode 100644 index 0000000..91e7d1e --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request.impl; + +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.model.request.UnitParamDefinition; + +import javax.ws.rs.QueryParam; + +public class AuditBarGraphRequest extends BaseAuditLogRequest implements UnitParamDefinition { + + @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT) + private String unit; + + @Override + public String getUnit() { + return unit; + } + + @Override + public void setUnit(String unit) { + this.unit = unit; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java new file mode 100644 index 0000000..8dd13dc --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request.impl; + +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.model.request.LastPageParamDefinition; + +import javax.ws.rs.QueryParam; + +public class AuditLogRequest extends BaseAuditLogRequest implements LastPageParamDefinition { + + @QueryParam(LogSearchConstants.REQUEST_PARAM_LAST_PAGE) + private boolean isLastPage; + + @Override + public boolean isLastPage() { + return isLastPage; + } + + @Override + public void setLastPage(boolean lastPage) { + isLastPage = lastPage; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java new file mode 100644 index 0000000..74b4ab7 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request.impl; + +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.model.request.DateRangeParamDefinition; + +import javax.ws.rs.QueryParam; + +public class BaseAuditLogRequest extends BaseLogRequest implements DateRangeParamDefinition { + + @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM) + private String from; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_TO) + private String to; + + @Override + public String getFrom() { + return from; + } + + @Override + public void setFrom(String from) { + this.from = from; + } + + @Override + public String getTo() { + return to; + } + + @Override + public void setTo(String to) { + this.to = to; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/bda3a1eb/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java new file mode 100644 index 0000000..5a96991 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.logsearch.model.request.impl; + +import io.swagger.annotations.ApiParam; +import org.apache.ambari.logsearch.common.LogSearchConstants; +import org.apache.ambari.logsearch.model.request.LogParamDefinition; + +import javax.ws.rs.QueryParam; + +public class BaseLogRequest extends QueryRequest implements LogParamDefinition { + @QueryParam(LogSearchConstants.REQUEST_PARAM_COLUMN_QUERY) + private String columnQuery; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_I_MESSAGE) + private String iMessage; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_G_E_MESSAGE) + private String gEMessage; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_MUST_BE) + private String mustBe; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_MUST_NOT) + private String mustNot; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_EXCLUDE_QUERY) + private String excludeQuery; + + @QueryParam(LogSearchConstants.REQUEST_PARAM_INCLUDE_QUERY) + private String includeQuery; + + @Override + public String getColumnQuery() { + return columnQuery; + } + + @Override + public void setColumnQuery(String columnQuery) { + this.columnQuery = columnQuery; + } + + @Override + public String getiMessage() { + return iMessage; + } + + @Override + public void setiMessage(String iMessage) { + this.iMessage = iMessage; + } + + @Override + public String getgEMessage() { + return gEMessage; + } + + @Override + public void setgEMessage(String gEMessage) { + this.gEMessage = gEMessage; + } + + @Override + public String getMustBe() { + return mustBe; + } + + @Override + public void setMustBe(String mustBe) { + this.mustBe = mustBe; + } + + @Override + public String getMustNot() { + return mustNot; + } + + @Override + public void setMustNot(String mustNot) { + this.mustNot = mustNot; + } + + @Override + public String getIncludeQuery() { + return includeQuery; + } + + @Override + public void setIncludeQuery(String includeQuery) { + this.includeQuery = includeQuery; + } + + @Override + public String getExcludeQuery() { + return excludeQuery; + } + + @Override + public void setExcludeQuery(String excludeQuery) { + this.excludeQuery = excludeQuery; + } +}