From c75a08a749718fc5ef25f8c2f826939be657c0bf Mon Sep 17 00:00:00 2001 From: Daniel Silverthorn Date: Thu, 4 May 2017 13:08:13 -0400 Subject: Initial search service commit Changing common logging dep Change-Id: I454697a9df0ee63f43d7b7d2a3818fe2d9b7bcf2 Signed-off-by: Daniel Silverthorn --- .../entity/AggregationBucket.java | 79 +++++++++++++++++++++ .../entity/AggregationResult.java | 79 +++++++++++++++++++++ .../entity/AggregationResults.java | 45 ++++++++++++ .../sa/searchdbabstraction/entity/Document.java | 65 +++++++++++++++++ .../entity/DocumentOperationResult.java | 44 ++++++++++++ .../sa/searchdbabstraction/entity/ErrorResult.java | 60 ++++++++++++++++ .../entity/OperationResult.java | 82 ++++++++++++++++++++++ .../sa/searchdbabstraction/entity/SearchHit.java | 52 ++++++++++++++ .../sa/searchdbabstraction/entity/SearchHits.java | 54 ++++++++++++++ .../entity/SearchOperationResult.java | 54 ++++++++++++++ 10 files changed, 614 insertions(+) create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationBucket.java create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationResult.java create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationResults.java create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/Document.java create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/DocumentOperationResult.java create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/ErrorResult.java create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/OperationResult.java create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchHit.java create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchHits.java create mode 100644 src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchOperationResult.java (limited to 'src/main/java/org/openecomp/sa/searchdbabstraction/entity') diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationBucket.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationBucket.java new file mode 100644 index 0000000..4877b0b --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationBucket.java @@ -0,0 +1,79 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import edu.emory.mathcs.backport.java.util.Arrays; + +public class AggregationBucket { + private Object key; + + @JsonProperty("formatted-key") + private String formattedKey; + + private Number count; + + @JsonProperty("sub-aggregations") + private AggregationResult[] subAggregationResult; + + public Object getKey() { + return key; + } + + public void setKey(Object key) { + this.key = key; + } + + public String getFormattedKey() { + return formattedKey; + } + + public void setFormattedKey(String formattedKey) { + this.formattedKey = formattedKey; + } + + public Number getCount() { + return count; + } + + public void setCount(Number count) { + this.count = count; + } + + public AggregationResult[] getSubAggregationResult() { + return subAggregationResult; + } + + public void setSubAggregationResult(AggregationResult[] subAggregationResult) { + this.subAggregationResult = subAggregationResult; + } + + @Override + public String toString() { + return "AggregationBucket [key=" + key + ", formattedKey=" + formattedKey + ", count=" + count + + ", subAggregationResult=" + Arrays.toString(subAggregationResult) + "]"; + } + +} diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationResult.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationResult.java new file mode 100644 index 0000000..3867975 --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationResult.java @@ -0,0 +1,79 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import edu.emory.mathcs.backport.java.util.Arrays; + +public class AggregationResult { + private String name; + + private Number count; + + private AggregationBucket[] buckets; + + @JsonProperty("nested-aggregations") + private AggregationResult[] nestedAggregations; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public AggregationBucket[] getBuckets() { + return buckets; + } + + public void setBuckets(AggregationBucket[] buckets) { + this.buckets = buckets; + } + + public AggregationResult[] getNestedAggregations() { + return nestedAggregations; + } + + public void setNestedAggregations(AggregationResult[] nestedAggregations) { + this.nestedAggregations = nestedAggregations; + } + + public Number getCount() { + return count; + } + + public void setCount(Number count) { + this.count = count; + } + + @Override + public String toString() { + return "AggregationResult [name=" + name + ", count=" + count + ", buckets=" + + Arrays.toString(buckets) + ", nestedAggregations=" + Arrays.toString(nestedAggregations) + + "]"; + } + +} diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationResults.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationResults.java new file mode 100644 index 0000000..f2f7f8f --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/AggregationResults.java @@ -0,0 +1,45 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +import java.util.Arrays; + +public class AggregationResults { + private AggregationResult[] aggregations; + + public AggregationResult[] getAggregations() { + return aggregations; + } + + public void setAggregations(AggregationResult[] aggregations) { + this.aggregations = aggregations; + } + + @Override + public String toString() { + return "AggregationResults [aggregations=" + Arrays.toString(aggregations) + "]"; + } + +} diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/Document.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/Document.java new file mode 100644 index 0000000..53e83dd --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/Document.java @@ -0,0 +1,65 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +import org.json.simple.JSONObject; + +public class Document { + private String etag; + private String url; + + private JSONObject content; + + public String getEtag() { + return etag; + } + + public void setEtag(String etag) { + this.etag = etag; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public JSONObject getContent() { + return content; + } + + public void setContent(JSONObject content) { + this.content = content; + } + + @Override + public String toString() { + return "Document [etag=" + etag + ", url=" + url + "]"; + } + + +} diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/DocumentOperationResult.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/DocumentOperationResult.java new file mode 100644 index 0000000..2af5e9e --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/DocumentOperationResult.java @@ -0,0 +1,44 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +public class DocumentOperationResult extends OperationResult { + private Document document; + + public Document getDocument() { + return document; + } + + public void setDocument(Document document) { + this.document = document; + } + + @Override + public String toString() { + return "DocumentOperationResult [document=" + document + "]"; + } + + +} diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/ErrorResult.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/ErrorResult.java new file mode 100644 index 0000000..7171c66 --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/ErrorResult.java @@ -0,0 +1,60 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +public class ErrorResult { + + private String type; + private String reason; + + + public ErrorResult(String type, String reason) { + super(); + this.type = type; + this.reason = reason; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + @Override + public String toString() { + return "ErrorResponse [type=" + type + ", reason=" + reason + "]"; + } + +} diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/OperationResult.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/OperationResult.java new file mode 100644 index 0000000..b496fb4 --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/OperationResult.java @@ -0,0 +1,82 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +public class OperationResult { + + private int resultCode; + + private String failureCause; + private String resultVersion; + private String result; + private ErrorResult error; + + public int getResultCode() { + return resultCode; + } + + public void setResultCode(int resultCode) { + this.resultCode = resultCode; + } + + public String getFailureCause() { + return failureCause; + } + + public void setFailureCause(String failureCause) { + this.failureCause = failureCause; + } + + public String getResultVersion() { + return resultVersion; + } + + public void setResultVersion(String resultVersion) { + this.resultVersion = resultVersion; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public ErrorResult getError() { + return error; + } + + public void setError(ErrorResult error) { + this.error = error; + } + + @Override + public String toString() { + return "OperationResult [resultCode=" + resultCode + ", failureCause=" + failureCause + + ", resultVersion=" + resultVersion + ", result=" + result + ", error=" + error + "]"; + } + +} diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchHit.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchHit.java new file mode 100644 index 0000000..b4077e9 --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchHit.java @@ -0,0 +1,52 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +public class SearchHit { + private String score; + Document document; + + public String getScore() { + return score; + } + + public void setScore(String score) { + this.score = score; + } + + public Document getDocument() { + return document; + } + + public void setDocument(Document document) { + this.document = document; + } + + @Override + public String toString() { + return "SearchHit [score=" + score + ", document=" + document + "]"; + } + +} diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchHits.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchHits.java new file mode 100644 index 0000000..bbaf2f8 --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchHits.java @@ -0,0 +1,54 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +import java.util.Arrays; + +public class SearchHits { + private String totalHits; + private SearchHit[] hits; + + public String getTotalHits() { + return totalHits; + } + + public void setTotalHits(String totalHits) { + this.totalHits = totalHits; + } + + public SearchHit[] getHits() { + return hits; + } + + public void setHits(SearchHit[] hits) { + this.hits = hits; + } + + @Override + public String toString() { + return "SearchHits [totalHits=" + totalHits + ", hits=" + Arrays.toString(hits) + "]"; + } + +} diff --git a/src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchOperationResult.java b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchOperationResult.java new file mode 100644 index 0000000..be00d77 --- /dev/null +++ b/src/main/java/org/openecomp/sa/searchdbabstraction/entity/SearchOperationResult.java @@ -0,0 +1,54 @@ +/** + * ============LICENSE_START======================================================= + * Search Data Service + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. + * Copyright © 2017 Amdocs + * All rights reserved. + * ================================================================================ + * Licensed 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 ati + * + * 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. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + */ +package org.openecomp.sa.searchdbabstraction.entity; + +public class SearchOperationResult extends OperationResult { + + private SearchHits searchResult; + private AggregationResults aggregationResult; + + public SearchHits getSearchResult() { + return searchResult; + } + + public AggregationResults getAggregationResult() { + return aggregationResult; + } + + public void setAggregationResult(AggregationResults aggregations) { + this.aggregationResult = aggregations; + } + + public void setSearchResult(SearchHits hits) { + this.searchResult = hits; + } + + @Override + public String toString() { + return "SearchOperationResult [searchResult=" + searchResult + + ", aggregationResult=" + aggregationResult; + } + +} -- cgit 1.2.3-korg