changeset 164:d5ae699a4152 public_by_author

Merge from HEAD 1611da70e43e5ad66084ce17dba0402c3a310c71
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Tue, 22 May 2018 18:49:10 +0200
parents 92c4c9f7312a (diff) 1611da70e43e (current diff)
children 85fdcca37a0d
files
diffstat 8 files changed, 435 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/SessionBean.java	Thu May 17 14:42:57 2018 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/SessionBean.java	Tue May 22 18:49:10 2018 +0200
@@ -27,6 +27,7 @@
 import de.mpiwg.itgroup.ismi.event.beans.TransferEvent;
 import de.mpiwg.itgroup.ismi.merge.GeneralMerge;
 import de.mpiwg.itgroup.ismi.merge.ImportMerge;
+import de.mpiwg.itgroup.ismi.merge.PublicByAuthorBean;
 import de.mpiwg.itgroup.ismi.merge.ReferenceMerge;
 import de.mpiwg.itgroup.ismi.publicView.DynamicPageEditor;
 import de.mpiwg.itgroup.ismi.publicView.PublicCodexBean;
@@ -47,6 +48,7 @@
 	private CopyEvent copyEventForm = new CopyEvent();
 	private TransferEvent transferEventForm = new TransferEvent();
 	private transient AdvancedSearchBean advancedSearch = new AdvancedSearchBean();
+	private transient PublicByAuthorBean publicByAuthor = new PublicByAuthorBean();
 	
 	private EntityDetailsBean entDetailsForm = new EntityDetailsBean();
 	
@@ -137,6 +139,7 @@
 	private String selectedTab = WITNESS_TAB;
 	private String selectedEventTab = WITNESS_STUDY_EVENT_TAB;
 	private String selectedAdvancedSearchTab = "01";
+	private String selectedPublicByAuthorTab = "01";
 	
 
 	private Long editFormCurrentEntId;
@@ -655,6 +658,11 @@
 		this.redirect(null, url);
 	}
 	
