# HG changeset patch # User Robert Casties # Date 1508496255 -7200 # Node ID 2522985f44af601a0fb3af90eb9660f2280e1032 # Parent d305a1b3e4c9c6c422e553f61c057af8142a7217 add "query builder" button to entityDetails form. diff -r d305a1b3e4c9 -r 2522985f44af src/main/java/de/mpiwg/itgroup/ismi/entry/beans/ApplicationBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/ApplicationBean.java Fri Oct 20 12:42:28 2017 +0200 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/ApplicationBean.java Fri Oct 20 12:44:15 2017 +0200 @@ -1,6 +1,9 @@ package de.mpiwg.itgroup.ismi.entry.beans; import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -9,11 +12,11 @@ import javax.faces.model.SelectItem; import javax.servlet.http.HttpServletRequest; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.mpi.openmind.cache.WrapperService; import org.mpi.openmind.configuration.ConfigurationService; -import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; import org.mpi.openmind.repository.services.ServiceRegistry; import org.mpi.openmind.search.SearchService; @@ -106,6 +109,29 @@ return sb.toString(); } + /** + * Returns a URL to the configured QueryBrowser webapp with the query set to the given id. + * + * @param id + * @return + */ + public String generateQueryBrowserUrlForId(Long id) { + String baseUrl = this.getConfService().getQueryBrowserUrl(); + // generate id_is query for id + String query = String.format("[[\"id_is\",{\"value\":%d}]]", id); + try { + // encode URL and base64 + String encquery = URLEncoder.encode(query, StandardCharsets.UTF_8.toString()); + String b64query = Base64.encodeBase64String(encquery.getBytes()); + String url = baseUrl + "#" + b64query; + return url; + } catch (UnsupportedEncodingException e) { + // this shouldn't happen + logger.error(e); + } + return null; + } + public static String CURRENT_WITNESS = "CurrentWitness"; public static String CURRENT_CODEX = "CurrentCodex"; public static String CURRENT_TEXT = "CurrentText"; diff -r d305a1b3e4c9 -r 2522985f44af src/main/resources/openmind.properties.template --- a/src/main/resources/openmind.properties.template Fri Oct 20 12:42:28 2017 +0200 +++ b/src/main/resources/openmind.properties.template Fri Oct 20 12:44:15 2017 +0200 @@ -1,4 +1,5 @@ scheduling-path=/tmp/ #scheduling-path=/home/jurzua/ismi/automatic-backup scheduling-enable=false -debug-modus=false \ No newline at end of file +debug-modus=false +query-browser-url=https://ismi.mpiwg-berlin.mpg.de/static-ismi/ng2-query-ismi/ diff -r d305a1b3e4c9 -r 2522985f44af src/main/webapp/browse/entityDetails.xhtml --- a/src/main/webapp/browse/entityDetails.xhtml Fri Oct 20 12:42:28 2017 +0200 +++ b/src/main/webapp/browse/entityDetails.xhtml Fri Oct 20 12:44:15 2017 +0200 @@ -50,17 +50,16 @@ rendered="#{Session.canEdit}" action="#{Session.entDetailsForm.actionEdit}" style="margin-right: 20px;" /> - +