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 B5A99200BC5 for ; Mon, 7 Nov 2016 21:51:30 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id B4741160B1D; Mon, 7 Nov 2016 20:51:30 +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 BA291160AEC for ; Mon, 7 Nov 2016 21:51:27 +0100 (CET) Received: (qmail 57396 invoked by uid 500); 7 Nov 2016 20:51:26 -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 56443 invoked by uid 99); 7 Nov 2016 20:51:25 -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; Mon, 07 Nov 2016 20:51:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4FFD2F16B8; Mon, 7 Nov 2016 20:51:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ncole@apache.org To: commits@ambari.apache.org Date: Mon, 07 Nov 2016 20:51:45 -0000 Message-Id: In-Reply-To: <4ebb78072e18430f93a3fac65827b60c@git.apache.org> References: <4ebb78072e18430f93a3fac65827b60c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [22/55] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere) archived-at: Mon, 07 Nov 2016 20:51:30 -0000 http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java deleted file mode 100644 index 8095faf..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java +++ /dev/null @@ -1,340 +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.query; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; - -import org.apache.ambari.logsearch.common.LogSearchConstants; -import org.apache.ambari.logsearch.common.PropertiesHelper; -import org.apache.ambari.logsearch.conf.SolrAuditLogPropsConfig; -import org.apache.ambari.logsearch.conf.SolrServiceLogPropsConfig; -import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; -import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria; -import org.apache.ambari.logsearch.query.model.SearchCriteria; -import org.apache.ambari.logsearch.dao.SolrDaoBase; -import org.apache.ambari.logsearch.manager.ManagerBase.LogType; -import org.apache.ambari.logsearch.util.JSONUtil; -import org.apache.ambari.logsearch.util.SolrUtil; -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; -import org.apache.lucene.analysis.core.KeywordTokenizerFactory; -import org.apache.lucene.analysis.path.PathHierarchyTokenizerFactory; -import org.apache.lucene.analysis.standard.StandardTokenizerFactory; -import org.apache.solr.client.solrj.SolrQuery; -import org.apache.solr.schema.TrieDoubleField; -import org.apache.solr.schema.TrieFloatField; -import org.apache.solr.schema.TrieLongField; -import org.springframework.stereotype.Component; - -import javax.inject.Inject; - -@Component -public class QueryGeneration extends QueryGenerationBase { - - private static Logger logger = Logger.getLogger(QueryGeneration.class); - - @Inject - private SolrServiceLogPropsConfig solrServiceLogPropsConfig; - - @Inject - private SolrAuditLogPropsConfig solrAuditLogPropsConfig; - - public SolrQuery commonServiceFilterQuery(CommonServiceLogSearchCriteria searchCriteria) { - LogType logType = LogType.SERVICE; - SolrQuery solrQuery = new SolrQuery(); - // TODO: check these are used from the UI or not - String globalExcludeComp = (String) searchCriteria.getParamValue("gMustNot"); - String unselectedComp = (String) searchCriteria.getParamValue("unselectComp"); - - String givenQuery = (String) searchCriteria.getParamValue("q"); - String level = searchCriteria.getLevel(); - String startTime = searchCriteria.getFrom(); - String endTime = searchCriteria.getTo(); - String iMessage = searchCriteria.getIncludeMessage(); - String eMessage = searchCriteria.getExcludeMessage(); - String selectedComp = searchCriteria.getSelectComp(); - String bundleId = searchCriteria.getBundleId(); - String urlHostName = searchCriteria.getHostName(); - String urlComponentName = searchCriteria.getComponentName(); - String file_name = searchCriteria.getFileName(); - - SolrUtil.setMainQuery(solrQuery, givenQuery); - - setSingleRangeFilter(solrQuery, LogSearchConstants.LOGTIME, startTime, endTime); - addFilter(solrQuery, selectedComp, LogSearchConstants.SOLR_COMPONENT, Condition.OR); - - setFilterClauseWithFieldName(solrQuery, level, LogSearchConstants.SOLR_LEVEL, LogSearchConstants.NO_OPERATOR, Condition.OR); - - setFilterClauseForSolrSearchableString(solrQuery, iMessage, Condition.OR, LogSearchConstants.NO_OPERATOR, LogSearchConstants.SOLR_KEY_LOG_MESSAGE); - setFilterClauseForSolrSearchableString(solrQuery, eMessage, Condition.AND, LogSearchConstants.MINUS_OPERATOR, LogSearchConstants.SOLR_KEY_LOG_MESSAGE); - - applyLogFileFilter(solrQuery, searchCriteria); - - setFilterClauseWithFieldName(solrQuery, globalExcludeComp, LogSearchConstants.SOLR_COMPONENT, LogSearchConstants.MINUS_OPERATOR, Condition.AND); - setFilterClauseWithFieldName(solrQuery, unselectedComp, LogSearchConstants.SOLR_COMPONENT, LogSearchConstants.MINUS_OPERATOR, Condition.AND); - - urlHostName = SolrUtil.escapeQueryChars(urlHostName); - setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_HOST, urlHostName); - urlComponentName = SolrUtil.escapeQueryChars(urlComponentName); - setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_COMPONENT, urlComponentName); - - setPagination(solrQuery, searchCriteria); - setSortOrderDefaultServiceLog(solrQuery, searchCriteria); - setSingleIncludeFilter(solrQuery, LogSearchConstants.BUNDLE_ID, bundleId); - file_name = SolrUtil.escapeQueryChars(file_name); - setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_PATH, file_name); - setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.INCLUDE_QUERY, LogSearchConstants.INCLUDE_QUERY, logType); - setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.EXCLUDE_QUERY, LogSearchConstants.EXCLUDE_QUERY, logType); - - return solrQuery; - } - - public void applyLogFileFilter(SolrQuery solrQuery, SearchCriteria searchCriteria) { - String hostLogFile = (String) searchCriteria.getParamValue("hostLogFile"); - String compLogFile = (String) searchCriteria.getParamValue("compLogFile"); - String givenQuery = (String) searchCriteria.getParamValue("q"); - String logfileQuery = ""; - if (!StringUtils.isBlank(hostLogFile) && !StringUtils.isBlank(compLogFile)) { - logfileQuery = LogSearchConstants.SOLR_HOST + ":" + hostLogFile + " " + Condition.AND + " " + - LogSearchConstants.SOLR_COMPONENT + ":" + compLogFile; - if (!StringUtils.isBlank(givenQuery)) { - logfileQuery = "(" + givenQuery + ") " + Condition.AND + " (" + logfileQuery + ")"; - } - if (!StringUtils.isBlank(logfileQuery)) { - solrQuery.addFilterQuery(logfileQuery); - } - } - } - - private void setUserSpecificFilter(SearchCriteria searchCriteria, SolrQuery solrQuery, String paramName, String operation, - LogType logType) { - String queryString = (String) searchCriteria.getParamValue(paramName); - if (StringUtils.isBlank(queryString)) { - queryString = null; - } - List conditionQuries = new ArrayList(); - List referalConditionQuries = new ArrayList(); - List elments = new ArrayList(); - List> queryList = JSONUtil.jsonToMapObjectList(queryString); - if (queryList != null && queryList.size() > 0) { - for (HashMap columnListMap : queryList) { - String orQuery = ""; - StringBuilder field = new StringBuilder(); - if (columnListMap != null) { - for (String key : columnListMap.keySet()) { - if (!StringUtils.isBlank(key)) {; - String value = getOriginalValue(key, "" + columnListMap.get(key)); - orQuery = putWildCardByType(value, key, logType); - if (StringUtils.isBlank(orQuery)) { - logger.debug("Removing invalid filter for key :"+key +" and value :" +value ); - continue; - } - boolean isSame = false; - if (elments.contains(key)) { - isSame = true; - } - if (isSame && !operation.equals(LogSearchConstants.EXCLUDE_QUERY)) { - for (String tempCondition : conditionQuries) { - if (tempCondition.contains(key)) { - String newCondtion = tempCondition + " " + Condition.OR.name() + " " + orQuery; - referalConditionQuries.remove(tempCondition); - referalConditionQuries.add(newCondtion); - } - } - conditionQuries.clear(); - conditionQuries.addAll(referalConditionQuries); - } else { - conditionQuries.add(orQuery); - referalConditionQuries.add(orQuery); - } - field.append(key); - elments.add(field.toString()); - } - } - } - } - } - if (!referalConditionQuries.isEmpty() && !StringUtils.isBlank(operation)) { - if (operation.equals(LogSearchConstants.INCLUDE_QUERY)) { - for (String filter : referalConditionQuries) { - if (!StringUtils.isBlank(filter)) { - solrQuery.addFilterQuery(filter); - } - } - } else if (operation.equals(LogSearchConstants.EXCLUDE_QUERY)) { - for (String filter : referalConditionQuries) { - if (!StringUtils.isBlank(filter)) { - filter = LogSearchConstants.MINUS_OPERATOR + filter; - solrQuery.addFilterQuery(filter); - } - } - } - } - } - - public SolrQuery commonAuditFilterQuery(CommonSearchCriteria searchCriteria) { - LogType logType = LogType.AUDIT; - SolrQuery solrQuery = new SolrQuery(); - solrQuery.setQuery("*:*"); - - String startTime = searchCriteria.getStartTime(); - String endTime = searchCriteria.getEndTime(); - String selectedComp = searchCriteria.getMustBe(); - setFilterClauseWithFieldName(solrQuery, selectedComp, LogSearchConstants.AUDIT_COMPONENT, LogSearchConstants.NO_OPERATOR, Condition.OR); - setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.INCLUDE_QUERY, LogSearchConstants.INCLUDE_QUERY, logType); - setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.EXCLUDE_QUERY, LogSearchConstants.EXCLUDE_QUERY, logType); - setSingleRangeFilter(solrQuery, LogSearchConstants.AUDIT_EVTTIME, startTime, endTime); - setPagination(solrQuery, searchCriteria); - try { - if (searchCriteria.getSortBy() == null || searchCriteria.getSortBy().isEmpty()) { - searchCriteria.setSortBy(LogSearchConstants.AUDIT_EVTTIME); - searchCriteria.setSortType(SolrQuery.ORDER.desc.toString()); - } - } catch (Exception e) { - searchCriteria.setSortBy(LogSearchConstants.AUDIT_EVTTIME); - searchCriteria.setSortType(SolrQuery.ORDER.desc.toString()); - } - setSortOrderDefaultServiceLog(solrQuery, searchCriteria); - return solrQuery; - } - - private String putWildCardByType(String str, String key, LogType logType) { - String fieldType; - SolrDaoBase solrDaoBase = null; - switch (logType) { - case AUDIT: - fieldType = auditSolrDao.schemaFieldNameMap.get(key); - solrDaoBase = auditSolrDao; - break; - case SERVICE: - fieldType = serviceLogsSolrDao.schemaFieldNameMap.get(key); - solrDaoBase = serviceLogsSolrDao; - if (key.equalsIgnoreCase(LogSearchConstants.SOLR_LOG_MESSAGE)) { - return SolrUtil.escapeForLogMessage(key, str); - } - break; - default: - // set as null - logger.error("Invalid logtype :" + logType); - fieldType = null; - } - if (!StringUtils.isBlank(fieldType)) { - if (SolrUtil.isSolrFieldNumber(fieldType, solrDaoBase)) { - String value = putEscapeCharacterForNumber(str, fieldType,solrDaoBase); - if (!StringUtils.isBlank(value)) { - return key + ":" + value; - } else { - return null; - } - } else if (checkTokenizer(fieldType, StandardTokenizerFactory.class,solrDaoBase)) { - return key + ":" + SolrUtil.escapeForStandardTokenizer(str); - } else if (checkTokenizer(fieldType, KeywordTokenizerFactory.class,solrDaoBase)|| "string".equalsIgnoreCase(fieldType)) { - return key + ":" + SolrUtil.makeSolrSearchStringWithoutAsterisk(str); - } else if (checkTokenizer(fieldType, PathHierarchyTokenizerFactory.class,solrDaoBase)) { - return key + ":" + str; - } - } - return key + ":" + "*" + str + "*"; - } - - private String putEscapeCharacterForNumber(String str,String fieldType,SolrDaoBase solrDaoBase) { - if (!StringUtils.isBlank(str)) { - str = str.replace("*", ""); - } - String escapeCharSting = parseInputValueAsPerFieldType(str,fieldType,solrDaoBase); - if (escapeCharSting == null || escapeCharSting.isEmpty()) { - return null; - } - escapeCharSting = escapeCharSting.replace("-", "\\-"); - return escapeCharSting; - } - - private String parseInputValueAsPerFieldType(String str,String fieldType,SolrDaoBase solrDaoBase ) { - try { - HashMap fieldTypeInfoMap= SolrUtil.getFieldTypeInfoMap(fieldType,solrDaoBase); - String className = (String) fieldTypeInfoMap.get("class"); - if( className.equalsIgnoreCase(TrieDoubleField.class.getSimpleName())){ - return ""+ Double.parseDouble(str); - }else if(className.equalsIgnoreCase(TrieFloatField.class.getSimpleName())){ - return ""+ Float.parseFloat(str); - }else if(className.equalsIgnoreCase(TrieLongField.class.getSimpleName())){ - return ""+ Long.parseLong(str); - }else { - return "" + Integer.parseInt(str); - } - } catch (Exception e) { - logger.debug("Invaid input str: " + str + " For fieldType :" + fieldType); - return null; - } - } - - private String getOriginalValue(String name, String value) { - String solrValue = PropertiesHelper.getProperty(name); - if (StringUtils.isBlank(solrValue)) { - return value; - } - try { - String propertyFieldMappings[] = solrValue.split(LogSearchConstants.LIST_SEPARATOR); - if (propertyFieldMappings.length > 0) { - HashMap propertyFieldValue = new HashMap(); - for (String temp : propertyFieldMappings) { - if (!StringUtils.isBlank(temp)) { - String arrayValue[] = temp.split(":"); - if (arrayValue.length > 1) { - propertyFieldValue.put(arrayValue[0].toLowerCase(Locale.ENGLISH), arrayValue[1].toLowerCase(Locale.ENGLISH)); - } else { - logger.warn("array length is less than required length 1"); - } - } - } - String originalValue = propertyFieldValue.get(value.toLowerCase(Locale.ENGLISH)); - if (!StringUtils.isBlank(originalValue)) { - return originalValue; - } - } - } catch (Exception e) { - // do nothing - } - return value; - } - - - private boolean checkTokenizer(String fieldType, Class tokenizerFactoryClass, SolrDaoBase solrDaoBase) { - HashMap fieldTypeMap = SolrUtil.getFieldTypeInfoMap(fieldType,solrDaoBase); - HashMap analyzer = (HashMap) fieldTypeMap.get("analyzer"); - if (analyzer != null) { - HashMap tokenizerMap = (HashMap) analyzer.get("tokenizer"); - if (tokenizerMap != null) { - String tokenizerClass = (String) tokenizerMap.get("class"); - if (!StringUtils.isEmpty(tokenizerClass)) { - tokenizerClass =tokenizerClass.replace("solr.", ""); - if (tokenizerClass.equalsIgnoreCase(tokenizerFactoryClass - .getSimpleName())) { - return true; - } - } - } - } - return false; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java deleted file mode 100644 index 536f41c..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java +++ /dev/null @@ -1,282 +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.query; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.ambari.logsearch.common.LogSearchConstants; -import org.apache.ambari.logsearch.query.model.SearchCriteria; -import org.apache.ambari.logsearch.dao.AuditSolrDao; -import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao; -import org.apache.ambari.logsearch.util.SolrUtil; -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; -import org.apache.solr.client.solrj.SolrQuery; -import org.apache.solr.client.solrj.SolrQuery.ORDER; - -import com.google.gson.Gson; - -import javax.inject.Inject; - -public abstract class QueryGenerationBase { - - private static final Logger logger = Logger.getLogger(QueryGenerationBase.class); - - @Inject - protected AuditSolrDao auditSolrDao; - - @Inject - protected ServiceLogsSolrDao serviceLogsSolrDao; - - public enum Condition { - OR, AND - } - - // SetMethods to apply to the query - protected void setFilterClauseForSolrSearchableString(SolrQuery solrQuery, String commaSepratedString, Condition condition, - String operator, String messageField) { - String filterQuery = ""; - if (!StringUtils.isBlank(commaSepratedString)) { - StringBuilder queryMsg = new StringBuilder(); - operator = (operator == null ? LogSearchConstants.NO_OPERATOR : operator); - String[] msgList = commaSepratedString.split(LogSearchConstants.I_E_SEPRATOR); - int count = 0; - for (String temp : msgList) { - count += 1; - if (LogSearchConstants.SOLR_LOG_MESSAGE.equalsIgnoreCase(messageField)) { - queryMsg.append(" " + operator + SolrUtil.escapeForLogMessage(messageField, temp)); - } else { - temp = SolrUtil.escapeForStandardTokenizer(temp); - if(temp.startsWith("\"") && temp.endsWith("\"")){ - temp = temp.substring(1); - temp = temp.substring(0, temp.length()-1); - } - temp = "*" + temp + "*"; - queryMsg.append(" " + operator + messageField + ":" + temp); - } - if (msgList.length > count){ - queryMsg.append(" " + condition.name() + " "); - } - } - filterQuery = queryMsg.toString(); - solrQuery.addFilterQuery(filterQuery); - logger.debug("Filter added :- " + filterQuery); - } - } - - public void setFilterClauseWithFieldName(SolrQuery solrQuery, String commaSepratedString, String field, String operator, - Condition condition) { - if (!StringUtils.isBlank(commaSepratedString)) { - String[] arrayOfSepratedString = commaSepratedString.split(LogSearchConstants.LIST_SEPARATOR); - String filterQuery = null; - if (Condition.OR.equals(condition)) { - filterQuery = SolrUtil.orList(operator + field, arrayOfSepratedString,""); - } else if (Condition.AND.equals(condition)) { - filterQuery = SolrUtil.andList(operator + field, arrayOfSepratedString,""); - }else{ - logger.warn("Not a valid condition :" + condition.name()); - } - //add - if (!StringUtils.isBlank(filterQuery)){ - solrQuery.addFilterQuery(filterQuery); - logger.debug("Filter added :- " + filterQuery); - } - } - } - - public void setSortOrderDefaultServiceLog(SolrQuery solrQuery, SearchCriteria searchCriteria) { - List defaultSort = new ArrayList(); - if (!StringUtils.isBlank(searchCriteria.getSortBy())) { - ORDER order = SolrQuery.ORDER.asc; - if (!order.toString().equalsIgnoreCase(searchCriteria.getSortType())) { - order = SolrQuery.ORDER.desc; - } - SolrQuery.SortClause logtimeSortClause = SolrQuery.SortClause.create(searchCriteria.getSortBy(), order); - defaultSort.add(logtimeSortClause); - } else { - // by default sorting by logtime and sequence number in Descending order - SolrQuery.SortClause logtimeSortClause = SolrQuery.SortClause.create(LogSearchConstants.LOGTIME, SolrQuery.ORDER.desc); - defaultSort.add(logtimeSortClause); - - } - SolrQuery.SortClause sequenceNumberSortClause = SolrQuery.SortClause.create(LogSearchConstants.SEQUNCE_ID, SolrQuery.ORDER.desc); - defaultSort.add(sequenceNumberSortClause); - solrQuery.setSorts(defaultSort); - logger.debug("Sort Order :-" + defaultSort); - } - - public void setFilterFacetSort(SolrQuery solrQuery, SearchCriteria searchCriteria) { - if (!StringUtils.isBlank(searchCriteria.getSortBy())) { - solrQuery.setFacetSort(searchCriteria.getSortBy()); - logger.info("Sorted By :- " + searchCriteria.getSortBy()); - } - } - - public void setSingleSortOrder(SolrQuery solrQuery, SearchCriteria searchCriteria) { - List sort = new ArrayList(); - if (!StringUtils.isBlank(searchCriteria.getSortBy())) { - ORDER order = SolrQuery.ORDER.asc; - if (!order.toString().equalsIgnoreCase(searchCriteria.getSortType())) { - order = SolrQuery.ORDER.desc; - } - SolrQuery.SortClause sortOrder = SolrQuery.SortClause.create(searchCriteria.getSortBy(), order); - sort.add(sortOrder); - solrQuery.setSorts(sort); - logger.debug("Sort Order :-" + sort); - } - } - - // Search Criteria has parameter "sort" from it can get list of Sort Order - // Example of list can be [logtime desc,seq_num desc] - @SuppressWarnings("unchecked") - public void setMultipleSortOrder(SolrQuery solrQuery, SearchCriteria searchCriteria) { - List sort = new ArrayList(); - List sortList = (List) searchCriteria.getParamValue("sort"); - if (sortList != null) { - for (String sortOrder : sortList) { - if (!StringUtils.isBlank(sortOrder)) { - String sortByAndOrder[] = sortOrder.split(" "); - if (sortByAndOrder.length > 1) { - ORDER order = sortByAndOrder[1].contains("asc") ? SolrQuery.ORDER.asc : SolrQuery.ORDER.desc; - SolrQuery.SortClause solrSortClause = SolrQuery.SortClause.create(sortByAndOrder[0], order); - sort.add(solrSortClause); - logger.debug("Sort Order :-" + sort); - } else { - logger.warn("Not a valid sort Clause " + sortOrder); - } - } - } - solrQuery.setSorts(sort); - } - } - - public void setSingleIncludeFilter(SolrQuery solrQuery, String filterType, String filterValue) { - if (!StringUtils.isBlank(filterType) && !StringUtils.isBlank(filterValue)) { - String filterQuery = buildFilterQuery(filterType, filterValue); - solrQuery.addFilterQuery(filterQuery); - logger.debug("Filter added :- " + filterQuery); - } - } - - public void setSingleExcludeFilter(SolrQuery solrQuery, String filterType, String filterValue) { - if (!StringUtils.isBlank(filterValue) && !StringUtils.isBlank(filterType)) { - String filterQuery = LogSearchConstants.MINUS_OPERATOR + buildFilterQuery(filterType, filterValue); - solrQuery.addFilterQuery(filterQuery); - logger.debug("Filter added :- " + filterQuery); - } - } - - public void setSingleRangeFilter(SolrQuery solrQuery, String filterType, String filterFromValue, String filterToValue) { - if (!StringUtils.isBlank(filterToValue) && !StringUtils.isBlank(filterType) && !StringUtils.isBlank(filterFromValue)) { - String filterQuery = buildInclusiveRangeFilterQuery(filterType, filterFromValue, filterToValue); - if (!StringUtils.isBlank(filterQuery)) { - solrQuery.addFilterQuery(filterQuery); - logger.debug("Filter added :- " + filterQuery); - } - } - } - - public void setPagination(SolrQuery solrQuery, SearchCriteria searchCriteria) { - Integer startIndex = null; - Integer maxRows = null; - try { - startIndex = (Integer) searchCriteria.getStartIndex(); - SolrUtil.setStart(solrQuery, startIndex); - } catch (ClassCastException e) { - SolrUtil.setStart(solrQuery, 0); - } - try { - maxRows = (Integer) searchCriteria.getMaxRows(); - SolrUtil.setRowCount(solrQuery, maxRows); - } catch (ClassCastException e) { - SolrUtil.setRowCount(solrQuery, 10); - } - - if (startIndex != null && maxRows != null) - logger.info("Pagination was set from " + startIndex.intValue() + " to " + maxRows.intValue()); - } - - public void setSingleORFilter(SolrQuery solrQuery, String filterName1, String value1, String filterName2, String value2) { - String filterQuery = filterName1 + ":" + value1 + " " + Condition.OR.name() + " " + filterName2 + ":" + value2; - solrQuery.setFilterQueries(filterQuery); - } - - // BuildMethods to prepare a particular format as required for solr - public String buildInclusiveRangeFilterQuery(String filterType, String filterFromValue, String filterToValue) { - String filterQuery = filterType + ":[" + filterFromValue + " TO " + filterToValue + "]"; - logger.info("Build Filter was :- " + filterQuery); - return filterQuery; - } - - public String buildFilterQuery(String filterType, String filterValue) { - String filterQuery = filterType + ":" + filterValue; - logger.info("Build Filter Query was :- " + filterQuery); - return filterQuery; - } - - public String buildJSONFacetAggregatedFuncitonQuery(String function, String xAxisField) { - return "{x:'" + function + "(" + xAxisField + ")'}"; - } - - public String buildJSONFacetTermTimeRangeQuery(String fieldName, String fieldTime, String from, String to, String unit) { - String query = "{"; - query += "x" + ":{type:terms,field:" + fieldName + ",facet:{y:{type:range,field:" + fieldTime + ",start:\"" + from + "\",end:\"" + to + "\",gap:\"" + unit + "\"}}}"; - query += "}"; - logger.info("Build JSONQuery is :- " + query); - return query; - } - - public String buildJsonFacetTermsRangeQuery(String stackField, String xAxisField) { - String jsonQuery = "{ " + stackField + ": { type: terms,field:" + stackField + "," + "facet: { x: { type: terms, field:" + xAxisField + ",mincount:0,sort:{index:asc}}}}}"; - logger.info("Build JSONQuery is :- " + jsonQuery); - return jsonQuery; - } - - public String buidlJSONFacetRangeQueryForNumber(String stackField, String xAxisField, String function) { - String jsonQuery = "{ " + stackField + ": { type: terms,field:" + stackField + "," + "facet: { x:'" + function + "(" + xAxisField + ")'}}}}"; - logger.info("Build JSONQuery is :- " + jsonQuery); - return jsonQuery; - } - - private String buildListQuery(String paramValue, String solrFieldName, Condition condition) { - if (!StringUtils.isBlank(paramValue)) { - String[] values = paramValue.split(LogSearchConstants.LIST_SEPARATOR); - switch (condition) { - case OR: - return SolrUtil.orList(solrFieldName, values,""); - case AND: - return SolrUtil.andList(solrFieldName, values, ""); - default: - logger.error("Invalid condition " + condition.name()); - } - } - return ""; - } - - protected void addFilter(SolrQuery solrQuery, String paramValue, String solrFieldName, Condition condition) { - String filterQuery = buildListQuery(paramValue, solrFieldName, condition); - if (!StringUtils.isBlank(filterQuery)) { - if (solrQuery != null) { - solrQuery.addFilterQuery(filterQuery); - } - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java deleted file mode 100644 index 3c4df76..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java +++ /dev/null @@ -1,70 +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.query; - -public class SearchCriteriaConstants { - - private SearchCriteriaConstants() { - } - - public static final String PARAM_FIELD = "field"; - public static final String PARAM_UNIT = "unit"; - public static final String PARAM_INCLUDE_MESSAGE = "iMessage"; - public static final String PARAM_EXCLUDE_MESSAGE = "eMessage"; - public static final String PARAM_MUST_BE_STRING = "includeString"; - public static final String PARAM_MUST_NOT_STRING = "unselectComp"; - public static final String PARAM_EXCLUDE_QUERY = "excludeQuery"; - public static final String PARAM_INCLUDE_QUERY = "includeQuery"; - public static final String PARAM_START_TIME = "startTime"; - public static final String PARAM_END_TIME = "endTime"; - - public static final String PARAM_IS_LAST_PAGE = "isLastPage"; - - public static final String PARAM_GLOBAL_START_TIME = "globalStartTime"; - public static final String PARAM_GLOBAL_END_TIME = "globalEndTime"; - - public static final String PARAM_X_AXIS = "xAxis"; - public static final String PARAM_Y_AXIS = "yAxis"; - public static final String PARAM_STACK_BY = "stackBy"; - public static final String PARAM_FROM = "from"; - public static final String PARAM_TO = "to"; - - public static final String PARAM_COMPONENT_NAME = "component_name"; - public static final String PARAM_HOST_NAME = "host_name"; - public static final String PARAM_FILE_NAME = "file_name"; - public static final String PARAM_BUNDLE_ID = "bundle_id"; - public static final String PARAM_SELECT_COMP = "selectComp"; - public static final String PARAM_LEVEL = "level"; - - public static final String PARAM_ID = "id"; - public static final String PARAM_SCROLL_TYPE = "scrollType"; - public static final String PARAM_NUMBER_ROWS = "numberRows"; - - public static final String PARAM_FORMAT = "format"; - public static final String PARAM_UTC_OFFSET = "utcOffset"; - public static final String PARAM_KEYWORD = "keyword"; - public static final String PARAM_SOURCE_LOG_ID = "sourceLogId"; - public static final String PARAM_KEYWORD_TYPE = "keywordType"; - public static final String PARAM_TOKEN = "token"; - - public static final String PARAM_USER_NAME = "username"; - public static final String PARAM_FILTER_NAME = "filtername"; - public static final String PARAM_ROW_TYPE = "rowtype"; - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java deleted file mode 100644 index d40c5a1..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java +++ /dev/null @@ -1,44 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest; -import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; -import org.apache.commons.lang.StringEscapeUtils; -import org.springframework.stereotype.Component; - -@Component -public abstract class AbstractCommonAuditLogRequestConverter - extends AbstractCommonSearchRequestConverter { - - @Override - public RESULT convertToSearchCriteria(SOURCE request) { - RESULT criteria = createCriteria(request); - criteria.addParam("q", request.getQuery()); - criteria.setMustBe(request.getMustBe()); - criteria.setMustNot(request.getMustNot()); - criteria.setExcludeQuery(StringEscapeUtils.unescapeXml(request.getExcludeQuery())); - criteria.setIncludeQuery(StringEscapeUtils.unescapeXml(request.getIncludeQuery())); - criteria.setStartTime(request.getFrom()); - criteria.setEndTime(request.getTo()); - return criteria; - } - - public abstract RESULT createCriteria(SOURCE request); -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java deleted file mode 100644 index ea2c28a..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java +++ /dev/null @@ -1,55 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.CommonSearchRequest; -import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; -import org.apache.commons.lang.StringUtils; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_GLOBAL_END_TIME; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_GLOBAL_START_TIME; - -public abstract class AbstractCommonSearchRequestConverter - extends AbstractConverterAware { - - @Override - public RESULT convert(SOURCE source) { - RESULT criteria = convertToSearchCriteria(source); - addDefaultParams(source, criteria); - return criteria; - } - - public abstract RESULT convertToSearchCriteria(SOURCE source); - - private void addDefaultParams(SOURCE request, RESULT criteria) { - criteria.setStartIndex(StringUtils.isNumeric(request.getStartIndex()) ? new Integer(request.getStartIndex()) : 0); - criteria.setPage(StringUtils.isNumeric(request.getPage()) ? new Integer(request.getPage()) : 0); - criteria.setMaxRows(StringUtils.isNumeric(request.getPageSize()) ? new Integer(request.getPageSize()) : 50); - criteria.setSortBy(request.getSortBy()); - criteria.setSortType(request.getSortType()); - if (StringUtils.isNotEmpty(request.getStartTime())){ - criteria.setGlobalStartTime(request.getStartTime()); - criteria.getUrlParamMap().put(PARAM_GLOBAL_START_TIME, request.getStartTime()); - } - if (StringUtils.isNotEmpty(request.getEndTime())){ - criteria.setGlobalEndTime(request.getEndTime()); - criteria.getUrlParamMap().put(PARAM_GLOBAL_END_TIME, request.getEndTime()); - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java deleted file mode 100644 index 8e91584..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java +++ /dev/null @@ -1,51 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest; -import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria; -import org.apache.commons.lang.StringEscapeUtils; - -public abstract class AbstractCommonServiceLogRequestConverter - extends AbstractCommonSearchRequestConverter { - - @Override - public RESULT convertToSearchCriteria(SOURCE request) { - RESULT criteria = createCriteria(request); - // TODO: check are these used from the UI or not? - criteria.addParam("q", request.getQuery()); - criteria.addParam("unselectComp", request.getMustNot()); - - criteria.setLevel(request.getLevel()); - criteria.setFrom(request.getFrom()); - criteria.setTo(request.getTo()); - criteria.setSelectComp(request.getMustBe()); - criteria.setBundleId(request.getBundleId()); - criteria.setHostName(request.getHostName()); - criteria.setComponentName(request.getComponentName()); - criteria.setFileName(request.getFileName()); - criteria.setStartTime(request.getStartTime()); - criteria.setEndTime(request.getEndTime()); - criteria.setExcludeQuery(StringEscapeUtils.unescapeXml(request.getExcludeQuery())); - criteria.setIncludeQuery(StringEscapeUtils.unescapeXml(request.getIncludeQuery())); - return criteria; - } - - public abstract RESULT createCriteria(SOURCE request); -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java deleted file mode 100644 index 18a71c1..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java +++ /dev/null @@ -1,47 +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.query.converter; - -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.core.convert.ConversionService; -import org.springframework.core.convert.converter.Converter; -import org.springframework.core.convert.converter.ConverterRegistry; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; - -public abstract class AbstractConverterAware implements Converter { - - @Inject - @Qualifier("conversionService") - private ConversionService conversionService; - - public ConversionService getConversionService() { - return conversionService; - } - - @PostConstruct - private void register() { - if (conversionService instanceof ConverterRegistry) { - ((ConverterRegistry) conversionService).addConverter(this); - } else { - throw new IllegalStateException("Can't register Converter to ConverterRegistry"); - } - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java deleted file mode 100644 index 1639563..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java +++ /dev/null @@ -1,39 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.AnyGraphRequest; -import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class AnyGraphRequestConverter extends AbstractCommonSearchRequestConverter { - - @Override - public AnyGraphSearchCriteria convertToSearchCriteria(AnyGraphRequest anyGraphRequest) { - AnyGraphSearchCriteria criteria = new AnyGraphSearchCriteria(); - criteria.setxAxis(anyGraphRequest.getxAxis()); - criteria.setyAxis(anyGraphRequest.getyAxis()); - criteria.setStackBy(anyGraphRequest.getStackBy()); - criteria.setUnit(anyGraphRequest.getUnit()); - criteria.setFrom(anyGraphRequest.getFrom()); - criteria.setTo(anyGraphRequest.getTo()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java deleted file mode 100644 index ac74287..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java +++ /dev/null @@ -1,34 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest; -import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class AuditBarGraphRequestConverter extends AbstractCommonAuditLogRequestConverter{ - - @Override - public AuditBarGraphSearchCriteria createCriteria(AuditBarGraphRequest request) { - AuditBarGraphSearchCriteria criteria = new AuditBarGraphSearchCriteria(); - criteria.setUnit(request.getUnit()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java deleted file mode 100644 index 5ec7632..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java +++ /dev/null @@ -1,34 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest; -import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class AuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter { - - @Override - public AuditLogSearchCriteria createCriteria(AuditLogRequest request) { - AuditLogSearchCriteria criteria = new AuditLogSearchCriteria(); - criteria.setLastPage(request.isLastPage()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java deleted file mode 100644 index 35aceb2..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java +++ /dev/null @@ -1,33 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest; -import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class BaseAuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter { - - @Override - public CommonSearchCriteria createCriteria(BaseAuditLogRequest request) { - return new CommonSearchCriteria(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java deleted file mode 100644 index efc9bc9..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java +++ /dev/null @@ -1,33 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest; -import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; -import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class BaseServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter { - - @Override - public CommonServiceLogSearchCriteria createCriteria(BaseServiceLogRequest request) { - return new CommonServiceLogSearchCriteria(); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java deleted file mode 100644 index 6197d48..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java +++ /dev/null @@ -1,34 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest; -import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class FieldAuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter { - - @Override - public FieldAuditLogSearchCriteria createCriteria(FieldAuditLogRequest request) { - FieldAuditLogSearchCriteria criteria = new FieldAuditLogSearchCriteria(); - criteria.setField(request.getField()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java deleted file mode 100644 index 74b0dac..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java +++ /dev/null @@ -1,35 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.FieldAuditBarGraphRequest; -import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class FieldBarGraphRequestConverter extends AbstractCommonAuditLogRequestConverter { - - @Override - public FieldAuditBarGraphSearchCriteria createCriteria(FieldAuditBarGraphRequest request) { - FieldAuditBarGraphSearchCriteria criteria = new FieldAuditBarGraphSearchCriteria(); - criteria.setUnit(request.getUnit()); - criteria.setField(request.getField()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java deleted file mode 100644 index 8f1aaf0..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java +++ /dev/null @@ -1,39 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest; -import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class ServiceAnyGraphRequestConverter extends AbstractCommonServiceLogRequestConverter { - - @Override - public ServiceAnyGraphSearchCriteria createCriteria(ServiceAnyGraphRequest anyGraphRequest) { - ServiceAnyGraphSearchCriteria criteria = new ServiceAnyGraphSearchCriteria(); - criteria.setxAxis(anyGraphRequest.getxAxis()); - criteria.setyAxis(anyGraphRequest.getyAxis()); - criteria.setStackBy(anyGraphRequest.getStackBy()); - criteria.setUnit(anyGraphRequest.getUnit()); - criteria.setFrom(anyGraphRequest.getFrom()); - criteria.setTo(anyGraphRequest.getTo()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java deleted file mode 100644 index 489e879..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java +++ /dev/null @@ -1,34 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest; -import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria; -import org.springframework.stereotype.Component; - -@Component -public class ServiceExtremeDatesRequestConverter extends AbstractCommonSearchRequestConverter { - - @Override - public ServiceExtremeDatesCriteria convertToSearchCriteria(ServiceExtremeDatesRequest request) { - ServiceExtremeDatesCriteria criteria = new ServiceExtremeDatesCriteria(); - criteria.setBundleId(request.getBundleId()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java deleted file mode 100644 index 37ec7dc..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java +++ /dev/null @@ -1,34 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest; -import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class ServiceGraphRequestConverter extends AbstractCommonServiceLogRequestConverter { - - @Override - public ServiceGraphSearchCriteria createCriteria(ServiceGraphRequest request) { - ServiceGraphSearchCriteria criteria = new ServiceGraphSearchCriteria(); - criteria.setUnit(request.getUnit()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java deleted file mode 100644 index 783b0e0..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java +++ /dev/null @@ -1,35 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest; -import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class ServiceLogExportRequestConverter extends AbstractCommonServiceLogRequestConverter { - - @Override - public ServiceLogExportSearchCriteria createCriteria(ServiceLogExportRequest request) { - ServiceLogExportSearchCriteria criteria = new ServiceLogExportSearchCriteria(); - criteria.setFormat(request.getFormat()); - criteria.setUtcOffset(request.getUtcOffset()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java deleted file mode 100644 index 86d055d..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java +++ /dev/null @@ -1,39 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest; -import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria; -import org.apache.commons.lang.StringEscapeUtils; -import org.springframework.stereotype.Component; - -@Component -public class ServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter { - - @Override - public ServiceLogSearchCriteria createCriteria(ServiceLogRequest request) { - ServiceLogSearchCriteria criteria = new ServiceLogSearchCriteria(); - criteria.setKeyword(StringEscapeUtils.unescapeXml(request.getKeyWord())); - criteria.setKeywordType(request.getKeywordType()); - criteria.setSourceLogId(request.getSourceLogId()); - criteria.setToken(request.getToken()); - criteria.setLastPage(request.isLastPage()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java deleted file mode 100644 index 2154357..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java +++ /dev/null @@ -1,36 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest; -import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class ServiceLogTruncatedRequestConverter extends AbstractCommonServiceLogRequestConverter { - - @Override - public ServiceLogTruncatedSearchCriteria createCriteria(ServiceLogTruncatedRequest request) { - ServiceLogTruncatedSearchCriteria criteria = new ServiceLogTruncatedSearchCriteria(); - criteria.setId(request.getId()); - criteria.setScrollType(request.getScrollType()); - criteria.setNumberRows(request.getNumberRows()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java deleted file mode 100644 index 1f084fd..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java +++ /dev/null @@ -1,35 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.SimpleQueryRequest; -import org.apache.ambari.logsearch.query.model.CommonSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class SimpleQueryRequestConverter extends AbstractConverterAware { - - @Override - public CommonSearchCriteria convert(SimpleQueryRequest simpleQueryRequest) { - CommonSearchCriteria searchCriteria = new CommonSearchCriteria(); - searchCriteria.addParam("q", simpleQueryRequest.getQuery()); - return searchCriteria; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java deleted file mode 100644 index 8f2aaa0..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java +++ /dev/null @@ -1,36 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest; -import org.apache.ambari.logsearch.query.model.UserConfigSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class UserConfigRequestConverter extends AbstractConverterAware { - - @Override - public UserConfigSearchCriteria convert(UserConfigRequest request) { - UserConfigSearchCriteria criteria = new UserConfigSearchCriteria(); - criteria.setUserName(request.getUserId()); - criteria.setFilterName(request.getFilterName()); - criteria.setRowType(request.getRowType()); - return criteria; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java deleted file mode 100644 index c7f738e..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java +++ /dev/null @@ -1,36 +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.query.converter; - -import org.apache.ambari.logsearch.model.request.impl.UserExportRequest; -import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class UserExportRequestConverter extends AbstractCommonAuditLogRequestConverter { - - @Override - public UserExportSearchCriteria createCriteria(UserExportRequest request) { - UserExportSearchCriteria criteria = new UserExportSearchCriteria(); - criteria.setField(request.getField()); - criteria.setFormat(request.getFormat()); - return criteria; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java deleted file mode 100644 index aa61851..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java +++ /dev/null @@ -1,77 +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.query.model; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FROM; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_STACK_BY; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_TO; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_X_AXIS; -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_Y_AXIS; - -public class AnyGraphSearchCriteria extends CommonSearchCriteria { - - public String getxAxis() { - return getParam(PARAM_X_AXIS, String.class); - } - - public void setxAxis(String xAxis) { - addParam(PARAM_X_AXIS, xAxis); - } - - public String getyAxis() { - return getParam(PARAM_Y_AXIS, String.class); - } - - public void setyAxis(String yAxis) { - addParam(PARAM_Y_AXIS, yAxis); - } - - public String getStackBy() { - return getParam(PARAM_STACK_BY, String.class); - } - - public void setStackBy(String stackBy) { - addParam(PARAM_STACK_BY, stackBy); - } - - public String getUnit() { - return getParam(PARAM_UNIT, String.class); - } - - public void setUnit(String unit) { - addParam(PARAM_UNIT, unit); - } - - public String getFrom() { - return getParam(PARAM_FROM, String.class); - } - - public void setFrom(String from) { - addParam(PARAM_FROM, from); - } - - public String getTo() { - return getParam(PARAM_TO, String.class); - } - - public void setTo(String to) { - addParam(PARAM_TO, to); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java deleted file mode 100644 index 49304c4..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java +++ /dev/null @@ -1,33 +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.query.model; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT; - -public class AuditBarGraphSearchCriteria extends CommonSearchCriteria { - - public void setUnit(String unit) { - addParam(PARAM_UNIT, unit); - } - - public String getUnit() { - return getParam(PARAM_UNIT, String.class); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/1a225bd2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java deleted file mode 100644 index 03df3ad..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java +++ /dev/null @@ -1,33 +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.query.model; - -import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_IS_LAST_PAGE; - -public class AuditLogSearchCriteria extends CommonSearchCriteria { - - public void setLastPage(boolean lastPage) { - addParam(PARAM_IS_LAST_PAGE, lastPage); - } - - public boolean isLastPage() { - return getParam(PARAM_IS_LAST_PAGE, Boolean.class); - } - -}