<commit_before>package controllers;

import static models.QAccess.access;
import static models.QDocSubject.docSubject;
import static models.QDocument.document;
import static models.QDocumentSearch.documentSearch;
import static models.QMdType.mdType;
import static models.QSubject.subject;
import static models.QSubjectLabel.subjectLabel;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;

import javax.inject.Inject;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.ProcessingInstruction;

import com.querydsl.core.Tuple;
import com.querydsl.core.types.dsl.DateTimePath;
import com.querydsl.sql.SQLExpressions;
import com.querydsl.sql.SQLQuery;

import models.DocSubject;
import models.Search;
import play.Routes;
import play.data.Form;
import play.i18n.Lang;
import play.i18n.Messages;
import play.libs.F.Promise;
import play.libs.ws.WSClient;
import play.libs.ws.WSRequest;
import play.mvc.Controller;
import play.mvc.Http;
import play.mvc.Result;
import util.QueryDSL;
import views.html.*;

public class Application extends Controller {
	@Inject QueryDSL q;
	@Inject WSClient ws;
	
	public Result index() {
		String portalAccess = play.Play.application().configuration().getString("portal.access");
		
		SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
		
		return q.withTransaction(tx -> {
			Boolean intern = false;
			if("intern".equals(portalAccess)) {
				intern = true;
			}
			
			SQLQuery<Tuple> queryDocuments = tx.select(document.title, document.uuid, document.dateDataset, 
					document.creator, document.description, document.thumbnail, document.downloadable, 
					document.spatialSchema, document.published, document.typeService, document.viewerUrl, 
					document.wmsOnly, mdType.url, mdType.name)
					.from(document)
					.join(mdType).on(document.mdTypeId.eq(mdType.id))
					.where(document.dateDataset.isNotNull())
					.where(document.description.isNotNull())
					.where(document.archived.isNull().or(document.archived.isFalse()));
			
			if(!intern) {
				Integer accessId = tx.select(access.id)
					.from(access)
					.where(access.name.eq("extern"))
					.fetchOne();<commit_msg>Don't display services on index page<commit_after>package controllers;

import static models.QAccess.access;
import static models.QDocSubject.docSubject;
import static models.QDocument.document;
import static models.QDocumentSearch.documentSearch;
import static models.QMdType.mdType;
import static models.QSubject.subject;
import static models.QSubjectLabel.subjectLabel;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;

import javax.inject.Inject;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.ProcessingInstruction;

import com.querydsl.core.Tuple;
import com.querydsl.core.types.dsl.DateTimePath;
import com.querydsl.sql.SQLExpressions;
import com.querydsl.sql.SQLQuery;

import models.DocSubject;
import models.Search;
import play.Routes;
import play.data.Form;
import play.i18n.Lang;
import play.i18n.Messages;
import play.libs.F.Promise;
import play.libs.ws.WSClient;
import play.libs.ws.WSRequest;
import play.mvc.Controller;
import play.mvc.Http;
import play.mvc.Result;
import util.QueryDSL;
import views.html.*;

public class Application extends Controller {
	@Inject QueryDSL q;
	@Inject WSClient ws;
	
	public Result index() {
		String portalAccess = play.Play.application().configuration().getString("portal.access");
		
		SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
		
		return q.withTransaction(tx -> {
			Boolean intern = false;
			if("intern".equals(portalAccess)) {
				intern = true;
			}
			
			SQLQuery<Tuple> queryDocuments = tx.select(document.title, document.uuid, document.dateDataset, 
					document.creator, document.description, document.thumbnail, document.downloadable, 
					document.spatialSchema, document.published, document.typeService, document.viewerUrl, 
					document.wmsOnly, mdType.url, mdType.name)
					.from(document)
					.join(mdType).on(document.mdTypeId.eq(mdType.id))
					.where(mdType.name.ne("service"))
					.where(document.dateDataset.isNotNull())
					.where(document.description.isNotNull())
					.where(document.archived.isNull().or(document.archived.isFalse()));
			
			if(!intern) {
				Integer accessId = tx.select(access.id)
					.from(access)
					.where(access.name.eq("extern"))
					.fetchOne();
{'fraction_non_alphanumeric': 0.11508072827207146, 'fraction_numerical': 0.0027481964960494676, 'mean_word_length': 5.135932560590095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 22}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '249619', 'n_tokens_mistral': 1972, 'n_tokens_neox': 1804, 'n_words': 341}