+	public void listenerPublicByAuthorTabChange(ItemChangeEvent event) {
+		String url = "?formIndex=" + this.selectedPublicByAuthorTab;
+		this.redirect(null, url);
+	}
+	
 	protected void redirect(String redirectPath, String parameters){
 		FacesContext fc = FacesContext.getCurrentInstance();
 		ExternalContext ec = fc.getExternalContext();
@@ -1099,6 +1107,34 @@
 	public void setPublicCodexBean(PublicCodexBean publicCodexBean) {
 		this.publicCodexBean = publicCodexBean;
 	}
+
+	/**
+	 * @return the publicByAuthor
+	 */
+	public PublicByAuthorBean getPublicByAuthor() {
+		return publicByAuthor;
+	}
+
+	/**
+	 * @param publicByAuthor the publicByAuthor to set
+	 */
+	public void setPublicByAuthor(PublicByAuthorBean publicByAuthor) {
+		this.publicByAuthor = publicByAuthor;
+	}
+
+	/**
+	 * @return the selectedPublicByAuthorTab
+	 */
+	public String getSelectedPublicByAuthorTab() {
+		return selectedPublicByAuthorTab;
+	}
+
+	/**
+	 * @param selectedPublicByAuthorTab the selectedPublicByAuthorTab to set
+	 */
+	public void setSelectedPublicByAuthorTab(String selectedPublicByAuthorTab) {
+		this.selectedPublicByAuthorTab = selectedPublicByAuthorTab;
+	}
 	
 	
 	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/itgroup/ismi/merge/PublicByAuthorBean.java	Tue May 22 18:49:10 2018 +0200
@@ -0,0 +1,173 @@
+package de.mpiwg.itgroup.ismi.merge;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+
+import org.apache.log4j.Logger;
+import org.mpi.openmind.search.utils.ResultEntry;
+import org.mpi.openmind.search.utils.SAttributeMultipleName;
+import org.mpi.openmind.search.utils.SAttributeUniqueName;
+import org.mpi.openmind.search.utils.SEntity;
+import org.mpi.openmind.search.utils.SRelation;
+import org.mpi.openmind.search.utils.SRelationMultipleName;
+import org.mpi.openmind.search.utils.SRelationUniqueName;
+
+import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean;
+
+public class PublicByAuthorBean extends AbstractISMIBean implements Serializable{
+	
+	private static Logger logger = Logger.getLogger(PublicByAuthorBean.class);
+	
+	private static final long serialVersionUID = 1L;
+	
+	private String currentTemplate;
+	private static List<SelectItem> templateList;
+	
+	private String findAuthorName;
+
+	private boolean searched;
+
+	private long timeExecution;
+	
+	static{
+		templateList = new ArrayList<SelectItem>();
+		//templateList.add(new SelectItem("sample01"));
+		templateList.add(new SelectItem("witness4Title", "Witnesses for a title"));
+		//templateList.add(new SelectItem("sample03"));
+		//templateList.add(new SelectItem("sample04"));
+		//templateList.add(new SelectItem("sample05"));
+		templateList.add(new SelectItem("titles4Person", "Titles for a person"));
+		templateList.add(new SelectItem("codexOwnership", "Codex ownership"));
+		//templateList.add(new SelectItem("sample07"));
+		//templateList.add(new SelectItem("sample08"));
+		//templateList.add(new SelectItem("sample09"));
+	}
+	
+	public PublicByAuthorBean(){
+		//logger.info("AdvancedSearchBean");
+		this.reset();
+	}
+	
+	public void reset(){
+		//logger.info("AdvancedSearchBean.reset()");
+		currentTemplate = "witness4Title";
+	}
+	
+	public void listenerChange(ValueChangeEvent event){
+		/*
+		logger.info(event.getOldValue());
+		logger.info(event.getNewValue());
+		*/
+	}
+	
+	public void listenerFindAuthorSearch(ActionEvent event){
+		try {
+			long start = System.currentTimeMillis();
+			this.search();
+			long end = System.currentTimeMillis();
+			this.searched = true;
+			this.timeExecution = end - start;
+			logger.info(toString() + " time execution=" + (timeExecution));
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			printInternalError(e);
+		}
+
+	}
+	
+
+	
+	public String actionSearch(){
+		this.search();
+		return null;
+	}
+	
+	public void search(){
+		long start = System.currentTimeMillis();
+		
+		List<ResultEntry> rs = sample06();
+		
+		//printRs(rs);
+
+		long end = System.currentTimeMillis();
+		logger.info("execution time [ms] = " + (end - start));
+		logger.info("Search resultSet size= " + rs.size());
+	}
+
+	
+	/**
+	 * 6) Bring up people associated with a particular title (not just one huge list of people, but be able to distinguish author, student, teacher)
+	 * @return
+	 */
+	private List<ResultEntry> sample06(){
+		
+		List<SEntity> entFilters = new ArrayList<SEntity>();
+		List<SRelation> relFilters = new ArrayList<SRelation>();
+		
+		//The user can select between: 
+		//"Author", "Annotator", "Copyist", "Corrector", "Dedicatee", "Illuminator", "Illustrator", "Owner", "Patron", "inspector"
+		SEntity role = new SEntity(0, "ROLE");
+		role.addAtt(new SAttributeUniqueName("name", "Annotator"));
+		entFilters.add(role);
+		
+		//alias, "is_prime_alias_name_of", "PERSON"
+		//alias, "is_alias_name_of", "PERSON"
+		SEntity person = new SEntity(1, "PERSON");
+		person.addAtt(new SAttributeMultipleName("a", "name_translit", "name"));
+		entFilters.add(person);
+		
+		/*
+		SEntity alias = new SEntity(1, "ALIAS");
+		alias.addAtt(new SAttributeUniqueName("alias", "abu"));
+		entFilters.add(alias);
+		*/
+		
+		SEntity title = new SEntity(2, "TEXT");
+		title.addAtt(new SAttributeMultipleName("abu", "full_title_translit", "full_title"));
+		entFilters.add(title);
+		
+		
+		SRelationUniqueName has_role = new SRelationUniqueName(person, role, "has_role");
+		SRelationMultipleName title_to_person = new SRelationMultipleName(title, person, "had_patron", "was_dedicated_to", "was_created_by");
+		relFilters.add(title_to_person);
+		relFilters.add(has_role);
+		
+		List<ResultEntry> rs = getAppBean().getSS().search(entFilters, relFilters);
+		
+		return rs;
+		
+	}
+	
+
+	public String getCurrentTemplate() {
+		return currentTemplate;
+	}
+
+	public void setCurrentTemplate(String currentTemplate) {
+		this.currentTemplate = currentTemplate;
+	}
+
+	public List<SelectItem> getTemplateList() {
+		return templateList;
+	}
+
+	/**
+	 * @return the findAuthorName
+	 */
+	public String getFindAuthorName() {
+		return findAuthorName;
+	}
+
+	/**
+	 * @param findAuthorName the findAuthorName to set
+	 */
+	public void setFindAuthorName(String findAuthorName) {
+		this.findAuthorName = findAuthorName;
+	}
+
+}
--- a/src/main/java/de/mpiwg/itgroup/ismi/search/beans/AdvancedSearchBean.java	Thu May 17 14:42:57 2018 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/search/beans/AdvancedSearchBean.java	Tue May 22 18:49:10 2018 +0200
@@ -3,16 +3,12 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
 
 import javax.faces.event.ValueChangeEvent;
 import javax.faces.model.SelectItem;
 
 import org.apache.log4j.Logger;
-import org.mpi.openmind.repository.bo.Attribute;
 import org.mpi.openmind.search.utils.ResultEntry;
-import org.mpi.openmind.search.utils.SAttribute;
 import org.mpi.openmind.search.utils.SAttributeMultipleName;
 import org.mpi.openmind.search.utils.SAttributeMultipleValue;
 import org.mpi.openmind.search.utils.SAttributeUniqueName;
@@ -22,8 +18,6 @@
 import org.mpi.openmind.search.utils.SRelationUniqueName;
 
 import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean;
-import de.mpiwg.itgroup.ismi.entry.beans.SessionBean;
-import de.mpiwg.itgroup.ismi.util.guiComponents.Calendar;
 
 public class AdvancedSearchBean extends AbstractISMIBean implements Serializable{
 	
--- a/src/main/java/de/mpiwg/itgroup/ismi/search/beans/Titles4PersonQuery.java	Thu May 17 14:42:57 2018 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/search/beans/Titles4PersonQuery.java	Tue May 22 18:49:10 2018 +0200
@@ -2,16 +2,12 @@
 
 import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javax.faces.model.SelectItem;
 
 import org.apache.commons.lang.StringUtils;
 import org.mpi.openmind.repository.bo.Entity;
-import org.mpi.openmind.repository.bo.Relation;
-import org.mpi.openmind.repository.utils.NormalizerUtils;
 import org.mpi.openmind.repository.utils.OldNormalizerUtils;
 import org.mpi.openmind.search.utils.ResultEntry;
 import org.mpi.openmind.search.utils.SAttributeMultipleName;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/clean/components/findAuthor.xhtml	Tue May 22 18:49:10 2018 +0200
@@ -0,0 +1,172 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:a4j="http://richfaces.org/a4j"
+	xmlns:rich="http://richfaces.org/rich">
+
+<body>
+	<ui:composition>
+
+
+
+		<h:panelGrid columns="2" styleClass="displayPanel"
+			columnClasses="displayPanelColumn01,displayPanelColumn02">
+
+			<h:panelGrid columns="1">
+				<h:outputLabel value="Person name" />
+				<h:outputLabel value="(name_translit, empty shows all)" />
+			</h:panelGrid>
+			<h:inputText
+				value="#{Session.publicByAuthor.findAuthorName}" />
+
+			<h:outputText />
+			<a4j:commandButton value="search"
+				actionListener="#{Session.publicByAuthor.listenerFindAuthorSearch}"
+				render="selectPersonPanel" />
+
+		</h:panelGrid>
+
+		<h:panelGrid id="selectPersonPanel" columns="1">
+
+			<h:panelGrid columns="3"
+				rendered="#{Session.advancedSearch.titles4PersonQuery.searched}">
+				<h:outputLabel
+					value="Result set - size=#{Session.advancedSearch.titles4PersonQuery.rsSize}" />
+				<h:outputLabel
+					value="Time execution [ms]=#{Session.advancedSearch.titles4PersonQuery.timeExecution}" />
+				<h:commandButton value="reset"
+					actionListener="#{Session.advancedSearch.titles4PersonQuery.listenerReset}" />
+			</h:panelGrid>
+
+			<h:panelGrid columns="1"
+				rendered="#{!empty Session.advancedSearch.titles4PersonQuery.rs}">
+
+				<rich:dataTable var="entry"
+					value="#{Session.advancedSearch.titles4PersonQuery.rs}"
+					paginator="true" rows="20">
+
+					<f:facet name="header">
+                		<rich:dataScroller id="scroller" />
+            		</f:facet>
+
+					<h:column>
+						<f:facet name="header">
+							<h:outputText value="Person ID" />
+						</f:facet>
+						<h:outputText value="#{entry.personId}" />
+					</h:column>
+
+					<h:column>
+						<f:facet name="header">
+							<h:outputText value="Person Label" />
+						</f:facet>
+						<h:outputText value="#{entry.personOv}" />
+					</h:column>
+
+					<h:column>
+						<f:facet name="header">
+							<h:outputText value="Role" />
+						</f:facet>
+						<h:outputText value="#{entry.role}" />
+					</h:column>
+
+					<h:column
+						rendered="#{Session.advancedSearch.titles4PersonQuery.displayAlias}">
+						<f:facet name="header">
+							<h:outputText value="Alias 2 Person" />
+						</f:facet>
+						<h:outputText value="#{entry.alias2Person}" />
+					</h:column>
+
+					<h:column
+						rendered="#{Session.advancedSearch.titles4PersonQuery.displayAlias}">
+						<f:facet name="header">
+							<h:outputText value="Alias" />
+						</f:facet>
+						<h:outputText value="#{entry.alias}" />
+					</h:column>
+
+					<h:column>
+						<f:facet name="header">
+							<h:outputText value="Subject" />
+						</f:facet>
+						<h:outputText value="#{entry.subject}" />
+					</h:column>
+
+					<h:column>
+						<f:facet name="header">
+							<h:outputText value="Title ID" />
+						</f:facet>
+						<h:outputText value="#{entry.titleId}" />
+					</h:column>
+
+					<h:column>
+						<f:facet name="header">
+							<h:outputText value="Subject" />
+						</f:facet>
+						<h:outputText value="#{entry.subject}" />
+					</h:column>
+
+					<h:column>
+						<f:facet name="header">
+							<h:outputText value="Title Label" />
+						</f:facet>
+						<h:outputText value="#{entry.titleOv}" />
+					</h:column>
+
+					<h:column
+						rendered="#{Session.advancedSearch.titles4PersonQuery.displayCodex}">
+						<f:facet name="header">
+							<h:outputText value="Codex Id" />
+						</f:facet>
+						<h:outputText value="#{entry.codexId}" />
+					</h:column>
+
+					<h:column
+						rendered="#{Session.advancedSearch.titles4PersonQuery.displayCodex}">
+						<f:facet name="header">
+							<h:outputText value="Codex Label" />
+						</f:facet>
+						<h:outputText value="#{entry.codexOv}" />
+					</h:column>
+
+					<h:column
+						rendered="#{Session.advancedSearch.titles4PersonQuery.displayCodex}">
+						<f:facet name="header">
+							<h:outputText value="Witness Id" />
+						</f:facet>
+						<h:outputText value="#{entry.witnessId}" />
+					</h:column>
+
+					<h:column
+						rendered="#{Session.advancedSearch.titles4PersonQuery.displayCodex}">
+						<f:facet name="header">
+							<h:outputText value="Witness Label" />
+						</f:facet>
+						<h:outputText value="#{entry.witnessOv}" />
+					</h:column>
+
+					<h:column>
+						<f:facet name="header">
+							<h:outputText value="Query" />
+						</f:facet>
+						<h:outputText value="#{entry.query}" />
+					</h:column>
+				</rich:dataTable>
+
+
+
+			</h:panelGrid>
+
+		</h:panelGrid>
+
+
+
+
+
+
+	</ui:composition>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/clean/publicByAuthor.xhtml	Tue May 22 18:49:10 2018 +0200
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:a4j="http://richfaces.org/a4j"
+	xmlns:rich="http://richfaces.org/rich">
+
+<body>
+	<ui:composition template="/templates/publicTemplate.xhtml">
+
+		<ui:define name="publicContent">
+			
+			<h:outputStylesheet name="/css/ismi-db/display.css" />
+			
+			<div id="pageTitle">
+				<h:outputText value="Public by Author Form" />
+			</div>
+
+			<h:panelGrid columns="1"
+				styleClass="mainPanel">
+
+				<rich:tabPanel
+					activeItem="#{Session.selectedPublicByAuthorTab}"
+					itemChangeListener="#{Session.listenerPublicByAuthorTabChange}">
+				
+					<rich:tab header="Public by Author" name="01">
+						<ui:include src="components/findAuthor.xhtml" />
+					</rich:tab>
+					
+				</rich:tabPanel>
+
+			</h:panelGrid>
+
+
+		</ui:define>
+	</ui:composition>
+
+</body>
+</html>
\ No newline at end of file
--- a/src/main/webapp/search/components/titles4Person.xhtml	Thu May 17 14:42:57 2018 +0200
+++ b/src/main/webapp/search/components/titles4Person.xhtml	Tue May 22 18:49:10 2018 +0200
@@ -66,25 +66,6 @@
 			<h:panelGrid columns="1"
 				rendered="#{!empty Session.advancedSearch.titles4PersonQuery.rs}">
 
-				<h:panelGrid columns="2">
-					<h:outputLabel value="Export mode (Dirk system)" />
-					<h:selectOneRadio
-						value="#{Session.advancedSearch.titles4PersonQuery.modeExportDirk}"
-						valueChangeListener="#{Session.advancedSearch.titles4PersonQuery.listenerChangeModeExportDirk}"
-						partialSubmit="true">
-						<f:selectItems
-							value="#{Session.advancedSearch.titles4PersonQuery.modeExportDirkList}" />
-					</h:selectOneRadio>
-				</h:panelGrid>
-
-				<h:outputLink
-					value="#{Session.advancedSearch.titles4PersonQuery.exportDirkUrl}"
-                    target="_blank">
-					<h:outputText
-						value="https://ismi-dev.mpiwg-berlin.mpg.de/zope-ismi/database/export..."
-						style="color:#2200C1;font-size:small;cursor:pointer;text-decoration:underline" />
-				</h:outputLink>
-
 				<rich:dataTable var="entry"
 					value="#{Session.advancedSearch.titles4PersonQuery.rs}"
 					paginator="true" rows="20">
@@ -139,7 +120,7 @@
 
 					<h:column>
 						<f:facet name="header">
-							<h:outputText value="Tilte ID" />
+							<h:outputText value="Title ID" />
 						</f:facet>
 						<h:outputText value="#{entry.titleId}" />
 					</h:column>
--- a/src/main/webapp/templates/main_template.xhtml	Thu May 17 14:42:57 2018 +0200
+++ b/src/main/webapp/templates/main_template.xhtml	Tue May 22 18:49:10 2018 +0200
@@ -167,6 +167,18 @@
                 </rich:menuItem>
             </rich:dropDownMenu>
 
+            <rich:dropDownMenu mode="ajax" rendered="#{Session.canMerge}">
+                <f:facet name="label">
+                    <h:panelGroup>
+                        <h:outputText value="Clean" />
+                    </h:panelGroup>
+                </f:facet>
+
+                <rich:menuItem label="Public by author"
+                    onclick="document.location.href='#{ApplicationBean1.root}/clean/publicByAuthor.xhtml'">
+                </rich:menuItem>
+			</rich:dropDownMenu>
+
 			<h:outputLink  rendered="#{Session.canCreate}"
 				value="#{ApplicationBean1.root}/browse/entityRepository.xhtml">Browse Repository</h:outputLink>
 
@@ -188,7 +200,7 @@
 			</rich:dropDownMenu>
 			
 			<h:outputLink rendered="#{Session.canCreate}"
-				value="#{ApplicationBean1.root}/public/publicCodices.xhtml">Codices marked as public</h:outputLink>
+				value="#{ApplicationBean1.root}/public/publicCodices.xhtml">Public Codices</h:outputLink>
 			
 			<h:outputLink  rendered="#{Session.admin}"
 				value="#{ApplicationBean1.root}/search/biographies.xhtml">Biographies</h:outputLink>