diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 584a6b6cb75..a0dd11d6db3 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -31,19 +31,4 @@ updates:
angular:
applies-to: version-updates
patterns:
- - "*"
-
- - package-ecosystem: "npm" # See documentation for possible values
- directory: "/turing-react" # Location of package manifests
- schedule:
- interval: "weekly"
- target-branch: "0.3.10"
- open-pull-requests-limit: 15
- ignore:
- - dependency-name: "typescript"
- - dependency-name: "styled-components"
- groups:
- react:
- applies-to: version-updates
- patterns:
- - "*"
+ - "*"
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 3672b4e0944..e53585bd877 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
UTF-8
UTF-8
- 3.4.1
+ 3.4.2
viglet-turing
https://sonarcloud.io
@@ -279,7 +279,7 @@
org.xerial
sqlite-jdbc
- 3.48.0.0
+ 3.49.0.0
org.apache.logging.log4j
@@ -294,7 +294,7 @@
org.apache.httpcomponents.client5
httpclient5
- 5.4.1
+ 5.4.2
com.jayway.jsonpath
diff --git a/turing-aem/aem-commons/pom.xml b/turing-aem/aem-commons/pom.xml
index 0e49a135abc..9875c7a3656 100644
--- a/turing-aem/aem-commons/pom.xml
+++ b/turing-aem/aem-commons/pom.xml
@@ -47,7 +47,7 @@
org.jetbrains
annotations
- 26.0.1
+ 26.0.2
compile
diff --git a/turing-aem/aem-plugin/pom.xml b/turing-aem/aem-plugin/pom.xml
index f21eb073d05..7412f413562 100644
--- a/turing-aem/aem-plugin/pom.xml
+++ b/turing-aem/aem-plugin/pom.xml
@@ -13,7 +13,7 @@
Turing AEM - Plugin
Turing AEM - Plugin
- 3.4.1
+ 3.4.2
UTF-8
UTF-8
21
diff --git a/turing-app/pom.xml b/turing-app/pom.xml
index ca06f305d79..f69c3f51b55 100644
--- a/turing-app/pom.xml
+++ b/turing-app/pom.xml
@@ -14,7 +14,7 @@
https://github.com/openturing/turing
jar
- 3.4.1
+ 3.4.2
UTF-8
UTF-8
21
@@ -38,7 +38,7 @@
co.elastic.clients
elasticsearch-java
- 8.17.0
+ 8.17.1
org.springframework.boot
@@ -196,33 +196,33 @@
org.apache.tika
tika-core
- 3.0.0
+ 3.1.0
org.apache.tika
tika-parsers
- 3.0.0
+ 3.1.0
pom
org.apache.tika
tika-parser-pdf-module
- 3.0.0
+ 3.1.0
org.apache.tika
tika-parser-text-module
- 3.0.0
+ 3.1.0
org.apache.tika
tika-parser-ocr-module
- 3.0.0
+ 3.1.0
org.apache.tika
tika-parser-microsoft-module
- 3.0.0
+ 3.1.0
com.levigo.jbig2
@@ -242,7 +242,7 @@
org.springdoc
springdoc-openapi-starter-webmvc-ui
- 2.8.3
+ 2.8.4
com.squins.google.fork.schema-org-client
@@ -295,7 +295,7 @@
org.apache.solr
solr-solrj
- 9.7.0
+ 9.8.0
org.springframework.security
diff --git a/turing-app/src/main/java/com/viglet/turing/api/sn/search/TurSNSiteSearchAPI.java b/turing-app/src/main/java/com/viglet/turing/api/sn/search/TurSNSiteSearchAPI.java
index 28a6d242468..f941b6b13ce 100644
--- a/turing-app/src/main/java/com/viglet/turing/api/sn/search/TurSNSiteSearchAPI.java
+++ b/turing-app/src/main/java/com/viglet/turing/api/sn/search/TurSNSiteSearchAPI.java
@@ -39,6 +39,7 @@
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.LocaleUtils;
+import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
@@ -84,7 +85,7 @@ public ResponseEntity turSNSiteSearchSelectGet(
@RequestParam(required = false, name = TurSNParamType.FILTER_QUERY_OPERATOR, defaultValue = "NONE")
TurSNFilterQueryOperator fqOperator,
@RequestParam(required = false, name = TurSNParamType.SORT) String sort,
- @RequestParam(required = false, name = TurSNParamType.ROWS, defaultValue = "10") Integer rows,
+ @RequestParam(required = false, name = TurSNParamType.ROWS, defaultValue = "-1") Integer rows,
@RequestParam(required = false, name = TurSNParamType.GROUP) String group,
@RequestParam(required = false, name = TurSNParamType.AUTO_CORRECTION_DISABLED, defaultValue = "0")
Integer autoCorrectionDisabled,
@@ -127,7 +128,7 @@ public ResponseEntity turSNSiteSearchSelectPost(
@RequestParam(required = false, name = TurSNParamType.FILTER_QUERY_OPERATOR, defaultValue = "NONE")
TurSNFilterQueryOperator fqOperator,
@RequestParam(required = false, name = TurSNParamType.SORT) String sort,
- @RequestParam(required = false, name = TurSNParamType.ROWS, defaultValue = "10") Integer rows,
+ @RequestParam(required = false, name = TurSNParamType.ROWS, defaultValue = "-1") Integer rows,
@RequestParam(required = false, name = TurSNParamType.GROUP) String group,
@RequestParam(required = false, name = TurSNParamType.AUTO_CORRECTION_DISABLED, defaultValue = "0")
Integer autoCorrectionDisabled,
@@ -136,7 +137,9 @@ public ResponseEntity turSNSiteSearchSelectPost(
Principal principal,
HttpServletRequest request) {
if (principal != null) {
- Locale locale = LocaleUtils.toLocale(localeRequest);
+ Locale locale = LocaleUtils.toLocale(StringUtils.isNotBlank(turSNSitePostParamsBean.getLocale()) ?
+ turSNSitePostParamsBean.getLocale() :
+ localeRequest);
if (existsByTurSNSiteAndLanguage(siteName, locale)) {
turSNSitePostParamsBean.setTargetingRules(
turSNSearchProcess.requestTargetingRules(turSNSitePostParamsBean.getTargetingRules()));
diff --git a/turing-app/src/main/java/com/viglet/turing/persistence/model/sn/TurSNSite.java b/turing-app/src/main/java/com/viglet/turing/persistence/model/sn/TurSNSite.java
index aa8ef3b75ff..683f0f7669b 100644
--- a/turing-app/src/main/java/com/viglet/turing/persistence/model/sn/TurSNSite.java
+++ b/turing-app/src/main/java/com/viglet/turing/persistence/model/sn/TurSNSite.java
@@ -72,6 +72,9 @@ public class TurSNSite extends TurAuditable implements Serializable {
@Column(nullable = false)
private String description;
+ /**
+ * Number of results per page
+ */
@Column
private Integer rowsPerPage = 10;
diff --git a/turing-app/src/main/java/com/viglet/turing/solr/TurSolr.java b/turing-app/src/main/java/com/viglet/turing/solr/TurSolr.java
index 1be5c31baf5..8fad93f26e1 100644
--- a/turing-app/src/main/java/com/viglet/turing/solr/TurSolr.java
+++ b/turing-app/src/main/java/com/viglet/turing/solr/TurSolr.java
@@ -626,12 +626,16 @@ private void setMLT(TurSNSite turSNSite, List turSNSiteMLTFie
if (hasMLT(turSNSite, turSNSiteMLTFieldExtList)) turSEResults.setSimilarResults(similarResults);
}
+ /**
+ * Sets how many result query will respond.
+ */
private void setRows(TurSNSite turSNSite, TurSEParameters turSEParameters) {
- if (turSEParameters.getRows() == 0) {
- turSEParameters.setRows(turSNSite.getRowsPerPage());
- } else if (turSEParameters.getRows() < 0) {
- turSEParameters.setRows(0);
+ // If user didn't input a parameter through query string. Then, use the site configuration
+ if (turSEParameters.getRows() < 0){
+ // But only uses if the entered value is greater than 0. If not, then uses the default value = 10
+ turSEParameters.setRows((turSNSite.getRowsPerPage() > 0)? turSNSite.getRowsPerPage() : 10 );
}
+ // Else, it will use the query parameter
}
private void setSortEntry(TurSNSite turSNSite, SolrQuery query, TurSEParameters turSEParameters) {
diff --git a/turing-commons/src/main/java/com/viglet/turing/commons/utils/TurCommonsUtils.java b/turing-commons/src/main/java/com/viglet/turing/commons/utils/TurCommonsUtils.java
index 3ed58f7d299..4c098575a3b 100644
--- a/turing-commons/src/main/java/com/viglet/turing/commons/utils/TurCommonsUtils.java
+++ b/turing-commons/src/main/java/com/viglet/turing/commons/utils/TurCommonsUtils.java
@@ -289,6 +289,6 @@ public static String asJsonString(final Object obj) throws TurException {
}
public static File getTempDirectory() {
- return TurCommonsUtils.addSubDirToStoreDir("tmp");
+ return addSubDirToStoreDir("tmp");
}
}
diff --git a/turing-filesystem/fs-commons/pom.xml b/turing-filesystem/fs-commons/pom.xml
index 400a863f0fd..e0901df16d8 100644
--- a/turing-filesystem/fs-commons/pom.xml
+++ b/turing-filesystem/fs-commons/pom.xml
@@ -36,33 +36,33 @@
org.apache.tika
tika-core
- 3.0.0
+ 3.1.0
org.apache.tika
tika-parsers
- 3.0.0
+ 3.1.0
pom
org.apache.tika
tika-parser-pdf-module
- 3.0.0
+ 3.1.0
org.apache.tika
tika-parser-text-module
- 3.0.0
+ 3.1.0
org.apache.tika
tika-parser-ocr-module
- 3.0.0
+ 3.1.0
org.apache.tika
tika-parser-microsoft-module
- 3.0.0
+ 3.1.0
com.levigo.jbig2
diff --git a/turing-java-sdk/src/main/java/com/viglet/turing/client/ocr/sample/TurClientOcrSample.java b/turing-java-sdk/src/main/java/com/viglet/turing/client/ocr/sample/TurClientOcrSample.java
index 4bd59fd0826..f4cfa27ebf9 100644
--- a/turing-java-sdk/src/main/java/com/viglet/turing/client/ocr/sample/TurClientOcrSample.java
+++ b/turing-java-sdk/src/main/java/com/viglet/turing/client/ocr/sample/TurClientOcrSample.java
@@ -18,13 +18,15 @@
package com.viglet.turing.client.ocr.sample;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.viglet.turing.client.auth.TurServer;
import com.viglet.turing.client.auth.credentials.TurApiKeyCredentials;
import com.viglet.turing.client.ocr.TurOcr;
import com.viglet.turing.commons.file.TurFileAttributes;
import lombok.extern.slf4j.Slf4j;
-import java.net.MalformedURLException;
+import java.io.File;
import java.net.URI;
/**
@@ -35,20 +37,33 @@
*/
@Slf4j
public class TurClientOcrSample {
- public static void main(String[] args) {
- if (args.length == 3) {
+
+ public static final String HTTP = "http";
+
+ public static void main(String[] args) throws JsonProcessingException {
+ if (args.length == 4) {
String turingUrl = args[0];
String apiKey = args[1];
- String fileUrl = args[2];
- TurServer turSNServer = new TurServer(URI.create(turingUrl),
- new TurApiKeyCredentials(apiKey));
- log.info("--- Ocr Url");
- TurOcr turOcr = new TurOcr();
- TurFileAttributes turFileAttributes = turOcr.processUrl(turSNServer, URI.create(fileUrl),
- true);
- log.info(turFileAttributes.toString());
+ String fileUrl = args[3];
+ log.info("--- Ocr Url");
+ TurFileAttributes turFileAttributes = getAttributes(turingUrl, apiKey, fileUrl);
+ if (turFileAttributes != null) {
+ log.info(new ObjectMapper().writer().withDefaultPrettyPrinter().writeValueAsString(turFileAttributes));
+ }
+ } else {
+ log.info("Parameters: turingUrl apiKey [file Or Url]");
+ }
+ }
+
+ private static TurFileAttributes getAttributes(String turingUrl, String apikey, String fileUrl) {
+ TurServer turServer = new TurServer(URI.create(turingUrl),
+ new TurApiKeyCredentials(apikey));
+ TurOcr turOcr = new TurOcr();
+ if (fileUrl.toLowerCase().startsWith(HTTP)) {
+ return turOcr.processUrl(turServer, URI.create(fileUrl), false);
+
} else {
- log.info("Parameters: turingUrl apiKey fileUrl");
+ return turOcr.processFile(turServer, new File(fileUrl), false);
}
}
}
diff --git a/turing-java-sdk/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItem.java b/turing-java-sdk/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItem.java
index be9bc74a01c..e784f32e1e2 100644
--- a/turing-java-sdk/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItem.java
+++ b/turing-java-sdk/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItem.java
@@ -38,8 +38,7 @@ public class TurSNJobItem implements Serializable{
private static final long serialVersionUID = 1L;
private Locale locale;
-
- private TurSNJobAction turSNJobAction;
+ private TurSNJobAction turSNJobAction;
private List siteNames;
private List specs = new ArrayList<>();
private Map attributes = new HashMap<>();
diff --git a/turing-jdk6/.gitignore b/turing-jdk6/.gitignore
new file mode 100644
index 00000000000..2d513a0101b
--- /dev/null
+++ b/turing-jdk6/.gitignore
@@ -0,0 +1,2 @@
+/.idea/
+/target/
diff --git a/turing-jdk6/pom.xml b/turing-jdk6/pom.xml
new file mode 100644
index 00000000000..233ed7f16f0
--- /dev/null
+++ b/turing-jdk6/pom.xml
@@ -0,0 +1,23 @@
+
+
+
+ 4.0.0
+ com.viglet.turing
+ turing-jdk6
+ 0.3.10.1
+ pom
+ Turing JDK 6
+ Turing JDK 6
+
+ turing-java-sdk-jdk6
+ turing-wem-jdk6
+
+
+
+ UTF-8
+ UTF-8
+ 1.6
+ 1.6
+
+
diff --git a/turing-jdk6/turing-java-sdk-jdk6/.gitignore b/turing-jdk6/turing-java-sdk-jdk6/.gitignore
new file mode 100644
index 00000000000..a8e91734277
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/.gitignore
@@ -0,0 +1,30 @@
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+.gradle
+.project
+.classpath
+.settings
+build/
+.vscode
+/target/
diff --git a/turing-jdk6/turing-java-sdk-jdk6/pom.xml b/turing-jdk6/turing-java-sdk-jdk6/pom.xml
new file mode 100644
index 00000000000..6086db13aa5
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/pom.xml
@@ -0,0 +1,108 @@
+
+
+ 4.0.0
+
+ com.viglet.turing
+ turing-jdk6
+ 0.3.10.1
+ ../pom.xml
+
+ turing-java-sdk-jdk6
+ jar
+ Turing Java SDK 1.6
+ Turing Java SDK 1.6
+
+ UTF-8
+ UTF-8
+ 1.6
+ 1.6
+ 20140107
+ 2.9.7
+ 1.2.7
+
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.0
+
+
+ com.sun.xml.bind
+ jaxb-core
+ 2.3.0
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ 2.3.0
+
+
+ org.json
+ json
+ ${jsonVersion}
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.6.0
+
+
+ log4j
+ log4j
+ ${log4jVersion}
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+ 1.53
+
+
+
+ turing-java-sdk
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.13.0
+
+ 1.6
+ 1.6
+
+
+
+ maven-shade-plugin
+ 3.6.0
+
+
+
+ shade
+
+ package
+
+ true
+ all
+ true
+
+
+ *:*
+
+ module-info.class
+ META-INF/*.SF
+ META-INF/*.DSA
+ META-INF/*.RSA
+ META-INF/NOTICE
+ META-INF/LICENSE
+ META-INF/MANIFEST.MF
+
+
+
+
+
+
+
+
+
+
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSearchLatestRequestBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSearchLatestRequestBean.java
new file mode 100644
index 00000000000..2992ec5939f
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSearchLatestRequestBean.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.viglet.turing.api.sn.bean;
+
+/**
+ * Request latest searches to Turing AI
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.6
+ *
+ */
+public class TurSNSearchLatestRequestBean {
+
+ private String userId;
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteLocaleBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteLocaleBean.java
new file mode 100644
index 00000000000..d511b2275d1
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteLocaleBean.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Locale of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.5
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteLocaleBean {
+ private String locale;
+ private String link;
+
+ public String getLocale() {
+ return locale;
+ }
+
+ public void setLocale(String locale) {
+ this.locale = locale;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSitePostParamsBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSitePostParamsBean.java
new file mode 100644
index 00000000000..c94efe8c267
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSitePostParamsBean.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Post Parameters for Search with sensitive data
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.6
+ *
+ */
+public class TurSNSitePostParamsBean {
+
+ private String userId;
+
+ private boolean populateMetrics = true;
+
+ private List targetingRules = new ArrayList();
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public boolean isPopulateMetrics() {
+ return populateMetrics;
+ }
+
+ public void setPopulateMetrics(boolean populateMetrics) {
+ this.populateMetrics = populateMetrics;
+ }
+
+ public List getTargetingRules() {
+ return targetingRules;
+ }
+
+ public void setTargetingRules(List targetingRules) {
+ this.targetingRules = targetingRules;
+ }
+
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchBean.java
new file mode 100644
index 00000000000..eb436a29a6c
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchBean.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Root of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchBean {
+
+ private List pagination;
+ private TurSNSiteSearchQueryContext queryContext;
+ private TurSNSiteSearchResultsBean results;
+ private TurSNSiteSearchWidgetBean widget;
+
+ public List getPagination() {
+ return pagination;
+ }
+
+ public void setPagination(List pagination) {
+ this.pagination = pagination;
+ }
+
+ public TurSNSiteSearchQueryContext getQueryContext() {
+ return queryContext;
+ }
+
+ public void setQueryContext(TurSNSiteSearchQueryContext queryContext) {
+ this.queryContext = queryContext;
+ }
+
+ public TurSNSiteSearchResultsBean getResults() {
+ return results;
+ }
+
+ public void setResults(TurSNSiteSearchResultsBean results) {
+ this.results = results;
+ }
+
+ public TurSNSiteSearchWidgetBean getWidget() {
+ return widget;
+ }
+
+ public void setWidget(TurSNSiteSearchWidgetBean widget) {
+ this.widget = widget;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchDefaultFieldsBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchDefaultFieldsBean.java
new file mode 100644
index 00000000000..88aaae4e9b1
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchDefaultFieldsBean.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Default Fields of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchDefaultFieldsBean {
+
+ private String title;
+ private String date;
+ private String description;
+ private String text;
+ private String image;
+ private String url;
+
+ public String getTitle() {
+ return title;
+ }
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public String getText() {
+ return text;
+ }
+ public void setText(String text) {
+ this.text = text;
+ }
+ public String getImage() {
+ return image;
+ }
+ public void setImage(String image) {
+ this.image = image;
+ }
+ public String getUrl() {
+ return url;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+ public String getDate() {
+ return date;
+ }
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchDocumentBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchDocumentBean.java
new file mode 100644
index 00000000000..622883e97a1
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchDocumentBean.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Documents of results of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchDocumentBean {
+
+ private String source;
+ private boolean elevate;
+ private List metadata;
+ private Map fields;
+
+ public boolean getElevate() {
+ return elevate;
+ }
+ public void setElevate(boolean elevate) {
+ this.elevate = elevate;
+ }
+ public List getMetadata() {
+ return metadata;
+ }
+ public void setMetadata(List metadata) {
+ this.metadata = metadata;
+ }
+ public Map getFields() {
+ return fields;
+ }
+ public void setFields(Map fields) {
+ this.fields = fields;
+ }
+ public String getSource() {
+ return source;
+ }
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchDocumentMetadataBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchDocumentMetadataBean.java
new file mode 100644
index 00000000000..ef57f8e1c1f
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchDocumentMetadataBean.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Metadata of document with relation with facets of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchDocumentMetadataBean {
+
+ private String href;
+ private String text;
+ public String getHref() {
+ return href;
+ }
+ public void setHref(String href) {
+ this.href = href;
+ }
+ public String getText() {
+ return text;
+ }
+ public void setText(String text) {
+ this.text = text;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchFacetBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchFacetBean.java
new file mode 100644
index 00000000000..2475d5f7220
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchFacetBean.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Facets of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchFacetBean {
+
+ private List facets;
+
+ private TurSNSiteSearchFacetLabelBean label;
+
+ private String name;
+
+ private String description;
+
+ private boolean multiValued;
+
+ private String type;
+
+ public List getFacets() {
+ return facets;
+ }
+
+ public void setFacets(List facets) {
+ this.facets = facets;
+ }
+
+ public TurSNSiteSearchFacetLabelBean getLabel() {
+ return label;
+ }
+
+ public void setLabel(TurSNSiteSearchFacetLabelBean label) {
+ this.label = label;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean isMultiValued() {
+ return multiValued;
+ }
+
+ public void setMultiValued(boolean multiValued) {
+ this.multiValued = multiValued;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchFacetItemBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchFacetItemBean.java
new file mode 100644
index 00000000000..481c7881a3e
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchFacetItemBean.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Facet Item of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchFacetItemBean {
+
+ private int count;
+ private String link;
+ private String label;
+ public int getCount() {
+ return count;
+ }
+ public void setCount(int count) {
+ this.count = count;
+ }
+ public String getLink() {
+ return link;
+ }
+ public void setLink(String link) {
+ this.link = link;
+ }
+ public String getLabel() {
+ return label;
+ }
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchFacetLabelBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchFacetLabelBean.java
new file mode 100644
index 00000000000..e91d9dc39f3
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchFacetLabelBean.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Label of Facet with diferent locales of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchFacetLabelBean {
+
+ private String lang;
+ private String text;
+ public String getLang() {
+ return lang;
+ }
+ public void setLang(String lang) {
+ this.lang = lang;
+ }
+ public String getText() {
+ return text;
+ }
+ public void setText(String text) {
+ this.text = text;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchPaginationBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchPaginationBean.java
new file mode 100644
index 00000000000..4214fd42fb8
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchPaginationBean.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.viglet.turing.client.sn.pagination.TurSNPaginationType;
+
+/**
+ * Pagination of results of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchPaginationBean {
+
+ private TurSNPaginationType type;
+ private String text;
+ private String href;
+ private int page;
+ public TurSNPaginationType getType() {
+ return type;
+ }
+ public void setType(TurSNPaginationType type) {
+ this.type = type;
+ }
+ public String getText() {
+ return text;
+ }
+ public void setText(String text) {
+ this.text = text;
+ }
+ public String getHref() {
+ return href;
+ }
+ public void setHref(String href) {
+ this.href = href;
+ }
+ public int getPage() {
+ return page;
+ }
+ public void setPage(int page) {
+ this.page = page;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchQueryContext.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchQueryContext.java
new file mode 100644
index 00000000000..6777fbd5f5c
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchQueryContext.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Details about the results of query of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchQueryContext {
+
+ private int count;
+ private String index;
+ private int limit;
+ private int offset;
+ private int page;
+ private int pageCount;
+ private int pageEnd;
+ private int pageStart;
+ private long responseTime;
+ private TurSNSiteSearchQueryContextQueryBean query;
+ private TurSNSiteSearchDefaultFieldsBean defaultFields;
+
+ public int getCount() {
+ return count;
+ }
+ public void setCount(int count) {
+ this.count = count;
+ }
+ public String getIndex() {
+ return index;
+ }
+ public void setIndex(String index) {
+ this.index = index;
+ }
+ public int getLimit() {
+ return limit;
+ }
+ public void setLimit(int limit) {
+ this.limit = limit;
+ }
+ public int getOffset() {
+ return offset;
+ }
+ public void setOffset(int offset) {
+ this.offset = offset;
+ }
+ public int getPage() {
+ return page;
+ }
+ public void setPage(int page) {
+ this.page = page;
+ }
+ public int getPageCount() {
+ return pageCount;
+ }
+ public void setPageCount(int pageCount) {
+ this.pageCount = pageCount;
+ }
+ public int getPageEnd() {
+ return pageEnd;
+ }
+ public void setPageEnd(int pageEnd) {
+ this.pageEnd = pageEnd;
+ }
+ public int getPageStart() {
+ return pageStart;
+ }
+ public void setPageStart(int pageStart) {
+ this.pageStart = pageStart;
+ }
+ public long getResponseTime() {
+ return responseTime;
+ }
+ public void setResponseTime(long responseTime) {
+ this.responseTime = responseTime;
+ }
+ public TurSNSiteSearchQueryContextQueryBean getQuery() {
+ return query;
+ }
+ public void setQuery(TurSNSiteSearchQueryContextQueryBean query) {
+ this.query = query;
+ }
+ public TurSNSiteSearchDefaultFieldsBean getDefaultFields() {
+ return defaultFields;
+ }
+ public void setDefaultFields(TurSNSiteSearchDefaultFieldsBean defaultFields) {
+ this.defaultFields = defaultFields;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchQueryContextQueryBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchQueryContextQueryBean.java
new file mode 100644
index 00000000000..e65b8363fa8
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchQueryContextQueryBean.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Details about the request query string of Turing AI Semantic Navigation
+ * response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchQueryContextQueryBean {
+
+ private String queryString;
+ private String sort;
+ private String locale;
+
+ public String getQueryString() {
+ return queryString;
+ }
+
+ public void setQueryString(String queryString) {
+ this.queryString = queryString;
+ }
+
+ public String getSort() {
+ return sort;
+ }
+
+ public void setSort(String sort) {
+ this.sort = sort;
+ }
+
+ public String getLocale() {
+ return locale;
+ }
+
+ public void setLocale(String locale) {
+ this.locale = locale;
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchResultsBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchResultsBean.java
new file mode 100644
index 00000000000..ad696f71164
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchResultsBean.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * List of documents with results of query of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchResultsBean {
+
+ private List document;
+
+ public List getDocument() {
+ return document;
+ }
+
+ public void setDocument(List document) {
+ this.document = document;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchWidgetBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchWidgetBean.java
new file mode 100644
index 00000000000..7ea6c62c3be
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSearchWidgetBean.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.viglet.turing.api.sn.bean.spellcheck.TurSNSiteSpellCheckBean;
+import com.viglet.turing.se.similar.TurSESimilarResult;
+
+/**
+ * Details about facets and facet and "more like this" of Turing AI Semantic
+ * Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchWidgetBean {
+
+ private List facet;
+ private TurSNSiteSearchFacetBean facetToRemove;
+ private List similar;
+ private TurSNSiteSpellCheckBean spellCheck;
+ private List locales;
+ private List spotlights;
+
+ public List getFacet() {
+ return facet;
+ }
+
+ public void setFacet(List facet) {
+ this.facet = facet;
+ }
+
+ public TurSNSiteSearchFacetBean getFacetToRemove() {
+ return facetToRemove;
+ }
+
+ public void setFacetToRemove(TurSNSiteSearchFacetBean facetToRemove) {
+ this.facetToRemove = facetToRemove;
+ }
+
+ public List getSimilar() {
+ return similar;
+ }
+
+ public void setSimilar(List similar) {
+ this.similar = similar;
+ }
+
+ public TurSNSiteSpellCheckBean getSpellCheck() {
+ return spellCheck;
+ }
+
+ public void setSpellCheck(TurSNSiteSpellCheckBean spellCheck) {
+ this.spellCheck = spellCheck;
+ }
+
+ public List getLocales() {
+ return locales;
+ }
+
+ public void setLocales(List locales) {
+ this.locales = locales;
+ }
+
+ public List getSpotlights() {
+ return spotlights;
+ }
+
+ public void setSpotlights(List spotlights) {
+ this.spotlights = spotlights;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSpotlightDocumentBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSpotlightDocumentBean.java
new file mode 100644
index 00000000000..355ac048368
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/TurSNSiteSpotlightDocumentBean.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.viglet.turing.api.sn.bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * List of spotlight documents of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ * @since 0.3.5
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSpotlightDocumentBean {
+
+ private String id;
+
+ private int position;
+
+ private String title;
+
+ private String type;
+
+ private String referenceId;
+
+ private String content;
+
+ private String link;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public void setPosition(int position) {
+ this.position = position;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getReferenceId() {
+ return referenceId;
+ }
+
+ public void setReferenceId(String referenceId) {
+ this.referenceId = referenceId;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+}
\ No newline at end of file
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/package-info.java
new file mode 100644
index 00000000000..2ef439fce7d
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes of Turing AI beans to create JSON response.
+ *
+ * @since 0.3.4
+ */
+package com.viglet.turing.api.sn.bean;
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/spellcheck/TurSNSiteSpellCheckBean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/spellcheck/TurSNSiteSpellCheckBean.java
new file mode 100644
index 00000000000..1cb16e4b2e5
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/spellcheck/TurSNSiteSpellCheckBean.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean.spellcheck;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Spell Check of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.5
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSpellCheckBean {
+
+ private boolean correctedText;
+ private boolean usingCorrectedText;
+ private TurSNSiteSpellCheckText original;
+ private TurSNSiteSpellCheckText corrected;
+
+ public TurSNSiteSpellCheckText getOriginal() {
+ return original;
+ }
+
+ public void setOriginal(TurSNSiteSpellCheckText original) {
+ this.original = original;
+ }
+
+ public TurSNSiteSpellCheckText getCorrected() {
+ return corrected;
+ }
+
+ public void setCorrected(TurSNSiteSpellCheckText corrected) {
+ this.corrected = corrected;
+ }
+
+ public boolean isCorrectedText() {
+ return correctedText;
+ }
+
+ public void setCorrectedText(boolean correctedText) {
+ this.correctedText = correctedText;
+ }
+
+ public boolean isUsingCorrectedText() {
+ return usingCorrectedText;
+ }
+
+ public void setUsingCorrectedText(boolean usingCorrectedText) {
+ this.usingCorrectedText = usingCorrectedText;
+ }
+
+}
\ No newline at end of file
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/spellcheck/TurSNSiteSpellCheckText.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/spellcheck/TurSNSiteSpellCheckText.java
new file mode 100644
index 00000000000..1eee4a62588
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/bean/spellcheck/TurSNSiteSpellCheckText.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.api.sn.bean.spellcheck;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Spell Check Text of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.5
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSpellCheckText {
+ private String text;
+ private String link;
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/search/TurSNParamType.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/search/TurSNParamType.java
new file mode 100644
index 00000000000..de88c1aeee6
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/api/sn/search/TurSNParamType.java
@@ -0,0 +1,17 @@
+package com.viglet.turing.api.sn.search;
+
+public class TurSNParamType {
+ private TurSNParamType() {
+ throw new IllegalStateException("Parameter Type class");
+ }
+
+ public static final String QUERY = "q";
+ public static final String PAGE = "p";
+ public static final String FILTER_QUERIES = "fq[]";
+ public static final String TARGETING_RULES = "tr[]";
+ public static final String SORT = "sort";
+ public static final String ROWS = "rows";
+ public static final String LOCALE = "_setlocale";
+ public static final String AUTO_CORRECTION_DISABLED = "nfpr";
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/TurFileAttributes.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/TurFileAttributes.java
new file mode 100644
index 00000000000..f254e0fb0cd
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/TurFileAttributes.java
@@ -0,0 +1,84 @@
+package com.viglet.turing.client.ocr;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+public class TurFileAttributes {
+ private String content;
+ private String name;
+ private String title;
+ private String extension;
+ private TurFileSize size = new TurFileSize();
+ private Date lastModified = new Date();
+ private Map metadata = new HashMap();
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public void setExtension(String extension) {
+ this.extension = extension;
+ }
+
+ public TurFileSize getSize() {
+ return size;
+ }
+
+ public void setSize(TurFileSize size) {
+ this.size = size;
+ }
+
+ public Date getLastModified() {
+ return lastModified;
+ }
+
+ public void setLastModified(Date lastModified) {
+ this.lastModified = lastModified;
+ }
+
+ public Map getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(Map metadata) {
+ this.metadata = metadata;
+ }
+
+ @Override
+ public String toString() {
+ return "TurFileAttributes{" +
+ "content='" + content + '\'' +
+ ", name='" + name + '\'' +
+ ", title='" + title + '\'' +
+ ", extension='" + extension + '\'' +
+ ", size=" + size +
+ ", lastModified=" + lastModified +
+ ", metadata=" + metadata +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/TurFileSize.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/TurFileSize.java
new file mode 100644
index 00000000000..b1c9f0fc00e
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/TurFileSize.java
@@ -0,0 +1,55 @@
+package com.viglet.turing.client.ocr;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+public class TurFileSize {
+ private float bytes;
+ private float kiloBytes;
+ private float megaBytes;
+ public TurFileSize() {
+ this(0f);
+ }
+ public TurFileSize(float bytes) {
+ this.bytes = twoDecimalFloat(bytes);
+ this.kiloBytes = twoDecimalFloat(this.bytes / 1024);
+ this.megaBytes = twoDecimalFloat(this.kiloBytes / 1024);
+ }
+
+ private float twoDecimalFloat(float value) {
+ return BigDecimal.valueOf(value).setScale(2, RoundingMode.HALF_UP).floatValue();
+ }
+
+ public float getBytes() {
+ return bytes;
+ }
+
+ public void setBytes(float bytes) {
+ this.bytes = bytes;
+ }
+
+ public float getKiloBytes() {
+ return kiloBytes;
+ }
+
+ public void setKiloBytes(float kiloBytes) {
+ this.kiloBytes = kiloBytes;
+ }
+
+ public float getMegaBytes() {
+ return megaBytes;
+ }
+
+ public void setMegaBytes(float megaBytes) {
+ this.megaBytes = megaBytes;
+ }
+
+ @Override
+ public String toString() {
+ return "TurFileSize{" +
+ "bytes=" + bytes +
+ ", kiloBytes=" + kiloBytes +
+ ", megaBytes=" + megaBytes +
+ '}';
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/TurOcr.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/TurOcr.java
new file mode 100644
index 00000000000..5448f562dff
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/TurOcr.java
@@ -0,0 +1,121 @@
+package com.viglet.turing.client.ocr;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.viglet.turing.client.sn.TurSNServer;
+import com.viglet.turing.client.sn.utils.TurSNClientUtils;
+import com.viglet.turing.client.ssl.TLSSocketConnectionFactory;
+import com.viglet.turing.client.utils.TurClientUtils;
+import org.json.JSONObject;
+
+import javax.net.ssl.HttpsURLConnection;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class TurOcr {
+ private static final Logger logger = Logger.getLogger(TurOcr.class.getName());
+ private static final String UTF_8 = "UTF-8";
+ private static final String ACCEPT_HEADER = "Accept";
+ private static final String CONTENT_TYPE_HEADER = "Content-Type";
+ private static final String ACCEPT_ENCODING_HEADER = "Accept-Encoding";
+ private static final String APPLICATION_JSON = "application/json";
+ public static final String API_OCR_URL = "%s/api/ocr/url";
+ public static final String API_OCR_FILE = "%s/api/ocr/file";
+ public static final String FILE = "file";
+ public static final String URL = "url";
+ public static final String CONNECTION = "Connection";
+ public static final String CACHE_CONTROL = "Cache-Control";
+ public static final String POST = "POST";
+ public static final String KEEP_ALIVE = "Keep-Alive";
+ public static final String NO_CACHE = "no-cache";
+ public static final String CRLF = "\r\n";
+ public static final String TWO_HYPHENS = "--";
+ public static final String BOUNDARY = "*****";
+ public static final String MULTIPART = "multipart/form-data";
+ public static final String HTTPS = "https";
+
+ public TurFileAttributes processUrl(TurSNServer turServer, URI url) {
+ return getTurFileAttributes(turServer,
+ new JSONObject().put(URL, url.toString()),
+ String.format(API_OCR_URL, turServer.getServerURL()));
+ }
+
+ public TurFileAttributes processFile(TurSNServer turServer, File file) {
+ return getTurFileAttributes(turServer,
+ file,
+ String.format(API_OCR_FILE, turServer.getServerURL()));
+ }
+
+ private TurFileAttributes getTurFileAttributes(TurSNServer turServer, JSONObject jsonObject,
+ String endpoint) {
+ try {
+ URLConnection urlConnection = getURLConnection(turServer, endpoint);
+ urlConnection.setRequestProperty(CONTENT_TYPE_HEADER, APPLICATION_JSON);
+ OutputStream os = urlConnection.getOutputStream();
+ byte[] input = jsonObject.toString().getBytes(UTF_8);
+ os.write(input, 0, input.length);
+
+ return new ObjectMapper().readValue(TurClientUtils.openConnectionAndRequest(urlConnection),
+ TurFileAttributes.class);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return null;
+ }
+
+ private static URLConnection getURLConnection(TurSNServer turServer, String endpoint) throws IOException {
+ URL url = TurClientUtils.getURL(endpoint);
+ URLConnection urlConnection = url.openConnection();
+ if (endpoint.toLowerCase().startsWith(HTTPS)) {
+ ((HttpsURLConnection) urlConnection).setSSLSocketFactory(new TLSSocketConnectionFactory());
+ }
+ urlConnection.setRequestProperty(ACCEPT_HEADER, APPLICATION_JSON);
+ urlConnection.setRequestProperty(ACCEPT_ENCODING_HEADER, UTF_8);
+ urlConnection.setRequestProperty(CONNECTION, KEEP_ALIVE);
+ urlConnection.setRequestProperty(CACHE_CONTROL, NO_CACHE);
+ ((HttpURLConnection) urlConnection).setRequestMethod(POST);
+ urlConnection.setUseCaches(false);
+ urlConnection.setDoOutput(true);
+ TurSNClientUtils.basicAuth(urlConnection, turServer.getCredentials());
+
+ return urlConnection;
+ }
+
+ private TurFileAttributes getTurFileAttributes(TurSNServer turServer, File file,
+ String endpoint) {
+ String attachmentFileName = file.getName();
+ try {
+ URLConnection urlConnection = getURLConnection(turServer, endpoint);
+ urlConnection.setRequestProperty(
+ CONTENT_TYPE_HEADER, MULTIPART + ";boundary=" + BOUNDARY);
+ DataOutputStream request = new DataOutputStream(
+ urlConnection.getOutputStream());
+ request.writeBytes(TWO_HYPHENS + BOUNDARY + CRLF);
+ request.writeBytes("Content-Disposition: form-data; name=\"" +
+ FILE + "\";filename=\"" +
+ attachmentFileName + "\"" + CRLF);
+ request.writeBytes(CRLF);
+
+ byte[] byteArray = new byte[(int) file.length()];
+ FileInputStream inputStream = new FileInputStream(file);
+ inputStream.read(byteArray);
+
+ request.write(byteArray);
+ request.writeBytes(CRLF);
+ request.writeBytes(TWO_HYPHENS + BOUNDARY +
+ TWO_HYPHENS + CRLF);
+ request.flush();
+ request.close();
+
+ return new ObjectMapper().readValue(TurClientUtils.openConnectionAndRequest(urlConnection),
+ TurFileAttributes.class);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return new TurFileAttributes();
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/sample/TurClientOcrSample.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/sample/TurClientOcrSample.java
new file mode 100644
index 00000000000..4361c8316dc
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ocr/sample/TurClientOcrSample.java
@@ -0,0 +1,53 @@
+package com.viglet.turing.client.ocr.sample;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.viglet.turing.client.ocr.TurFileAttributes;
+import com.viglet.turing.client.ocr.TurOcr;
+import com.viglet.turing.client.sn.TurSNServer;
+import com.viglet.turing.client.sn.credentials.TurUsernamePasswordCredentials;
+import org.apache.log4j.Logger;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+
+public class TurClientOcrSample {
+ private static final Logger log = Logger.getLogger(TurClientOcrSample.class);
+
+ public static void main(String[] args) throws JsonProcessingException {
+ if (args.length == 4) {
+ String turingUrl = args[0];
+ String username = args[1];
+ String password = args[2];
+ String fileUrl = args[3];
+ System.out.println("--- Ocr Url");
+ TurFileAttributes turFileAttributes = getAttributes(turingUrl, username, password, fileUrl);
+ if (turFileAttributes != null) {
+ System.out.println(new ObjectMapper().writer().withDefaultPrettyPrinter().writeValueAsString(turFileAttributes));
+ }
+ } else {
+ System.out.println("Parameters: turingUrl username password fileUrl");
+ }
+ }
+
+ private static TurFileAttributes getAttributes(String turingUrl, String username, String password, String fileUrl) {
+ try {
+ TurSNServer turSNServer = new TurSNServer(new URL(turingUrl),
+ new TurUsernamePasswordCredentials(username, password));
+
+ TurOcr turOcr = new TurOcr();
+ if (fileUrl.toLowerCase().startsWith("http")) {
+ return turOcr.processUrl(turSNServer, URI.create(fileUrl));
+
+ } else {
+ return turOcr.processFile(turSNServer, new File(fileUrl));
+ }
+
+ } catch (MalformedURLException e) {
+ log.error(e.getMessage(), e);
+ }
+ return new TurFileAttributes();
+ }
+}
\ No newline at end of file
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/HttpTurSNServer.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/HttpTurSNServer.java
new file mode 100644
index 00000000000..9fa1103cb15
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/HttpTurSNServer.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+import java.net.URL;
+
+import com.viglet.turing.client.sn.credentials.TurUsernamePasswordCredentials;
+
+/**
+ * HTTP of TurnSNServer.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class HttpTurSNServer extends TurSNServer {
+
+ @Deprecated
+ public HttpTurSNServer(String turSNServer) {
+ super(turSNServer);
+
+ }
+
+ public HttpTurSNServer(URL serverURL, String siteName) {
+ super(serverURL, siteName);
+ }
+
+ public HttpTurSNServer(URL serverURL, String siteName, String locale) {
+ super(serverURL, siteName, locale);
+
+ }
+
+ public HttpTurSNServer(URL serverURL, String siteName, String locale, TurUsernamePasswordCredentials credentials) {
+ super(serverURL, siteName, locale, credentials);
+
+ }
+
+ public HttpTurSNServer(URL serverURL, String siteName, String locale, TurUsernamePasswordCredentials credentials,
+ String userId) {
+ super(serverURL, siteName, locale, credentials, userId);
+
+ }
+
+}
\ No newline at end of file
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNClientBetweenDates.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNClientBetweenDates.java
new file mode 100644
index 00000000000..ec1a052cab6
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNClientBetweenDates.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+import java.util.Date;
+
+/**
+ * Create a query and specify between dates.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNClientBetweenDates {
+
+ private String field;
+
+ private Date startDate;
+
+ private Date endDate;
+
+ public TurSNClientBetweenDates(String field, Date startDate, Date endDate) {
+ this.setField(field);
+ this.setStartDate(startDate);
+ this.setEndDate(endDate);
+ }
+
+ public String getField() {
+ return field;
+ }
+
+
+ public void setField(String field) {
+ this.field = field;
+ }
+
+
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate) {
+ this.startDate = startDate;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate) {
+ this.endDate = endDate;
+ }
+
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNDocument.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNDocument.java
new file mode 100644
index 00000000000..619df19bd0f
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNDocument.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+import com.viglet.turing.api.sn.bean.TurSNSiteSearchDocumentBean;
+
+/**
+ * Get Info about a document result.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNDocument {
+
+ private TurSNSiteSearchDocumentBean turSNSiteSearchDocumentBean;
+
+ public Object getFieldValue(String field) {
+ if (turSNSiteSearchDocumentBean != null && turSNSiteSearchDocumentBean.getFields() != null && turSNSiteSearchDocumentBean.getFields().containsKey(field)) {
+ return turSNSiteSearchDocumentBean.getFields().get(field);
+ } else {
+ return null;
+ }
+ }
+
+ public TurSNSiteSearchDocumentBean getContent() {
+ return turSNSiteSearchDocumentBean;
+ }
+
+ public void setContent(TurSNSiteSearchDocumentBean turSNSiteSearchDocumentBean) {
+ this.turSNSiteSearchDocumentBean = turSNSiteSearchDocumentBean;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNDocumentList.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNDocumentList.java
new file mode 100644
index 00000000000..c6a5ec2b95c
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNDocumentList.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.viglet.turing.api.sn.bean.TurSNSiteSearchQueryContext;
+
+/**
+ * List of Document result.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNDocumentList implements Iterable {
+ private List turSNDocuments = new ArrayList();
+ private TurSNSiteSearchQueryContext queryContext;
+ @Override
+ public Iterator iterator() {
+ return turSNDocuments.iterator();
+ }
+
+ public List getTurSNDocuments() {
+ return turSNDocuments;
+ }
+
+ public void setTurSNDocuments(List turSNDocuments) {
+ this.turSNDocuments = turSNDocuments;
+ }
+
+ public TurSNSiteSearchQueryContext getQueryContext() {
+ return queryContext;
+ }
+
+ public void setQueryContext(TurSNSiteSearchQueryContext queryContext) {
+ this.queryContext = queryContext;
+ }
+
+}
\ No newline at end of file
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNItemWithAPI.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNItemWithAPI.java
new file mode 100644
index 00000000000..f325d2c5a9e
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNItemWithAPI.java
@@ -0,0 +1,74 @@
+package com.viglet.turing.client.sn;
+
+import com.viglet.turing.client.sn.utils.TurSNClientUtils;
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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.
+ */
+
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import com.viglet.turing.client.sn.utils.TurSNClientUtils;
+/**
+ * Class with apiURL and method to return query parameters.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNItemWithAPI {
+
+ static Logger logger = Logger.getLogger(TurSNItemWithAPI.class.getName());
+ private String apiURL;
+
+ public TurSNItemWithAPI() {
+ super();
+ }
+
+ public String getApiURL() {
+ return apiURL;
+ }
+
+ public void setApiURL(String apiURL) {
+ this.apiURL = apiURL;
+ }
+
+ public TurSNQueryParamMap getQueryParams() {
+ String apiURL = getApiURL();
+
+ if (apiURL != null) {
+ TurSNQueryParamMap queryParams = new TurSNQueryParamMap();
+ try {
+ for (Entry> param : TurSNClientUtils.splitQuery(new URL(this.apiURL)).entrySet()) {
+ queryParams.get(param.getKey()).addAll(param.getValue());
+ }
+ } catch (UnsupportedEncodingException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ } catch (MalformedURLException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return queryParams;
+ }
+ return null;
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNLocale.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNLocale.java
new file mode 100644
index 00000000000..e0b653f77a1
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNLocale.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+/**
+ * Locale of Turing AI Semantic Navigation response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.5
+ */
+
+public class TurSNLocale {
+ private String locale;
+ private String link;
+
+ public String getLocale() {
+ return locale;
+ }
+
+ public void setLocale(String locale) {
+ this.locale = locale;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+ public String toString() {
+ return String.format("%s: %s", getLocale(), getLink());
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNQuery.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNQuery.java
new file mode 100644
index 00000000000..b001d8ede56
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNQuery.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Configure the query that will send to Turing AI.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNQuery {
+
+ /**
+ * Sorting types.
+ *
+ * @since 0.3.4
+ */
+ public enum ORDER {
+ asc, desc
+ }
+
+ private String query;
+ private int rows;
+ private TurSNSortField sortField;
+ private TurSNClientBetweenDates betweenDates;
+ private List fieldQueries;
+ private List targetingRules;
+ private int pageNumber;
+ private boolean populateMetrics;
+
+ public String getQuery() {
+ return query;
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public void setRows(int rows) {
+ this.rows = rows;
+ }
+
+ public TurSNSortField getSortField() {
+ return sortField;
+ }
+
+ public void setSortField(TurSNSortField sortField) {
+ this.sortField = sortField;
+ }
+
+ public void setSortField(String field, TurSNQuery.ORDER sort) {
+ if (this.sortField == null) {
+ this.sortField = new TurSNSortField();
+ }
+ this.sortField.setField(field);
+ this.sortField.setSort(sort);
+ }
+
+ public void setSortField(TurSNQuery.ORDER sort) {
+ if (this.sortField == null) {
+ this.sortField = new TurSNSortField();
+ }
+ this.sortField.setField(null);
+ this.sortField.setSort(sort);
+ }
+
+ public TurSNClientBetweenDates getBetweenDates() {
+ return betweenDates;
+ }
+
+ public void setBetweenDates(TurSNClientBetweenDates betweenDates) {
+ this.betweenDates = betweenDates;
+ }
+
+ public void setBetweenDates(String field, Date startDate, Date endDate) {
+
+ this.betweenDates = new TurSNClientBetweenDates(field, startDate, endDate);
+ }
+
+ public void addFilterQuery(String... fq) {
+ if (this.fieldQueries == null) {
+ this.fieldQueries = new ArrayList();
+ }
+ for (int i = 0; i < fq.length; i++) {
+ fieldQueries.add(fq[i]);
+ }
+ }
+
+ public List getFieldQueries() {
+ return fieldQueries;
+ }
+
+ public void setFieldQueries(List fieldQueries) {
+ this.fieldQueries = fieldQueries;
+ }
+
+ public void addTargetingRule(String... tr) {
+ if (this.targetingRules == null) {
+ this.targetingRules = new ArrayList();
+ }
+ for (int i = 0; i < tr.length; i++) {
+ targetingRules.add(tr[i]);
+ }
+ }
+
+ public List getTargetingRules() {
+ return targetingRules;
+ }
+
+ public void setTargetingRules(List targetingRules) {
+ this.targetingRules = targetingRules;
+ }
+
+ public int getPageNumber() {
+ return pageNumber;
+ }
+
+ public void setPageNumber(int pageNumber) {
+ this.pageNumber = pageNumber;
+ }
+
+ public boolean isPopulateMetrics() {
+ return populateMetrics;
+ }
+
+ public void setPopulateMetrics(boolean populateMetrics) {
+ this.populateMetrics = populateMetrics;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNQueryParamMap.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNQueryParamMap.java
new file mode 100644
index 00000000000..c7735a2b70f
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNQueryParamMap.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ * HashMap class for query parameters.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNQueryParamMap extends LinkedHashMap> {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNServer.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNServer.java
new file mode 100644
index 00000000000..cc4c19deb24
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNServer.java
@@ -0,0 +1,543 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.*;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.TimeZone;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+
+import com.viglet.turing.client.utils.TurClientUtils;
+import org.json.JSONException;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.viglet.turing.client.ssl.TLSSocketConnectionFactory;
+import com.viglet.turing.api.sn.bean.TurSNSearchLatestRequestBean;
+import com.viglet.turing.api.sn.bean.TurSNSitePostParamsBean;
+import com.viglet.turing.api.sn.bean.TurSNSiteSearchBean;
+import com.viglet.turing.api.sn.bean.TurSNSiteSearchDocumentBean;
+import com.viglet.turing.api.sn.bean.TurSNSiteSearchQueryContext;
+import com.viglet.turing.api.sn.bean.TurSNSiteSpotlightDocumentBean;
+import com.viglet.turing.api.sn.search.TurSNParamType;
+import com.viglet.turing.client.sn.TurSNQuery.ORDER;
+import com.viglet.turing.client.sn.autocomplete.TurSNAutoCompleteQuery;
+import com.viglet.turing.client.sn.credentials.TurUsernamePasswordCredentials;
+import com.viglet.turing.client.sn.didyoumean.TurSNDidYouMean;
+import com.viglet.turing.client.sn.facet.TurSNFacetFieldList;
+import com.viglet.turing.client.sn.pagination.TurSNPagination;
+import com.viglet.turing.client.sn.response.QueryTurSNResponse;
+import com.viglet.turing.client.sn.spotlight.TurSNSpotlightDocument;
+import com.viglet.turing.client.sn.utils.TurSNClientUtils;
+
+import javax.net.ssl.HttpsURLConnection;
+
+/**
+ * Connect to Turing AI Server.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNServer {
+
+ private static final Logger logger = Logger.getLogger(TurSNServer.class.getName());
+
+ private static final String SITE_NAME_DEFAULT = "Sample";
+
+ private static final String LOCALE_DEFAULT = "en_US";
+
+ private static final String PAGE_DEFAULT = "1";
+
+ private static final String PROVIDER_NAME_DEFAULT = "turing-java-sdk";
+
+ private static final String AUTO_COMPLETE_CONTEXT = "/ac";
+
+ private static final String LOCALES_CONTEXT = "/search/locales";
+
+ private static final String LATEST_SEARCHES_CONTEXT = "/search/latest";
+
+ private static final String SEARCH_CONTEXT = "/search";
+
+ private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
+
+ private static final String UTC_TIMEZONE = "UTC";
+
+ private static final String NEWEST_SORT = "newest";
+
+ private static final String OLDEST_SORT = "oldest";
+
+ private static final String RELEVANCE_SORT = "relevance";
+
+ private static final String UTF_8 = "UTF-8";
+
+ private static final String ACCEPT_HEADER = "Accept";
+
+ private static final String CONTENT_TYPE_HEADER = "Content-Type";
+
+ private static final String ACCEPT_ENCODING_HEADER = "Accept-Encoding";
+
+ private static final String APPLICATION_JSON = "application/json";
+ public static final String HTTPS = "https";
+ public static final String POST = "POST";
+
+ private String turSNServer;
+
+ private TurSNQuery turSNQuery;
+
+ private URL serverURL;
+
+ private String siteName;
+
+ private String locale;
+
+ private TurSNSitePostParamsBean turSNSitePostParams;
+
+ private TurUsernamePasswordCredentials credentials;
+
+ private String providerName;
+
+ @Deprecated
+ public TurSNServer(String turSNServer) {
+ super();
+ this.turSNServer = turSNServer;
+ this.siteName = SITE_NAME_DEFAULT;
+ this.locale = LOCALE_DEFAULT;
+ this.credentials = null;
+ this.providerName = PROVIDER_NAME_DEFAULT;
+ this.turSNSitePostParams = new TurSNSitePostParamsBean();
+ this.turSNSitePostParams.setUserId(null);
+ this.turSNSitePostParams.setPopulateMetrics(true);
+ }
+
+ public TurSNServer(URL serverURL, String siteName, String locale, TurUsernamePasswordCredentials credentials,
+ String userId) {
+ super();
+ this.serverURL = serverURL;
+ this.siteName = siteName;
+ this.locale = locale;
+ this.turSNServer = String.format("%s/api/sn/%s", this.serverURL, this.siteName);
+ this.credentials = credentials;
+ this.providerName = PROVIDER_NAME_DEFAULT;
+ this.turSNSitePostParams = new TurSNSitePostParamsBean();
+ this.turSNSitePostParams.setUserId(userId);
+ this.turSNSitePostParams.setPopulateMetrics(true);
+
+ }
+
+ public TurSNServer(URL serverURL, String siteName) {
+ this(serverURL, siteName, LOCALE_DEFAULT);
+ }
+
+ public TurSNServer(URL serverURL, String siteName, String locale) {
+ this(serverURL, siteName, locale, null);
+ }
+
+ public TurSNServer(URL serverURL, String siteName, String locale, TurUsernamePasswordCredentials credentials) {
+ this(serverURL, siteName, locale, credentials, credentials != null ? credentials.getUsername() : null);
+ }
+
+ public TurSNServer(URL serverURL, TurUsernamePasswordCredentials credentials) {
+ this(serverURL, SITE_NAME_DEFAULT, LOCALE_DEFAULT, credentials,
+ credentials != null ? credentials.getUsername() : null);
+ }
+
+ public String getTuringServer() {
+ return turSNServer;
+ }
+
+ public void setTuringServer(String turingServer) {
+ this.turSNServer = turingServer;
+ }
+
+ public URL getServerURL() {
+ return serverURL;
+ }
+
+ public void setServerURL(URL serverURL) {
+ this.serverURL = serverURL;
+ }
+
+ public String getSiteName() {
+ return siteName;
+ }
+
+ public void setSiteName(String siteName) {
+ this.siteName = siteName;
+ }
+
+ public String getLocale() {
+ return locale;
+ }
+
+ public void setLocale(String locale) {
+ this.locale = locale;
+ }
+
+ public TurUsernamePasswordCredentials getCredentials() {
+ return credentials;
+ }
+
+ public void setCredentials(TurUsernamePasswordCredentials credentials) {
+ this.credentials = credentials;
+ }
+
+ public String getProviderName() {
+ return providerName;
+ }
+
+ public void setProviderName(String providerName) {
+ this.providerName = providerName;
+ }
+
+ public TurSNSitePostParamsBean getTurSNSitePostParams() {
+ return turSNSitePostParams;
+ }
+
+ public void setTurSNSitePostParams(TurSNSitePostParamsBean turSNSitePostParams) {
+ this.turSNSitePostParams = turSNSitePostParams;
+ }
+
+ public List getLatestSearches(int rows) {
+ try {
+ URL turingURL = new URL(turSNServer.concat(LATEST_SEARCHES_CONTEXT));
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.LOCALE, getLocale());
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.ROWS, Integer.toString(rows));
+
+ if (this.getCredentials() != null) {
+ URL url = TurClientUtils.getURL(turingURL.toString());
+ URLConnection urlConnection = url.openConnection();
+ if (turingURL.toString() .startsWith(HTTPS)) {
+ ((HttpsURLConnection) urlConnection).setSSLSocketFactory(new TLSSocketConnectionFactory());
+ }
+ urlConnection.setRequestProperty(ACCEPT_HEADER, APPLICATION_JSON);
+ urlConnection.setRequestProperty(CONTENT_TYPE_HEADER, APPLICATION_JSON);
+ urlConnection.setRequestProperty(ACCEPT_ENCODING_HEADER, UTF_8);
+
+ ((HttpURLConnection) urlConnection).setRequestMethod(POST);
+ urlConnection.setDoOutput(true);
+
+ TurSNClientUtils.basicAuth(urlConnection, this.getCredentials());
+
+ if (this.getTurSNSitePostParams() != null && this.getTurSNSitePostParams().getUserId() != null) {
+ TurSNSearchLatestRequestBean turSNSearchLatestRequestBean = new TurSNSearchLatestRequestBean();
+ turSNSearchLatestRequestBean.setUserId(this.getTurSNSitePostParams().getUserId());
+ String jsonResult = new ObjectMapper().writeValueAsString(turSNSearchLatestRequestBean);
+
+ OutputStream os = urlConnection.getOutputStream();
+ byte[] input = jsonResult.getBytes(UTF_8);
+ os.write(input, 0, input.length);
+ }
+
+
+
+ logger.fine(String.format("Viglet Turing Request: %s", turingURL.toString()));
+ return new ObjectMapper().readValue(TurClientUtils.openConnectionAndRequest(urlConnection),
+ new TypeReference>() {
+ });
+ }
+ } catch (MalformedURLException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return Collections.emptyList();
+
+ }
+
+ public List getLocales() {
+ return executeLocalesRequest(prepareLocalesRequest());
+
+ }
+
+ public List autoComplete(TurSNAutoCompleteQuery autoCompleteQuery) {
+ return executeAutoCompleteRequest(prepareAutoCompleteRequest(autoCompleteQuery));
+ }
+
+ private List executeLocalesRequest(URLConnection urlConnection) {
+
+ try {
+
+ int responseCode = ((HttpsURLConnection) urlConnection).getResponseCode();
+ String result = TurClientUtils.getTurResponseBody(urlConnection, responseCode);
+ return new ObjectMapper().readValue(result, new TypeReference>() {
+ });
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return null;
+ }
+
+ private List executeAutoCompleteRequest(URLConnection urlConnection) {
+ String result;
+ try {
+ int responseCode = ((HttpURLConnection) urlConnection).getResponseCode();
+ result = TurClientUtils.getTurResponseBody(urlConnection, responseCode);
+ return new ObjectMapper().readValue(result, new TypeReference>() {
+ });
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return null;
+
+ }
+
+ private URLConnection prepareLocalesRequest() {
+ try {
+ return prepareGetRequest(new URL(turSNServer.concat(LOCALES_CONTEXT)));
+ } catch (MalformedURLException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return null;
+ }
+
+ private URLConnection prepareAutoCompleteRequest(TurSNAutoCompleteQuery autoCompleteQuery) {
+
+ try {
+ URL turingURL = new URL(turSNServer.concat(AUTO_COMPLETE_CONTEXT));
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.LOCALE, getLocale());
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.QUERY, autoCompleteQuery.getQuery());
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.ROWS, Integer.toString(autoCompleteQuery.getRows()));
+ return prepareGetRequest(turingURL);
+ } catch (MalformedURLException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return null;
+ }
+
+ public QueryTurSNResponse query(TurSNQuery turSNQuery) {
+ this.turSNQuery = turSNQuery;
+ try {
+ TurSNSiteSearchBean turSNSiteSearchBean = new ObjectMapper()
+ .readValue(TurClientUtils.openConnectionAndRequest(prepareQueryRequest()), TurSNSiteSearchBean.class);
+ return createTuringResponse(turSNSiteSearchBean);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return new QueryTurSNResponse();
+ }
+
+
+
+
+
+ private URLConnection prepareQueryRequest() {
+
+ try {
+ URL turingURL = new URL(turSNServer.concat(SEARCH_CONTEXT));
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.LOCALE, getLocale());
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.QUERY, this.turSNQuery.getQuery());
+
+ rowsRequest(turingURL);
+ fieldQueryRequest(turingURL);
+ sortRequest(turingURL);
+ betweenDatesRequest(turingURL);
+ pageNumberRequest(turingURL);
+ if (this.getCredentials() != null) {
+ this.getTurSNSitePostParams().setPopulateMetrics(this.turSNQuery.isPopulateMetrics());
+ this.getTurSNSitePostParams().setTargetingRules(this.turSNQuery.getTargetingRules());
+ return preparePostRequest(turingURL);
+ } else {
+ return prepareGetRequest(turingURL);
+ }
+
+ } catch (MalformedURLException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return null;
+ }
+
+ private QueryTurSNResponse createTuringResponse(TurSNSiteSearchBean turSNSiteSearchBean) {
+ QueryTurSNResponse queryTuringResponse = new QueryTurSNResponse();
+ queryTuringResponse.setResults(setResultsResponse(turSNSiteSearchBean));
+ queryTuringResponse.setPagination(new TurSNPagination(turSNSiteSearchBean.getPagination()));
+ queryTuringResponse.setFacetFields(setFacetFieldsResponse(turSNSiteSearchBean));
+ queryTuringResponse.setDidYouMean(new TurSNDidYouMean(turSNSiteSearchBean.getWidget().getSpellCheck()));
+ queryTuringResponse
+ .setSpotlightDocuments(setSpotlightDocumetsResponse(turSNSiteSearchBean.getWidget().getSpotlights()));
+ return queryTuringResponse;
+ }
+
+ private List setSpotlightDocumetsResponse(
+ List turSNSiteSpotlightDocumentBeans) {
+ List turSNSpotlightDocuments = new ArrayList();
+ for (TurSNSiteSpotlightDocumentBean turSNSiteSpotlightDocumentBean : turSNSiteSpotlightDocumentBeans) {
+ turSNSpotlightDocuments.add(new TurSNSpotlightDocument(turSNSiteSpotlightDocumentBean));
+ }
+ return turSNSpotlightDocuments;
+ }
+
+ private TurSNFacetFieldList setFacetFieldsResponse(TurSNSiteSearchBean turSNSiteSearchBean) {
+ return new TurSNFacetFieldList(turSNSiteSearchBean.getWidget().getFacet(),
+ turSNSiteSearchBean.getWidget().getFacetToRemove());
+ }
+
+ private TurSNDocumentList setResultsResponse(TurSNSiteSearchBean turSNSiteSearchBean) {
+ List turSNDocuments = new ArrayList();
+ for (TurSNSiteSearchDocumentBean turSNSiteSearchDocumentBean : turSNSiteSearchBean.getResults().getDocument()) {
+ TurSNDocument turSNDocument = new TurSNDocument();
+ turSNDocument.setContent(turSNSiteSearchDocumentBean);
+ turSNDocuments.add(turSNDocument);
+ }
+
+ TurSNSiteSearchQueryContext turSNSiteSearchQueryContext = turSNSiteSearchBean.getQueryContext();
+ TurSNDocumentList turSNDocumentList = new TurSNDocumentList();
+ turSNDocumentList.setTurSNDocuments(turSNDocuments);
+ turSNDocumentList.setQueryContext(turSNSiteSearchQueryContext);
+ return turSNDocumentList;
+ }
+
+ private URLConnection preparePostRequest(URL turingURL) {
+ URLConnection urlConnection = null;
+ try {
+ URL url = TurClientUtils.getURL(turingURL.toString());
+ urlConnection = url.openConnection();
+ if (turingURL.toString().toLowerCase().startsWith(HTTPS)) {
+ ((HttpsURLConnection) urlConnection).setSSLSocketFactory(new TLSSocketConnectionFactory());
+ }
+
+ urlConnection.setRequestProperty(ACCEPT_HEADER, APPLICATION_JSON);
+ urlConnection.setRequestProperty(CONTENT_TYPE_HEADER, APPLICATION_JSON);
+ urlConnection.setRequestProperty(ACCEPT_ENCODING_HEADER, UTF_8);
+ ((HttpURLConnection) urlConnection).setRequestMethod(POST);
+ urlConnection.setDoOutput(true);
+
+ TurSNClientUtils.basicAuth(urlConnection, this.getCredentials());
+
+ String jsonResult = new ObjectMapper().writeValueAsString(this.getTurSNSitePostParams());
+
+ OutputStream os = urlConnection.getOutputStream();
+ byte[] input = jsonResult.getBytes(UTF_8);
+ os.write(input, 0, input.length);
+
+
+
+ logger.fine(String.format("Viglet Turing Request: %s", turingURL.toString()));
+ } catch (MalformedURLException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ } catch (JSONException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+
+ return urlConnection;
+
+ }
+
+ private URLConnection prepareGetRequest(URL turingURL) {
+ URLConnection urlConnection = null;
+ try {
+ URL url = new URL(null, turingURL.toString(), new sun.net.www.protocol.https.Handler());
+ urlConnection = url.openConnection();
+ if (turingURL.toString().toLowerCase().startsWith(HTTPS)) {
+ ((HttpsURLConnection) urlConnection).setSSLSocketFactory(new TLSSocketConnectionFactory());
+ }
+ urlConnection.setRequestProperty(ACCEPT_HEADER, APPLICATION_JSON);
+ urlConnection.setRequestProperty(CONTENT_TYPE_HEADER, APPLICATION_JSON);
+ urlConnection.setRequestProperty(ACCEPT_ENCODING_HEADER, UTF_8);
+
+ ((HttpURLConnection) urlConnection).setRequestMethod("GET");
+ urlConnection.setDoOutput(true);
+
+ } catch (MalformedURLException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ } catch (JSONException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+
+ return urlConnection;
+ }
+
+ private void pageNumberRequest(URL turingURL) {
+ if (this.turSNQuery.getPageNumber() > 0) {
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.PAGE,
+ String.format(Integer.toString(this.turSNQuery.getPageNumber())));
+ } else {
+ TurSNClientUtils.addURLParameter(turingURL,TurSNParamType.PAGE, PAGE_DEFAULT);
+ }
+ }
+
+ private void betweenDatesRequest(URL turingURL) {
+ if (this.turSNQuery.getBetweenDates() != null) {
+ TurSNClientBetweenDates turClientBetweenDates = this.turSNQuery.getBetweenDates();
+ if (turClientBetweenDates.getField() != null && turClientBetweenDates.getStartDate() != null
+ && turClientBetweenDates.getEndDate() != null) {
+ TimeZone tz = TimeZone.getTimeZone(UTC_TIMEZONE);
+ DateFormat df = new SimpleDateFormat(DATE_FORMAT);
+ df.setTimeZone(tz);
+
+ String fieldDate = turClientBetweenDates.getField();
+ String startDate = df.format(turClientBetweenDates.getStartDate());
+ String endDate = df.format(turClientBetweenDates.getEndDate());
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.FILTER_QUERIES,
+ String.format("%s:[%s TO %s]", fieldDate, startDate, endDate));
+ }
+ }
+ }
+
+ private void sortRequest(URL turingURL) {
+ if (this.turSNQuery.getSortField() != null) {
+ TurSNSortField turSortField = this.turSNQuery.getSortField();
+
+ if (turSortField.getSort() != null) {
+ if (turSortField.getField() == null) {
+ String orderMod = null;
+ if (turSortField.getSort().name().equals(ORDER.desc.name())) {
+ orderMod = NEWEST_SORT;
+ } else if (turSortField.getSort().name().equals(ORDER.asc.name())) {
+ orderMod = OLDEST_SORT;
+ } else {
+ orderMod = RELEVANCE_SORT;
+ }
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.SORT, orderMod);
+ } else {
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.SORT,
+ String.format("%s %s", turSortField.getField(), turSortField.getSort().name()));
+ }
+ }
+ }
+ }
+
+ private void fieldQueryRequest(URL turingURL) {
+ if (this.turSNQuery.getFieldQueries() != null) {
+ for (String fieldQuery : this.turSNQuery.getFieldQueries()) {
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.FILTER_QUERIES, fieldQuery);
+ }
+ }
+ }
+
+ private void rowsRequest(URL turingURL) {
+ if (this.turSNQuery.getRows() > 0) {
+ TurSNClientUtils.addURLParameter(turingURL, TurSNParamType.ROWS, Integer.toString(this.turSNQuery.getRows()));
+ }
+ }
+
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNSiteSearchQueryContext.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNSiteSearchQueryContext.java
new file mode 100644
index 00000000000..95bdf7b3a6f
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNSiteSearchQueryContext.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Return details about Turing AI response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchQueryContext {
+
+ private int count;
+ private String index;
+ private int limit;
+ private int offset;
+ private int page;
+ private int pageCount;
+ private int pageEnd;
+ private int pageStart;
+ private long responseTime;
+ private TurSNSiteSearchQueryContextQuery query;
+ public int getCount() {
+ return count;
+ }
+ public void setCount(int count) {
+ this.count = count;
+ }
+ public String getIndex() {
+ return index;
+ }
+ public void setIndex(String index) {
+ this.index = index;
+ }
+ public int getLimit() {
+ return limit;
+ }
+ public void setLimit(int limit) {
+ this.limit = limit;
+ }
+ public int getOffset() {
+ return offset;
+ }
+ public void setOffset(int offset) {
+ this.offset = offset;
+ }
+ public int getPage() {
+ return page;
+ }
+ public void setPage(int page) {
+ this.page = page;
+ }
+ public int getPageCount() {
+ return pageCount;
+ }
+ public void setPageCount(int pageCount) {
+ this.pageCount = pageCount;
+ }
+ public int getPageEnd() {
+ return pageEnd;
+ }
+ public void setPageEnd(int pageEnd) {
+ this.pageEnd = pageEnd;
+ }
+ public int getPageStart() {
+ return pageStart;
+ }
+ public void setPageStart(int pageStart) {
+ this.pageStart = pageStart;
+ }
+ public long getResponseTime() {
+ return responseTime;
+ }
+ public void setResponseTime(long responseTime) {
+ this.responseTime = responseTime;
+ }
+ public TurSNSiteSearchQueryContextQuery getQuery() {
+ return query;
+ }
+ public void setQuery(TurSNSiteSearchQueryContextQuery query) {
+ this.query = query;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNSiteSearchQueryContextQuery.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNSiteSearchQueryContextQuery.java
new file mode 100644
index 00000000000..2491cc3ddd4
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNSiteSearchQueryContextQuery.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * Return details about Turing AI response query.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TurSNSiteSearchQueryContextQuery {
+
+ private String queryString;
+ private String sort;
+ public String getQueryString() {
+ return queryString;
+ }
+ public void setQueryString(String queryString) {
+ this.queryString = queryString;
+ }
+ public String getSort() {
+ return sort;
+ }
+ public void setSort(String sort) {
+ this.sort = sort;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNSortField.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNSortField.java
new file mode 100644
index 00000000000..25a7e5837df
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/TurSNSortField.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn;
+
+/**
+ * Specify and retrieve Turing AI sort.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNSortField {
+
+ private String field;
+ private TurSNQuery.ORDER sort;
+
+ public String getField() {
+ return field;
+ }
+ public void setField(String field) {
+ this.field = field;
+ }
+ public TurSNQuery.ORDER getSort() {
+ return sort;
+ }
+ public void setSort(TurSNQuery.ORDER sort) {
+ this.sort = sort;
+ }
+
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/autocomplete/TurSNAutoCompleteQuery.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/autocomplete/TurSNAutoCompleteQuery.java
new file mode 100644
index 00000000000..ad45e1c338d
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/autocomplete/TurSNAutoCompleteQuery.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.autocomplete;
+
+/**
+ * Auto Complete Query Builder
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNAutoCompleteQuery {
+
+ private String query;
+
+ private int rows;
+
+ public String getQuery() {
+ return query;
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public void setRows(int rows) {
+ this.rows = rows;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/credentials/TurCredentials.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/credentials/TurCredentials.java
new file mode 100644
index 00000000000..9bef706e4b5
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/credentials/TurCredentials.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.viglet.turing.client.sn.credentials;
+
+/**
+ * Turing Server Credentials Interface.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.5
+ */
+public interface TurCredentials {
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/credentials/TurUsernamePasswordCredentials.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/credentials/TurUsernamePasswordCredentials.java
new file mode 100644
index 00000000000..bf64abd54e5
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/credentials/TurUsernamePasswordCredentials.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.viglet.turing.client.sn.credentials;
+
+/**
+ * Turing Server Credentials.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.5
+ */
+public class TurUsernamePasswordCredentials implements TurCredentials {
+
+ private String username;
+
+ private String password;
+
+ public TurUsernamePasswordCredentials(String username, String password) {
+ super();
+ this.username = username;
+ this.password = password;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/credentials/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/credentials/package-info.java
new file mode 100644
index 00000000000..d8b6d2f0a34
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/credentials/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes necessary to Turing Server Credentials.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.5
+ */
+package com.viglet.turing.client.sn.credentials;
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/didyoumean/TurSNDidYouMean.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/didyoumean/TurSNDidYouMean.java
new file mode 100644
index 00000000000..2ad08fa5e79
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/didyoumean/TurSNDidYouMean.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.didyoumean;
+
+import com.viglet.turing.api.sn.bean.spellcheck.TurSNSiteSpellCheckBean;
+
+/**
+ * Return the correct text of Turing AI response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.5
+ */
+public class TurSNDidYouMean {
+ private boolean correctedText = true;
+ private TurSNDidYouMeanText original;
+ private TurSNDidYouMeanText corrected;
+
+ public TurSNDidYouMean() {
+ super();
+ this.correctedText = true;
+ this.original = new TurSNDidYouMeanText();
+ this.corrected = new TurSNDidYouMeanText();
+ }
+
+ public TurSNDidYouMean(TurSNSiteSpellCheckBean turSNSiteSpellCheckBean) {
+ super();
+ this.correctedText = turSNSiteSpellCheckBean.isCorrectedText();
+ this.original = new TurSNDidYouMeanText(turSNSiteSpellCheckBean.getOriginal());
+ this.corrected = new TurSNDidYouMeanText(turSNSiteSpellCheckBean.getCorrected());
+ }
+
+ public TurSNDidYouMeanText getOriginal() {
+ return original;
+ }
+
+ public void setOriginal(TurSNDidYouMeanText original) {
+ this.original = original;
+ }
+
+ public TurSNDidYouMeanText getCorrected() {
+ return corrected;
+ }
+
+ public void setCorrected(TurSNDidYouMeanText corrected) {
+ this.corrected = corrected;
+ }
+
+ public boolean isCorrectedText() {
+ return correctedText;
+ }
+
+ public void setCorrectedText(boolean correctedText) {
+ this.correctedText = correctedText;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/didyoumean/TurSNDidYouMeanText.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/didyoumean/TurSNDidYouMeanText.java
new file mode 100644
index 00000000000..ede0c415664
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/didyoumean/TurSNDidYouMeanText.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.didyoumean;
+
+import com.viglet.turing.api.sn.bean.spellcheck.TurSNSiteSpellCheckText;
+
+/**
+ * Did You Mean Text Class.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.5
+ */
+public class TurSNDidYouMeanText {
+ private String text;
+ private String link;
+
+ public TurSNDidYouMeanText() {
+ super();
+ }
+
+ public TurSNDidYouMeanText(TurSNSiteSpellCheckText turSNSiteSpellCheckText) {
+ super();
+ this.text = turSNSiteSpellCheckText.getText();
+ this.link = turSNSiteSpellCheckText.getLink();
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetField.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetField.java
new file mode 100644
index 00000000000..1e42a13bca0
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetField.java
@@ -0,0 +1,69 @@
+package com.viglet.turing.client.sn.facet;
+
+public class TurSNFacetField {
+
+ private String label;
+
+ private String name;
+
+ private String description;
+
+ private boolean multiValued;
+
+ private String type;
+
+ private TurSNFacetFieldValueList values;
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public TurSNFacetFieldValueList getValues() {
+ return values;
+ }
+
+ public void setValues(TurSNFacetFieldValueList values) {
+ this.values = values;
+ }
+
+ public int getValueCount() {
+ return values.getTurSNFacetFieldValues().size();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean isMultiValued() {
+ return multiValued;
+ }
+
+ public void setMultiValued(boolean multiValue) {
+ this.multiValued = multiValue;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetFieldList.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetFieldList.java
new file mode 100644
index 00000000000..83c47852066
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetFieldList.java
@@ -0,0 +1,53 @@
+package com.viglet.turing.client.sn.facet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.viglet.turing.api.sn.bean.TurSNSiteSearchFacetBean;
+
+public class TurSNFacetFieldList implements Iterable {
+
+ private List turSNFacetFields = new ArrayList();
+
+ private TurSNFacetField turSNFacetToRemove = null;
+
+ public TurSNFacetFieldList(List facets, TurSNSiteSearchFacetBean facetToRemove) {
+
+ if (facetToRemove != null) {
+
+ TurSNFacetFieldValueList turSNFacetToRemoveFieldValues = new TurSNFacetFieldValueList(
+ facetToRemove.getFacets());
+ turSNFacetToRemove = new TurSNFacetField();
+ turSNFacetToRemove.setValues(turSNFacetToRemoveFieldValues);
+ turSNFacetToRemove.setLabel(facetToRemove.getLabel().getText());
+ }
+
+ if (facets != null) {
+ for (TurSNSiteSearchFacetBean facet : facets) {
+ TurSNFacetFieldValueList turSNFacetFieldValues = new TurSNFacetFieldValueList(facet.getFacets());
+ TurSNFacetField turSNFacetField = new TurSNFacetField();
+ turSNFacetField.setLabel(facet.getLabel().getText());
+ turSNFacetField.setName(facet.getName());
+ turSNFacetField.setDescription(facet.getDescription());
+ turSNFacetField.setMultiValued(facet.isMultiValued());
+ turSNFacetField.setType(facet.getType());
+ turSNFacetField.setValues(turSNFacetFieldValues);
+ this.turSNFacetFields.add(turSNFacetField);
+ }
+ }
+ }
+
+ @Override
+ public Iterator iterator() {
+ return turSNFacetFields.iterator();
+ }
+
+ public List getFields() {
+ return turSNFacetFields;
+ }
+
+ public TurSNFacetField getFacetWithRemovedValues() {
+ return turSNFacetToRemove;
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetFieldValue.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetFieldValue.java
new file mode 100644
index 00000000000..16f07d51547
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetFieldValue.java
@@ -0,0 +1,26 @@
+package com.viglet.turing.client.sn.facet;
+
+import com.viglet.turing.client.sn.TurSNItemWithAPI;
+
+public class TurSNFacetFieldValue extends TurSNItemWithAPI {
+
+ private String label;
+
+ private int count;
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetFieldValueList.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetFieldValueList.java
new file mode 100644
index 00000000000..ccaf084bcf7
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/TurSNFacetFieldValueList.java
@@ -0,0 +1,31 @@
+package com.viglet.turing.client.sn.facet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.viglet.turing.api.sn.bean.TurSNSiteSearchFacetItemBean;
+
+public class TurSNFacetFieldValueList implements Iterable{
+ private List turFacetFieldValues = new ArrayList();
+ public TurSNFacetFieldValueList(List facetItems) {
+ for (TurSNSiteSearchFacetItemBean facetItem : facetItems) {
+ TurSNFacetFieldValue turSNFacetFieldValue = new TurSNFacetFieldValue();
+ turSNFacetFieldValue.setLabel(facetItem.getLabel());
+ turSNFacetFieldValue.setApiURL(facetItem.getLink());
+ turSNFacetFieldValue.setCount(facetItem.getCount());
+ turFacetFieldValues.add(turSNFacetFieldValue);
+ }
+
+ }
+
+ @Override
+ public Iterator iterator() {
+ return turFacetFieldValues.iterator();
+ }
+
+ public List getTurSNFacetFieldValues() {
+ return turFacetFieldValues;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/package-info.java
new file mode 100644
index 00000000000..e5fcf5d05a9
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/facet/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes necessary to return facets of Turing AI response.
+ *
+ * @since 0.3.4
+ */
+package com.viglet.turing.client.sn.facet;
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobAction.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobAction.java
new file mode 100644
index 00000000000..7a77777bd54
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobAction.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.job;
+
+/**
+ * Job Action Types.
+ *
+ * @since 0.3.4
+ */
+public enum TurSNJobAction {
+ CREATE, DELETE;
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItem.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItem.java
new file mode 100644
index 00000000000..e91b9ed0098
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItem.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.job;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Job to index and deindex in Turing AI.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+
+public class TurSNJobItem implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ private String locale;
+
+ private List siteNames;
+
+ private TurSNJobAction turSNJobAction;
+
+ private Map attributes;
+
+ public String getLocale() {
+ return locale;
+ }
+
+ public void setLocale(String locale) {
+ this.locale = locale;
+ }
+
+ public Map getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map attributes) {
+ this.attributes = attributes;
+ }
+
+ public TurSNJobAction getTurSNJobAction() {
+ return turSNJobAction;
+ }
+
+ public void setTurSNJobAction(TurSNJobAction turSNJobAction) {
+ this.turSNJobAction = turSNJobAction;
+ }
+
+ public List getSiteNames() {
+ return siteNames;
+ }
+
+ public void setSiteNames(List siteNames) {
+ this.siteNames = siteNames;
+ }
+
+ public String toString() {
+ return String.format("action: %s, attributes %s", this.getTurSNJobAction(), this.getAttributes().toString());
+ }
+
+}
\ No newline at end of file
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItems.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItems.java
new file mode 100644
index 00000000000..4b077ff7779
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobItems.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.job;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * List of jobs to index and deindex in Turing AI.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class TurSNJobItems implements Iterable, Serializable {
+ private static final long serialVersionUID = 1L;
+ private List turSNJobItems = new ArrayList();
+
+ @Override
+ public Iterator iterator() {
+ return turSNJobItems.iterator();
+ }
+
+ public List getTuringDocuments() {
+ return turSNJobItems;
+ }
+
+ public void setTuringDocuments(List turSNJobItems) {
+ this.turSNJobItems = turSNJobItems;
+ }
+
+ public boolean add(TurSNJobItem turSNJobItem) {
+ return turSNJobItems.add(turSNJobItem);
+ }
+
+ public boolean remove(TurSNJobItem turSNJobItem) {
+ return turSNJobItems.remove(turSNJobItem);
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobUtils.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobUtils.java
new file mode 100644
index 00000000000..a6300b79a72
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/TurSNJobUtils.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.viglet.turing.client.sn.job;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.net.URL;
+import javax.net.ssl.HttpsURLConnection;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.viglet.turing.client.ssl.TLSSocketConnectionFactory;
+import com.viglet.turing.client.sn.TurSNServer;
+import com.viglet.turing.client.sn.utils.TurSNClientUtils;
+
+/**
+ * Turing Semantic Navigation Utilities.
+ *
+ * @author Alexandre Oliveira
+ * @since 0.3.5
+ */
+public class TurSNJobUtils {
+ public static final String HTTPS = "https";
+ public static final String POST = "POST";
+ private static final Logger logger = Logger.getLogger(TurSNJobUtils.class.getName());
+ private static final String TYPE_ATTRIBUTE = "type";
+ private static final String PROVIDER_ATTRIBUTE = "source_apps";
+ private static final String UTF_8 = "UTF-8";
+ private static final String ACCEPT_HEADER = "Accept";
+ private static final String CONTENT_TYPE_HEADER = "Content-Type";
+ private static final String ACCEPT_ENCODING_HEADER = "Accept-Encoding";
+ private static final String APPLICATION_JSON = "application/json";
+
+ public static void importItems(TurSNJobItems turSNJobItems, TurSNServer turSNServer, boolean showOutput) {
+ try {
+ String jsonResult = new ObjectMapper().writeValueAsString(turSNJobItems);
+ String urlString = String.format("%s/api/sn/import", turSNServer.getServerURL());
+ if (showOutput) {
+ System.out.println(jsonResult);
+ }
+ URL url = new URL(null, urlString, new sun.net.www.protocol.https.Handler());
+ URLConnection urlConnection = url.openConnection();
+ if (urlString.toLowerCase().startsWith(HTTPS)) {
+ ((HttpsURLConnection) urlConnection).setSSLSocketFactory(new TLSSocketConnectionFactory());
+ }
+ urlConnection.setRequestProperty(ACCEPT_HEADER, APPLICATION_JSON);
+ urlConnection.setRequestProperty(CONTENT_TYPE_HEADER, APPLICATION_JSON);
+ urlConnection.setRequestProperty(ACCEPT_ENCODING_HEADER, UTF_8);
+
+ ((HttpURLConnection) urlConnection).setRequestMethod(POST);
+ urlConnection.setDoOutput(true);
+
+ TurSNClientUtils.basicAuth(urlConnection, turSNServer.getCredentials());
+
+ OutputStream os = urlConnection.getOutputStream();
+ byte[] input = jsonResult.getBytes(UTF_8);
+ os.write(input, 0, input.length);
+ String result = "";
+ int responseCode = 0;
+ try {
+ responseCode = ((HttpURLConnection) urlConnection).getResponseCode();
+ result = getTurResponseBody(urlConnection, responseCode);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine(String.format("Viglet Turing Index Request URI: %s", urlString));
+ logger.fine(String.format("JSON: %s", jsonResult));
+ logger.fine(String.format("Viglet Turing indexer response code HTTP result is: %s", responseCode));
+ logger.fine(String.format("Viglet Turing indexer response HTTP result is: %s", result));
+ }
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+
+ private static String getTurResponseBody(URLConnection urlConnection, int result) throws IOException {
+ StringBuilder responseBody = new StringBuilder();
+ if (result == 200) {
+ BufferedReader br = null;
+ try {
+ br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
+ String strCurrentLine;
+ while ((strCurrentLine = br.readLine()) != null) {
+ responseBody.append(strCurrentLine);
+ }
+ } finally {
+ if (br != null) {
+ br.close();
+ }
+ }
+ } else {
+ BufferedReader br = null;
+ try {
+ br = new BufferedReader(new InputStreamReader(((HttpURLConnection) urlConnection).getErrorStream()));
+ String strCurrentLine;
+ while ((strCurrentLine = br.readLine()) != null) {
+ responseBody.append(strCurrentLine);
+ }
+ } finally {
+ if (br != null) {
+ br.close();
+ }
+ }
+ }
+ return responseBody.toString();
+ }
+
+ public static void deleteItemsByType(TurSNServer turSNServer, String typeName) {
+ final TurSNJobItems turSNJobItems = new TurSNJobItems();
+ final TurSNJobItem turSNJobItem = new TurSNJobItem();
+ turSNJobItem.setTurSNJobAction(TurSNJobAction.DELETE);
+ turSNJobItem.setLocale(turSNServer.getLocale());
+ Map attributes = new HashMap();
+ attributes.put(TYPE_ATTRIBUTE, typeName);
+ attributes.put(PROVIDER_ATTRIBUTE, turSNServer.getProviderName());
+ turSNJobItem.setAttributes(attributes);
+ turSNJobItems.add(turSNJobItem);
+ importItems(turSNJobItems, turSNServer, false);
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/package-info.java
new file mode 100644
index 00000000000..44d6f98cfce
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/job/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes necessary to create jobs with content indexing and desindexing to Viglet Turing AI.
+ *
+ * @since 0.3.4
+ */
+package com.viglet.turing.client.sn.job;
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/package-info.java
new file mode 100644
index 00000000000..86f00b07744
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes necessary to communicate with Viglet Turing AI.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+package com.viglet.turing.client.sn;
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/TurSNPagination.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/TurSNPagination.java
new file mode 100644
index 00000000000..19dd18c6a9c
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/TurSNPagination.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.pagination;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.viglet.turing.api.sn.bean.TurSNSiteSearchPaginationBean;
+
+/**
+ * Class to interact with current pagination.
+ *
+ * @since 0.3.4
+ */
+public class TurSNPagination {
+
+ List paginationList;
+
+ private static String NEXT = "next";
+ private static String PREVIOUS = "previous";
+ private static String LAST = "last";
+ private static String FIRST = "first";
+ private static String CURRENT = "current";
+
+ public TurSNPagination(List paginationList) {
+ super();
+ this.paginationList = paginationList;
+ }
+
+ public List getAllPages() {
+ List allPages = new ArrayList();
+ if (paginationList != null) {
+ for (TurSNSiteSearchPaginationBean turSNPaginationItem : paginationList) {
+ allPages.add(new TurSNPaginationItem(turSNPaginationItem));
+ }
+ }
+ return allPages;
+ }
+
+ public TurSNPaginationItem findByType(String type) {
+ if (paginationList != null) {
+ for (TurSNSiteSearchPaginationBean paginationItem : paginationList) {
+ if (paginationItem != null && paginationItem.getType() != null
+ && paginationItem.getType().toString().equals(type)) {
+ return new TurSNPaginationItem(paginationItem);
+ }
+ }
+ }
+ return null;
+ }
+
+ public TurSNPaginationItem getCurrentPage() {
+ return findByType(CURRENT);
+ }
+
+ public TurSNPaginationItem getNextPage() {
+ return findByType(NEXT);
+ }
+
+ public TurSNPaginationItem getPreviousPage() {
+ return findByType(PREVIOUS);
+ }
+
+ public TurSNPaginationItem getLastPage() {
+ return findByType(LAST) != null ? findByType(LAST) : findByType(CURRENT);
+
+ }
+
+ public TurSNPaginationItem getFirstPage() {
+ return findByType(FIRST) != null ? findByType(FIRST) : findByType(CURRENT);
+
+ }
+
+ public TurSNPaginationItem findByPageNumber(int pageNumber) {
+ for (TurSNSiteSearchPaginationBean paginationItem : paginationList) {
+ if (paginationItem.getPage() == pageNumber) {
+ return new TurSNPaginationItem(paginationItem);
+ }
+ }
+ return null;
+ }
+
+ public List getPageNumberList() {
+ List numberList = new ArrayList();
+ for (TurSNSiteSearchPaginationBean paginationItem : paginationList) {
+ numberList.add(paginationItem.getPage());
+ }
+ return numberList;
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/TurSNPaginationItem.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/TurSNPaginationItem.java
new file mode 100644
index 00000000000..f0712ccc98c
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/TurSNPaginationItem.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.pagination;
+
+
+import com.viglet.turing.api.sn.bean.TurSNSiteSearchPaginationBean;
+import com.viglet.turing.client.sn.TurSNItemWithAPI;
+
+/**
+ * Pagination of results of Turing AI Semantic Navigation response with friendly
+ * attributes.
+ *
+ * @since 0.3.4
+ */
+public class TurSNPaginationItem extends TurSNItemWithAPI {
+
+ private TurSNPaginationType type;
+ private String label;
+ private int pageNumber;
+
+ public TurSNPaginationItem() {
+ super();
+ }
+
+ public TurSNPaginationItem(TurSNSiteSearchPaginationBean turSNSiteSearchPaginationBean) {
+ super();
+ if (turSNSiteSearchPaginationBean != null) {
+ this.setType(turSNSiteSearchPaginationBean.getType());
+ this.setApiURL(turSNSiteSearchPaginationBean.getHref());
+ this.setLabel(turSNSiteSearchPaginationBean.getText());
+ this.setPageNumber(turSNSiteSearchPaginationBean.getPage());
+ }
+ }
+
+ public TurSNPaginationType getType() {
+ return type;
+ }
+
+ public void setType(TurSNPaginationType type) {
+ this.type = type;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public int getPageNumber() {
+ return pageNumber;
+ }
+
+ public void setPageNumber(int pageNumber) {
+ this.pageNumber = pageNumber;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/TurSNPaginationType.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/TurSNPaginationType.java
new file mode 100644
index 00000000000..b16e4708193
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/TurSNPaginationType.java
@@ -0,0 +1,42 @@
+package com.viglet.turing.client.sn.pagination;
+
+public enum TurSNPaginationType {
+
+ FIRST {
+ @Override
+ public String toString() {
+ return "FIRST";
+ }
+ },
+ LAST {
+ @Override
+ public String toString() {
+ return "LAST";
+ }
+ },
+ PREVIOUS {
+ @Override
+ public String toString() {
+ return "PREVIOUS";
+ }
+ },
+ NEXT {
+ @Override
+ public String toString() {
+ return "NEXT";
+ }
+ },
+ CURRENT {
+ @Override
+ public String toString() {
+ return "CURRENT";
+ }
+ },
+ PAGE {
+ @Override
+ public String toString() {
+ return "PAGE";
+ }
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/package-info.java
new file mode 100644
index 00000000000..fb8bb0446d1
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/pagination/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes necessary to return pagination of Turing AI response.
+ *
+ * @since 0.3.4
+ */
+package com.viglet.turing.client.sn.pagination;
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/response/QueryTurSNResponse.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/response/QueryTurSNResponse.java
new file mode 100644
index 00000000000..96e565bafd1
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/response/QueryTurSNResponse.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.response;
+
+import java.util.List;
+
+import com.viglet.turing.client.sn.TurSNDocumentList;
+import com.viglet.turing.client.sn.didyoumean.TurSNDidYouMean;
+import com.viglet.turing.client.sn.facet.TurSNFacetFieldList;
+import com.viglet.turing.client.sn.pagination.TurSNPagination;
+import com.viglet.turing.client.sn.spotlight.TurSNSpotlightDocument;
+
+/**
+ * Return results of Turing AI response.
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.4
+ */
+public class QueryTurSNResponse {
+
+ private TurSNDocumentList results;
+
+ private TurSNPagination pagination;
+
+ private TurSNDidYouMean didYouMean;
+
+ private TurSNFacetFieldList facetFields;
+
+ private List spotlightDocuments;
+
+ public TurSNDocumentList getResults() {
+ return results;
+ }
+
+ public TurSNPagination getPagination() {
+ return pagination;
+ }
+
+ public void setResults(TurSNDocumentList results) {
+ this.results = results;
+ }
+
+ public void setPagination(TurSNPagination pagination) {
+ this.pagination = pagination;
+ }
+
+ public TurSNFacetFieldList getFacetFields() {
+ return facetFields;
+ }
+
+ public void setFacetFields(TurSNFacetFieldList facetFields) {
+ this.facetFields = facetFields;
+ }
+
+ public TurSNDidYouMean getDidYouMean() {
+ return didYouMean;
+ }
+
+ public void setDidYouMean(TurSNDidYouMean didYouMean) {
+ this.didYouMean = didYouMean;
+ }
+
+ public List getSpotlightDocuments() {
+ return spotlightDocuments;
+ }
+
+ public void setSpotlightDocuments(List spotlightDocuments) {
+ this.spotlightDocuments = spotlightDocuments;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/response/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/response/package-info.java
new file mode 100644
index 00000000000..f581036ec4a
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/response/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes necessary to return results of Turing AI response.
+ *
+ * @since 0.3.4
+ */
+package com.viglet.turing.client.sn.response;
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/spotlight/TurSNSpotlightDocument.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/spotlight/TurSNSpotlightDocument.java
new file mode 100644
index 00000000000..1982256fe22
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/spotlight/TurSNSpotlightDocument.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.spotlight;
+
+import com.viglet.turing.api.sn.bean.TurSNSiteSpotlightDocumentBean;
+
+/**
+ * Spotlight Document.
+ *
+ * @since 0.3.5
+ */
+public class TurSNSpotlightDocument {
+
+ private String id;
+
+ private int position;
+
+ private String title;
+
+ private String type;
+
+ private String referenceId;
+
+ private String content;
+
+ private String link;
+
+ public TurSNSpotlightDocument(TurSNSiteSpotlightDocumentBean turSNSiteSpotlightDocumentBean) {
+ this.id = turSNSiteSpotlightDocumentBean.getId();
+ this.position = turSNSiteSpotlightDocumentBean.getPosition();
+ this.title = turSNSiteSpotlightDocumentBean.getTitle();
+ this.type = turSNSiteSpotlightDocumentBean.getType();
+ this.referenceId = turSNSiteSpotlightDocumentBean.getReferenceId();
+ this.content = turSNSiteSpotlightDocumentBean.getContent();
+ this.link = turSNSiteSpotlightDocumentBean.getLink();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public void setPosition(int position) {
+ this.position = position;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getReferenceId() {
+ return referenceId;
+ }
+
+ public void setReferenceId(String referenceId) {
+ this.referenceId = referenceId;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/spotlight/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/spotlight/package-info.java
new file mode 100644
index 00000000000..e87c0d94c7f
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/spotlight/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes with spotlight features to use this SDK.
+ *
+ * @since 0.3.5
+ */
+package com.viglet.turing.client.sn.spotlight;
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/utils/TurSNClientUtils.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/utils/TurSNClientUtils.java
new file mode 100644
index 00000000000..1f7fab0fb29
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/utils/TurSNClientUtils.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.client.sn.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.DatatypeConverter;
+
+import com.viglet.turing.client.sn.credentials.TurUsernamePasswordCredentials;
+
+
+/**
+ * Client Utils
+ *
+ * @author Alexandre Oliveira
+ *
+ * @since 0.3.6
+ *
+ */
+public class TurSNClientUtils {
+ private static final Logger logger = Logger.getLogger(TurSNClientUtils.class.getName());
+ public static void basicAuth(URLConnection urlConnection, TurUsernamePasswordCredentials credentials) {
+ if (credentials != null && credentials.getUsername() != null) {
+ String auth = String.format("%s:%s", credentials.getUsername(), credentials.getPassword());
+ try{
+ String encodedAuth = DatatypeConverter.printBase64Binary
+ (auth.getBytes("UTF-8"));
+ String authHeader = "Basic " + encodedAuth;
+ urlConnection.setRequestProperty("Authorization", authHeader);
+ } catch (UnsupportedEncodingException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+ }
+
+ public static Map> splitQuery(URL url) throws UnsupportedEncodingException {
+ final Map> query_pairs = new LinkedHashMap>();
+ final String[] pairs = url.getQuery().split("&");
+ for (String pair : pairs) {
+ final int idx = pair.indexOf("=");
+ final String key = idx > 0 ? URLDecoder.decode(pair.substring(0, idx), "UTF-8") : pair;
+ if (!query_pairs.containsKey(key)) {
+ query_pairs.put(key, new LinkedList());
+ }
+ final String value = idx > 0 && pair.length() > idx + 1 ? URLDecoder.decode(pair.substring(idx + 1), "UTF-8") : null;
+ query_pairs.get(key).add(value);
+ }
+ return query_pairs;
+ }
+
+ public static void addURLParameter(URL url, String name, String value) {
+ String parameter = String.format("%s=%s", name, value);
+ try {
+ URI uri = url.toURI();
+ url = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(),
+ uri.getQuery() == null ? parameter : uri.getQuery() + "&" + parameter, uri.getFragment()).toURL();
+ } catch (MalformedURLException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ } catch (URISyntaxException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/utils/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/utils/package-info.java
new file mode 100644
index 00000000000..f44b004be5d
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/sn/utils/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes of Turing Client Utils.
+ *
+ * @since 0.3.6
+ *
+ */
+package com.viglet.turing.client.sn.utils;
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ssl/TLSSocketConnectionFactory.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ssl/TLSSocketConnectionFactory.java
new file mode 100644
index 00000000000..c07c20f0161
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/ssl/TLSSocketConnectionFactory.java
@@ -0,0 +1,383 @@
+package com.viglet.turing.client.ssl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.security.Principal;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.util.Hashtable;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.net.ssl.HandshakeCompletedEvent;
+import javax.net.ssl.HandshakeCompletedListener;
+import javax.net.ssl.SSLPeerUnverifiedException;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSessionContext;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
+import javax.security.cert.X509Certificate;
+
+import org.bouncycastle.crypto.tls.Certificate;
+import org.bouncycastle.crypto.tls.CertificateRequest;
+import org.bouncycastle.crypto.tls.DefaultTlsClient;
+import org.bouncycastle.crypto.tls.ExtensionType;
+import org.bouncycastle.crypto.tls.TlsAuthentication;
+import org.bouncycastle.crypto.tls.TlsClientProtocol;
+import org.bouncycastle.crypto.tls.TlsCredentials;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+public class TLSSocketConnectionFactory extends SSLSocketFactory {
+
+ static {
+ if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null)
+ Security.addProvider(new BouncyCastleProvider());
+ }
+
+ public class TLSHandshakeListener implements HandshakeCompletedListener {
+ @Override
+ public void handshakeCompleted(HandshakeCompletedEvent event) {
+
+ }
+ }
+
+ private SecureRandom _secureRandom = new SecureRandom();
+
+ @Override
+ public Socket createSocket(Socket socket, final String host, int port, boolean arg3) throws IOException {
+ if (socket == null) {
+ socket = new Socket();
+ }
+ if (!socket.isConnected()) {
+ socket.connect(new InetSocketAddress(host, port));
+ }
+
+ final TlsClientProtocol tlsClientProtocol = new TlsClientProtocol(socket.getInputStream(),
+ socket.getOutputStream(), _secureRandom);
+ return _createSSLSocket(host, tlsClientProtocol);
+
+ }
+
+ @Override
+ public String[] getDefaultCipherSuites() {
+ return null;
+ }
+
+ @Override
+ public String[] getSupportedCipherSuites() {
+ return null;
+ }
+
+ @Override
+ public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
+ return null;
+ }
+
+ @Override
+ public Socket createSocket(InetAddress host, int port) throws IOException {
+ return null;
+ }
+
+ @Override
+ public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
+ throws IOException, UnknownHostException {
+ return null;
+ }
+
+ @Override
+ public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
+ throws IOException {
+ return null;
+ }
+
+ private SSLSocket _createSSLSocket(final String host, final TlsClientProtocol tlsClientProtocol) {
+ return new SSLSocket() {
+ private java.security.cert.Certificate[] peertCerts;
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return tlsClientProtocol.getInputStream();
+ }
+
+ @Override
+ public OutputStream getOutputStream() throws IOException {
+ return tlsClientProtocol.getOutputStream();
+ }
+
+ @Override
+ public synchronized void close() throws IOException {
+ tlsClientProtocol.close();
+ }
+
+ @Override
+ public void addHandshakeCompletedListener(HandshakeCompletedListener arg0) {
+
+ }
+
+ @Override
+ public boolean getEnableSessionCreation() {
+ return false;
+ }
+
+ @Override
+ public String[] getEnabledCipherSuites() {
+ return null;
+ }
+
+ @Override
+ public String[] getEnabledProtocols() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean getNeedClientAuth() {
+ return false;
+ }
+
+ @Override
+ public SSLSession getSession() {
+ return new SSLSession() {
+
+ @Override
+ public int getApplicationBufferSize() {
+ return 0;
+ }
+
+ @Override
+ public String getCipherSuite() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public long getCreationTime() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public byte[] getId() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public long getLastAccessedTime() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public java.security.cert.Certificate[] getLocalCertificates() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Principal getLocalPrincipal() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int getPacketBufferSize() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException {
+ return null;
+ }
+
+ @Override
+ public java.security.cert.Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException {
+ return peertCerts;
+ }
+
+ @Override
+ public String getPeerHost() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int getPeerPort() {
+ return 0;
+ }
+
+ @Override
+ public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
+ return null;
+
+ }
+
+ @Override
+ public String getProtocol() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public SSLSessionContext getSessionContext() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Object getValue(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String[] getValueNames() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void invalidate() {
+ throw new UnsupportedOperationException();
+
+ }
+
+ @Override
+ public boolean isValid() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void putValue(String arg0, Object arg1) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ @Override
+ public void removeValue(String arg0) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ };
+ }
+
+ @Override
+ public String[] getSupportedProtocols() {
+ return null;
+ }
+
+ @Override
+ public boolean getUseClientMode() {
+ return false;
+ }
+
+ @Override
+ public boolean getWantClientAuth() {
+
+ return false;
+ }
+
+ @Override
+ public void removeHandshakeCompletedListener(HandshakeCompletedListener arg0) {
+
+ }
+
+ @Override
+ public void setEnableSessionCreation(boolean arg0) {
+
+ }
+
+ @Override
+ public void setEnabledCipherSuites(String[] arg0) {
+
+ }
+
+ @Override
+ public void setEnabledProtocols(String[] arg0) {
+
+ }
+
+ @Override
+ public void setNeedClientAuth(boolean arg0) {
+
+ }
+
+ @Override
+ public void setUseClientMode(boolean arg0) {
+
+ }
+
+ @Override
+ public void setWantClientAuth(boolean arg0) {
+
+ }
+
+ @Override
+ public String[] getSupportedCipherSuites() {
+ return null;
+ }
+
+ @Override
+ public void startHandshake() throws IOException {
+ tlsClientProtocol.connect(new DefaultTlsClient() {
+ @Override
+ public Hashtable getClientExtensions() throws IOException {
+ @SuppressWarnings("unchecked")
+ Hashtable clientExtensions = super.getClientExtensions();
+ if (clientExtensions == null) {
+ clientExtensions = new Hashtable();
+ }
+
+ // Add host_name
+ byte[] host_name = host.getBytes();
+
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final DataOutputStream dos = new DataOutputStream(baos);
+ dos.writeShort(host_name.length + 3); // entry size
+ dos.writeByte(0); // name type = hostname
+ dos.writeShort(host_name.length);
+ dos.write(host_name);
+ dos.close();
+ clientExtensions.put(ExtensionType.server_name, baos.toByteArray());
+ return clientExtensions;
+ }
+
+ @Override
+ public TlsAuthentication getAuthentication() throws IOException {
+ return new TlsAuthentication() {
+
+ @Override
+ public void notifyServerCertificate(Certificate serverCertificate) throws IOException {
+
+ try {
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ List certs = new LinkedList();
+ for (org.bouncycastle.asn1.x509.Certificate c : serverCertificate
+ .getCertificateList()) {
+ certs.add(cf.generateCertificate(new ByteArrayInputStream(c.getEncoded())));
+ }
+ peertCerts = certs.toArray(new java.security.cert.Certificate[0]);
+ } catch (CertificateException e) {
+ System.out.println("Failed to cache server certs" + e);
+ throw new IOException(e);
+ }
+
+ }
+
+ @Override
+ public TlsCredentials getClientCredentials(CertificateRequest arg0) throws IOException {
+ return null;
+ }
+
+ };
+
+ }
+
+ });
+
+ }
+
+ };// Socket
+
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/utils/TurClientUtils.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/utils/TurClientUtils.java
new file mode 100644
index 00000000000..3484c69a83c
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/client/utils/TurClientUtils.java
@@ -0,0 +1,53 @@
+package com.viglet.turing.client.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class TurClientUtils {
+ private static final Logger logger = Logger.getLogger(TurClientUtils.class.getName());
+
+ public static URL getURL(String endpoint) throws MalformedURLException {
+ return (endpoint.toLowerCase().startsWith("https")) ?
+ new URL(null, endpoint, new sun.net.www.protocol.https.Handler()) :
+ new URL(null, endpoint);
+ }
+ public static String openConnectionAndRequest(URLConnection urlConnection) {
+ return executeQueryRequest(urlConnection);
+ }
+
+ private static String executeQueryRequest(URLConnection urlConnection) {
+ try {
+ int responseCode = ((HttpURLConnection) urlConnection).getResponseCode();
+ return getTurResponseBody(urlConnection, responseCode);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return null;
+ }
+
+ public static String getTurResponseBody(URLConnection urlConnection, int result) throws IOException {
+ StringBuilder responseBody = new StringBuilder();
+ if (result == 200) {
+ BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
+ String strCurrentLine;
+ while ((strCurrentLine = br.readLine()) != null) {
+ responseBody.append(strCurrentLine);
+ }
+ } else {
+ BufferedReader br = new BufferedReader(new InputStreamReader(((HttpURLConnection) urlConnection).getErrorStream()));
+ String strCurrentLine;
+ while ((strCurrentLine = br.readLine()) != null) {
+ responseBody.append(strCurrentLine);
+ }
+ }
+ ((HttpURLConnection) urlConnection).disconnect();
+ return responseBody.toString();
+ }
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/se/similar/TurSESimilarResult.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/se/similar/TurSESimilarResult.java
new file mode 100644
index 00000000000..395bb7d51b2
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/se/similar/TurSESimilarResult.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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 com.viglet.turing.se.similar;
+
+/**
+ * More Like This feature of Solr.
+ *
+ * @since 0.3.4
+ */
+public class TurSESimilarResult {
+
+ private String id;
+ private String title;
+ private String type;
+ private String url;
+
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getTitle() {
+ return title;
+ }
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public String getUrl() {
+ return url;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+}
diff --git a/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/se/similar/package-info.java b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/se/similar/package-info.java
new file mode 100644
index 00000000000..e13083b1f08
--- /dev/null
+++ b/turing-jdk6/turing-java-sdk-jdk6/src/main/java/com/viglet/turing/se/similar/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2016-2021 the original author or authors.
+ *
+ * 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 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.
+ */
+
+/**
+ * Provides the classes to More Like This feature of Solr.
+ *
+ * @since 0.3.4
+ */
+package com.viglet.turing.se.similar;
diff --git a/turing-jdk6/turing-wem-jdk6/.gitignore b/turing-jdk6/turing-wem-jdk6/.gitignore
new file mode 100644
index 00000000000..c51da5f3c3b
--- /dev/null
+++ b/turing-jdk6/turing-wem-jdk6/.gitignore
@@ -0,0 +1,25 @@
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+/bin/
+/target/
+/store/
+/.gradle/
+/logs/
+/build/
+/lib/*.jar
+/.settings/
+.project
+.idea
+.gradle
+zip
+docs
+/lib/
diff --git a/turing-jdk6/turing-wem-jdk6/command-line/16_2/turing-wem b/turing-jdk6/turing-wem-jdk6/command-line/16_2/turing-wem
new file mode 100644
index 00000000000..3512c08ef25
--- /dev/null
+++ b/turing-jdk6/turing-wem-jdk6/command-line/16_2/turing-wem
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+# turing-wem
+#
+# Shell script to run the content index tool for Turing AI.
+
+PRG="`command type $0 | cut -d' ' -f3-`" >/dev/null 2>&1
+J_HOME=`dirname $PRG`/../jre
+
+if [ "$OS" = "Windows_NT" ]
+ then SEP=";"
+else SEP=":"
+fi
+
+# +------------------------------------------------------------------------
+# | Setting process id stage determination token to 'all' to determine the
+# | stage at runtime.
+# +------------------------------------------------------------------------
+VGN_PROCESSID=all.utility
+
+BINDIR="`dirname $PRG`"
+
+. $BINDIR/setupcfgenv.sh
+
+CLASSDIR=$BINDIR/../lib
+
+# vgn jar files
+CP=$CLASSDIR
+CP=$CP$SEP$CLASSDIR/axis.jar
+CP=$CP$SEP$CLASSDIR/log4j.jar
+CP=$CP$SEP$CLASSDIR/vgn-shared-logging.jar
+CP=$CP$SEP$CLASSDIR/vgncommon.jar
+CP=$CP$SEP$CLASSDIR/vgnssl.jar
+CP=$CP$SEP$CLASSDIR/vgn-appsvcs-combined.jar
+CP=$CP$SEP$CLASSDIR/vgn-appsvcs-config.jar
+CP=$CP$SEP$CLASSDIR/vgnhpdapi-8.0.jar
+CP=$CP$SEP$CLASSDIR/commons-httpclient.jar
+CP=$CP$SEP$CLASSDIR/commons-logging.jar
+CP=$CP$SEP$CLASSDIR/commons-codec.jar
+CP=$CP$SEP$CLASSDIR/commons-dbcp.jar
+CP=$CP$SEP$CLASSDIR/commons-pool.jar
+CP=$CP$SEP$CLASSDIR/castor-0.9.3.9.jar
+CP=$CP$SEP$CLASSDIR/sdk/vgn-appsvcs-cda.jar
+CP=$CP$SEP$CLASSDIR/apache-solr-cell.jar
+CP=$CP$SEP$CLASSDIR/apache-solr-solrj.jar
+CP=$CP$SEP$CLASSDIR/solr-slf4j-api.jar
+CP=$CP$SEP$CLASSDIR/solr-slf4j-jdk14.jar
+CP=$CP$SEP$CLASSDIR/apache-httpclient.jar
+CP=$CP$SEP$CLASSDIR/apache-httpcore.jar
+CP=$CP$SEP$CLASSDIR/apache-httpmime.jar
+CP=$CP$SEP$CLASSDIR/jackson-core.jar
+CP=$CP$SEP$CLASSDIR/json.jar
+CP=$CP$SEP$CLASSDIR/jsafe.jar
+CP=$CP$SEP$CLASSDIR/vgn-community-core.jar
+CP=$CP$SEP$CLASSDIR/xbean.jar
+CP=$CP$SEP$CLASSDIR/spring-core-4.3.17.RELEASE.jar
+CP=$CP$SEP$CLASSDIR/spring-expression-4.3.17.RELEASE.jar
+
+CP=$CP$SEP$CLASSDIR/turing-wem-all.jar
+
+# JDBC drivers
+JDBCDIR=$BINDIR/../jdbc
+CP=$CP$SEP$JDBCDIR/ojdbc7.jar
+CP=$CP$SEP$JDBCDIR/vgnjdbc.jar
+CP=$CP$SEP$JDBCDIR/db2jcc4.jar
+CP=$CP$SEP$JDBCDIR/postgresql.jar
+CP=$CP$SEP.
+CP=$CP$SEP$BINDIR/.
+CP=$CP$SEP$CLASSPATH
+
+
+exec $JAVAPROG $JAVAARGS -cp $CP -Xmx512m com.viglet.turing.wem.TurWEMCommander "$@"
+
+
+
diff --git a/turing-jdk6/turing-wem-jdk6/conf/CTD-Turing-Mappings.xml b/turing-jdk6/turing-wem-jdk6/conf/CTD-Turing-Mappings.xml
new file mode 100644
index 00000000000..bf755e021d5
--- /dev/null
+++ b/turing-jdk6/turing-wem-jdk6/conf/CTD-Turing-Mappings.xml
@@ -0,0 +1,59 @@
+
+
+
+
+ type
+
+
+ publicationDate
+
+
+ modificationDate
+
+
+ site
+
+
+ text
+
+
+ description
+
+
+ categories
+
+
+ url
+
+
+
+
+
+ title
+
+
+ description
+
+
+ text
+
+
+ text
+
+
+
+
+
+
+ name
+
+
+ terms
+
+
+ content
+
+
+
+
+
\ No newline at end of file
diff --git a/turing-jdk6/turing-wem-jdk6/conf/Turing_Generic_Resource.properties b/turing-jdk6/turing-wem-jdk6/conf/Turing_Generic_Resource.properties
new file mode 100644
index 00000000000..16ea16a2a1d
--- /dev/null
+++ b/turing-jdk6/turing-wem-jdk6/conf/Turing_Generic_Resource.properties
@@ -0,0 +1,21 @@
+turing.url=http://localhost:2700
+turing.mappingsxml=/appl/viglet/turing/wem/conf/CTD-Turing-Mappings.xml
+turing.login=admin
+turing.password=admin
+turing.provider.name="WEM"
+
+dps.config.association.priority=SampleSite
+dps.config.filesource.path=/opentext/otwork/WEM/inst-vgninst/file_source
+
+dps.site.default.urlprefix=http://mywemsite.example.com
+dps.site.default.contextname=sites
+dps.site.default.sn.site=Sample
+dps.site.default.sn.locale=en_US
+dps.site.default.en.sn.site=SampleEN
+
+dps.site.Intranet.urlprefix=http://intranet.example.com
+dps.site.Intranet.contextname=sites
+dps.site.Intranet.sn.site=Intra
+dps.site.Intranet.sn.locale=en_US
+dps.site.Intranet.it_IT.sn.locale=it
+dps.site.Intranet.es.sn.site=IntraES
diff --git a/turing-jdk6/turing-wem-jdk6/imports/turing-ctd.zip b/turing-jdk6/turing-wem-jdk6/imports/turing-ctd.zip
new file mode 100644
index 00000000000..09893f26a98
Binary files /dev/null and b/turing-jdk6/turing-wem-jdk6/imports/turing-ctd.zip differ
diff --git a/turing-jdk6/turing-wem-jdk6/pom.xml b/turing-jdk6/turing-wem-jdk6/pom.xml
new file mode 100644
index 00000000000..a3cf7942ebf
--- /dev/null
+++ b/turing-jdk6/turing-wem-jdk6/pom.xml
@@ -0,0 +1,126 @@
+
+
+ 4.0.0
+
+ com.viglet.turing
+ turing-jdk6
+ 0.3.10.1
+ ../pom.xml
+
+ com.viglet.turing.connector
+ turing-wem
+ jar
+ Turing WEM Connector 1.6
+ Turing WEM Connector 1.6
+
+ UTF-8
+ UTF-8
+ 1.6
+ 1.6
+ 20140107
+ 1.2.7
+
+
+
+ com.beust
+ jcommander
+ 1.47
+
+
+ org.json
+ json
+ ${jsonVersion}
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.6.0
+
+
+ log4j
+ log4j
+ ${log4jVersion}
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+ 1.59
+
+
+ castor
+ castor
+ 0.8
+ system
+ ${basedir}\lib\castor-0.8.jar
+
+
+ vgn-appsvcs-cma
+ vgn-appsvcs-cma
+ 10
+ system
+ ${basedir}\lib\vgn-appsvcs-cma.jar
+
+
+ vgn-shared-logging
+ vgn-shared-logging
+ 10
+ system
+ ${basedir}\lib\vgn-shared-logging.jar
+
+
+ com.viglet.turing
+ turing-java-sdk-jdk6
+ 0.3.10.1
+
+
+
+ turing-wem
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.13.0
+
+ 1.6
+ 1.6
+
+
+
+
+ maven-shade-plugin
+ 3.6.0
+
+
+
+ shade
+
+ package
+
+ turing-wem-all
+ true
+ all
+ true
+
+
+ *:*
+
+ module-info.class
+ META-INF/*.SF
+ META-INF/*.DSA
+ META-INF/*.RSA
+ META-INF/NOTICE
+ META-INF/LICENSE
+ META-INF/MANIFEST.MF
+
+
+
+
+
+
+
+
+
+
diff --git a/turing-jdk6/turing-wem-jdk6/sql/oracle/tur_spotlight.sql b/turing-jdk6/turing-wem-jdk6/sql/oracle/tur_spotlight.sql
new file mode 100644
index 00000000000..0a888a57e99
--- /dev/null
+++ b/turing-jdk6/turing-wem-jdk6/sql/oracle/tur_spotlight.sql
@@ -0,0 +1,7 @@
+DROP TABLE WEMSYS.TUR_SPOTLIGHT;
+CREATE TABLE WEMSYS.TUR_SPOTLIGHT (
+ ID VARCHAR2(40),
+ NAME VARCHAR2(50) NOT NULL,
+ TERMS VARCHAR2(100) NOT NULL,
+ PRIMARY KEY(ID)
+);
\ No newline at end of file
diff --git a/turing-jdk6/turing-wem-jdk6/sql/oracle/tur_spotlight_content.sql b/turing-jdk6/turing-wem-jdk6/sql/oracle/tur_spotlight_content.sql
new file mode 100644
index 00000000000..7491c010ecb
--- /dev/null
+++ b/turing-jdk6/turing-wem-jdk6/sql/oracle/tur_spotlight_content.sql
@@ -0,0 +1,11 @@
+DROP TABLE WEMSYS.TUR_SPOTLIGHT_CONTENT;
+CREATE TABLE WEMSYS.TUR_SPOTLIGHT_CONTENT (
+ ID VARCHAR2(40),
+ TITLE VARCHAR2(100),
+ CONTENT VARCHAR2(2000),
+ LINK VARCHAR2(255),
+ SPOTLIGHT_ID VARCHAR2(40) NOT NULL,
+ SEQUENCE_NUM INTEGER,
+ POSITION INTEGER,
+ PRIMARY KEY(ID)
+);
\ No newline at end of file
diff --git a/turing-jdk6/turing-wem-jdk6/src/main/java/com/viglet/turing/wem/TurWEMCommander.java b/turing-jdk6/turing-wem-jdk6/src/main/java/com/viglet/turing/wem/TurWEMCommander.java
new file mode 100644
index 00000000000..80c818d9b69
--- /dev/null
+++ b/turing-jdk6/turing-wem-jdk6/src/main/java/com/viglet/turing/wem/TurWEMCommander.java
@@ -0,0 +1,378 @@
+/*
+ * Copyright (C) 2016-2022 the original author or authors.
+ *
+ * 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 com.viglet.turing.wem;
+
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.ParameterException;
+import com.viglet.turing.wem.broker.indexer.TurWEMIndex;
+import com.viglet.turing.wem.broker.indexer.TurWEMIndexer;
+import com.viglet.turing.wem.config.GenericResourceHandlerConfiguration;
+import com.viglet.turing.wem.config.IHandlerConfiguration;
+import com.viglet.turing.wem.index.IValidToIndex;
+import com.viglet.turing.wem.mappers.MappingDefinitions;
+import com.viglet.turing.wem.mappers.MappingDefinitionsProcess;
+import com.viglet.turing.wem.util.TuringUtils;
+import com.vignette.as.apps.contentIndex.ContentIndexException;
+import com.vignette.as.client.common.*;
+import com.vignette.as.client.common.ref.ContentTypeRef;
+import com.vignette.as.client.common.ref.ManagedObjectVCMRef;
+import com.vignette.as.client.common.ref.ObjectTypeRef;
+import com.vignette.as.client.exception.ApplicationException;
+import com.vignette.as.client.exception.ValidationException;
+import com.vignette.as.client.javabean.*;
+import com.vignette.as.config.ConfigUtil;
+import com.vignette.config.client.common.ConfigException;
+import com.vignette.config.util.ConfigLog;
+import com.vignette.logging.LoggingManager;
+import com.vignette.logging.context.ContextLogger;
+import com.vignette.util.VgnException;
+import com.vignette.util.VgnIllegalArgumentException;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+
+import java.net.MalformedURLException;
+import java.util.*;
+
+public class TurWEMCommander {
+ private static JCommander jCommander = new JCommander();
+ private static ContextLogger logger = LoggingManager.getContextLogger(TurWEMCommander.class.getName());
+
+ private static final String WORKING_DIR = "com.vignette.workingDir";
+ private static final String STFL = "STFL";
+ private static final String RCRD = "RCRD";
+ private IHandlerConfiguration turingConfig = null;
+ @Parameter(names = { "--host",
+ "-h" }, description = "The host on which Content Management server is installed.", required = true)
+ private String hostAndPort = null;
+
+ @Parameter(names = { "--username",
+ "-u" }, description = "A username to log in to the Content Management Server.", required = true)
+ private String username = null;
+
+ @Parameter(names = { "--password", "-p" }, description = "The password for the user name.", required = true)
+ private String password = null;
+
+ @Parameter(names = { "--working-dir",
+ "-w" }, description = "The working directory where the vgncfg.properties file is located.", required = true)
+ private String workingDir = null;
+
+ @Parameter(names = { "--all", "-a" }, description = "Index all instances of all content types and object types.")
+ private boolean allObjectTypes = false;
+
+ @Parameter(names = { "--content-type",
+ "-c" }, description = "The XML name of the content type or object type whose instances are to be indexed.")
+ private String contentType = null;
+
+ @Parameter(names = { "--guids",
+ "-g" }, description = "The path to a file containing the GUID(s) of content instances or static files to be indexed.")
+ private String guidFilePath = null;
+
+ @Parameter(names = { "--siteName", "-s" }, description = "WEM site name.", required = true)
+ private String siteName = "Sample";
+
+ @Parameter(names = { "--page-size",
+ "-z" }, description = "The page size. After processing a page the processed count is written to an offset file."
+ + " This helps the indexer to resume from that page even after failure. ")
+ private int pageSize = 500;
+
+ @Parameter(names = "--debug", description = "Change the log level to debug", help = true)
+ private boolean debug = false;
+
+ @Parameter(names = "--help", description = "Print usage instructions", help = true)
+ private boolean help = false;
+
+ public static void main(String... argv) {
+ TurWEMCommander main = new TurWEMCommander();
+
+ jCommander.addObject(main);
+
+ try {
+ jCommander.parse(argv);
+ if (main.help) {
+ jCommander.usage();
+ return;
+ }
+ JCommander.getConsole().println("Viglet Turing WEM Indexer Tool.");
+
+ main.run();
+ } catch (ParameterException e) {
+ logger.info("Error: " + e.getLocalizedMessage());
+ jCommander.usage();
+ }
+
+ }
+
+ private void run() {
+ String logLevel = debug ? "DEBUG" : "INFO";
+
+ try {
+ ConfigLog.initializeLogging("turing-wem.log", logLevel);
+ if (debug)
+ LogManager.getLogger("com.viglet").setLevel(Level.DEBUG);
+
+ System.setProperty(WORKING_DIR, workingDir);
+ ConfigUtil.setHasDataSource(false);
+ ConfigUtil.setContainerType(ConfigUtil.CONTAINER_TYPE_SERVLET);
+
+ turingConfig = new GenericResourceHandlerConfiguration();
+ if (allObjectTypes) {
+ runAllObjectTypes();
+ } else if (contentType != null) {
+ runByContentType();
+ } else if (guidFilePath != null) {
+ runByGuidList();
+ }
+
+ } catch (ConfigException exception) {
+ if (logger.isDebugEnabled())
+ logger.debug("Error into ConfigSpace configuration", exception);
+ } catch (VgnException vgnException) {
+ JCommander.getConsole().println("Logging does not started");
+ } catch (Exception e) {
+ logger.error("Viglet Turing Index Error: ", e);
+
+ }
+ }
+
+ private void runByContentType() throws ApplicationException, ContentIndexException, ConfigException,
+ MalformedURLException, ValidationException {
+ ObjectType objectType = ObjectType.findByName(contentType);
+ if (objectType != null)
+ this.indexByContentType(siteName, objectType);
+ }
+
+ private void runByGuidList()
+ throws ValidationException, ApplicationException, ContentIndexException, ConfigException {
+ ArrayList contentInstances = new ArrayList();
+ FileReader fr = null;
+ BufferedReader br = null;
+ try {
+ fr = new FileReader(guidFilePath);
+ br = new BufferedReader(fr);
+ String sCurrentLine;
+
+ while ((sCurrentLine = br.readLine()) != null) {
+ if (sCurrentLine.endsWith(STFL) || sCurrentLine.endsWith(RCRD))
+ contentInstances.add(sCurrentLine);
+
+ if (contentInstances.size() != pageSize)
+ continue;
+ if (!contentInstances.isEmpty()) {
+ this.indexGUIDList(contentInstances);
+ contentInstances = new ArrayList();
+ }
+ }
+ if (!contentInstances.isEmpty())
+ this.indexGUIDList(contentInstances);
+
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ } finally {
+ try {
+ if (br != null) {
+ br.close();
+ }
+
+ if(fr != null) {
+ fr.close();
+ }
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ }
+
+ private void runAllObjectTypes() throws ApplicationException, ContentIndexException, ConfigException,
+ MalformedURLException, ValidationException {
+ IPagingList contentTypeIPagingList = ContentType.findAll();
+ @SuppressWarnings("unchecked")
+ List