changeset 211:631864bfec2e

add methods for lost misattributions and misidentifications.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Fri, 04 Oct 2019 17:42:27 +0200
parents 0aa8975784d9
children 310f512f66af
files src/main/java/de/mpiwg/itgroup/ismi/browse/EntityRepositoryBean.java src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java src/main/java/de/mpiwg/itgroup/ismi/merge/MissingRelationsBean.java src/main/java/org/docs/richfaces/RichBean.java src/main/webapp/clean/components/lostMisattribution.xhtml src/main/webapp/clean/components/lostMisidentification.xhtml src/main/webapp/clean/missingRelations.xhtml
diffstat 7 files changed, 396 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/browse/EntityRepositoryBean.java	Mon Sep 02 13:14:08 2019 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/browse/EntityRepositoryBean.java	Fri Oct 04 17:42:27 2019 +0200
@@ -154,7 +154,7 @@
      * 
 	 * @throws IOException
 	 */
-	public void downloadAllCsv() throws IOException {
+	public void downloadAllCsv(ActionEvent ev) throws IOException {
 	    List<Entity> allEnts = getWrapper().getEntitiesByDef(getObjectClass());
 	    sendAsCsv(allEnts);
 	}
@@ -166,7 +166,7 @@
 	 * 
 	 * @throws IOException
 	 */
-	public void downloadAdvancedCsv() throws IOException {
+	public void downloadAdvancedCsv(ActionEvent ev) throws IOException {
 	    sendAsCsv(getEntities());
 	}
 	
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java	Mon Sep 02 13:14:08 2019 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java	Fri Oct 04 17:42:27 2019 +0200
@@ -53,6 +53,8 @@
 	public static String PLACE = "PLACE";
 	public static String SUBJECT = "SUBJECT";
 	public static String REFERENCE = "REFERENCE";
+	public static String MISATTRIBUTION = "MISATTRIBUTION";
+	public static String MISIDENTIFICATION = "MISIDENTIFICATION";
 	public static String ROLE = "ROLE";
 	public static String DIGITALIZATION = "DIGITALIZATION";
 	public static String FLORUIT_DATE = "FLORUIT_DATE";
--- a/src/main/java/de/mpiwg/itgroup/ismi/merge/MissingRelationsBean.java	Mon Sep 02 13:14:08 2019 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/merge/MissingRelationsBean.java	Fri Oct 04 17:42:27 2019 +0200
@@ -273,6 +273,48 @@
  		logger.debug("Done findEmptyReference.");
  	}
 
+    public void actionFindLostMisattribution() {
+		logger.debug("Start findLostMisattribution...");
+		List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
+		/*
+		 * find MISATTRIBUTION without relation
+		 */
+        browseBean = new FullEntityRepositoryBean();
+	    browseBean.setObjectClass(MISATTRIBUTION);
+	    RelationFilter relFilter1 = new RelationFilter();
+	    relFilter1.relObjectClass = "has_author_misattribution";
+	    relFilter1.srcObjectClass = TEXT;
+	    relFilter1.relationMissing = true;
+	    relFilters.add(relFilter1);
+	    try {
+            browseBean.searchByRelations(relFilters);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+		logger.debug("Done findLostMisattribution.");
+	}
+	
+    public void actionFindLostMisidentification() {
+		logger.debug("Start findLostMisidentification...");
+		List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
+		/*
+		 * find MISIDENTIFICATION without relation
+		 */
+        browseBean = new FullEntityRepositoryBean();
+	    browseBean.setObjectClass(MISIDENTIFICATION);
+	    RelationFilter relFilter1 = new RelationFilter();
+	    relFilter1.relObjectClass = "has_misidentification";
+	    relFilter1.srcObjectClass = WITNESS;
+	    relFilter1.relationMissing = true;
+	    relFilters.add(relFilter1);
+	    try {
+            browseBean.searchByRelations(relFilters);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+		logger.debug("Done findLostMisidentification.");
+	}
+	
     /**
      * Delete the selected Entities.
      * @return
--- a/src/main/java/org/docs/richfaces/RichBean.java	Mon Sep 02 13:14:08 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-package org.docs.richfaces;
-
-import java.io.Serializable;
-
-import javax.annotation.PostConstruct;
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.ViewScoped;
-
-@ViewScoped
-@ManagedBean
-public class RichBean implements Serializable {
-
-    private static final long serialVersionUID = -6239437588285327644L;
-
-    private String name;
-
-    @PostConstruct
-    public void postContruct() {
-        name = "John";
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/clean/components/lostMisattribution.xhtml	Fri Oct 04 17:42:27 2019 +0200
@@ -0,0 +1,166 @@
+<!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>
+
+        <h2 style="color:black">Misattributions without relations</h2>
+
+		<h:panelGrid columns="3" styleClass="displayPanel"
+			columnClasses="displayPanelColumn01,displayPanelColumn02">
+
+            <a4j:commandButton value="Show misattributions without relations"
+                actionListener="#{Session.missingRelations.actionFindLostMisattribution}"
+                render="showMisattributionPanel,lostMisattributionButton" />
+            <h:outputText/>
+            <h:outputText/>
+
+		</h:panelGrid>
+
+		<h:panelGrid id="showMisattributionPanel" columns="1"
+			style="margin-left: auto; margin-right: auto; text-align: center; width: 100%;">
+
+			<h:outputText
+				value="#{Session.missingRelations.browseBean.resultSummaryMsg}"
+				rendered="#{!empty Session.missingRelations.browseBean.resultSummaryMsg}"
+				styleClass="summaryMsg" />
+
+			<h:column
+				rendered="#{!empty Session.missingRelations.browseBean.entities}">
+				<h:outputText value="go to page" styleClass="sumaryMsg" />
+				<h:inputText value="#{Session.missingRelations.browseBean.page}"
+					size="4" />
+				<h:commandButton value="submit"
+					actionListener="#{Session.missingRelations.browseBean.actionGoToPageAdvancedResult}" />
+				<h:outputText value=" #{Session.missingRelations.browseBean.pageMsg}"
+					rendered="#{!empty Session.missingRelations.browseBean.pageMsg}"
+					style="color:red" />
+			</h:column>
+
+
+			<h:column
+				rendered="#{!empty Session.missingRelations.browseBean.entities}">
+				<h:panelGroup>
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-first.gif"
+						style="border:none;" title="First Page"
+						action="#{Session.missingRelations.browseBean.advancedFirst}" />
+
+					<h:commandButton image="/resources/css/xp/css-images/arrow-fr.gif"
+						style="border:none;" title="Fast Backwards"
+						action="#{Session.missingRelations.browseBean.advancedFastRewind}" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-previous.gif"
+						style="border:none;" title="Previous Page"
+						action="#{Session.missingRelations.browseBean.advancedPrevious}" />
+
+					<h:outputText
+						value="#{Session.missingRelations.browseBean.advancedPaginator.recordStatus}"
+						styleClass="sumaryMsg" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-next.gif"
+						style="border:none;" title="Next Page"
+						action="#{Session.missingRelations.browseBean.advancedNext}" />
+
+					<h:commandButton image="/resources/css/xp/css-images/arrow-ff.gif"
+						style="border:none;" title="Fast Forward"
+						action="#{Session.missingRelations.browseBean.advancedFastForward}" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-last.gif"
+						style="border:none;" title="Last Page"
+						action="#{Session.missingRelations.browseBean.advancedLast}" />
+				</h:panelGroup>
+			</h:column>
+
+			<rich:dataTable id="MisattributionDataTable" rows="30"
+				value="#{Session.missingRelations.browseBean.currentEntities}"
+				rendered="#{!empty Session.missingRelations.browseBean.currentEntities}"
+				var="entity" styleClass="rsPanel" columnClasses="rsPanelColumn">
+				<h:column style="text-align:left">
+                    <f:facet name="header">Misattribution</f:facet>
+                    <h:outputLink target="_blank"
+                        value="#{ApplicationBean1.root}/browse/entityDetails.xhtml?eid=#{entity.id}">
+                        <h:outputText
+                            value="#{entity.ownValue} [#{entity.id}]" />
+                    </h:outputLink>
+					<h:commandButton
+						action="#{Session.missingRelations.browseBean.actionEdit}"
+						rendered="#{Session.canEdit}"
+						image="/resources/css/xp/css-images/edit16.gif"
+						title="Edit this entity" />
+				</h:column>
+                <h:column style="text-align:left">
+                    <f:facet name="header">State</f:facet>
+                    <h:outputText value="#{entity.privacity}" />
+                </h:column>
+			</rich:dataTable>
+
+			<h:column
+				rendered="#{!empty Session.missingRelations.browseBean.entities}">
+				<h:panelGroup>
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-first.gif"
+						style="border:none;" title="First Page"
+						action="#{Session.missingRelations.browseBean.advancedFirst}" />
+
+					<h:commandButton image="/resources/css/xp/css-images/arrow-fr.gif"
+						style="border:none;" title="Fast Backwards"
+						action="#{Session.missingRelations.browseBean.advancedFastRewind}" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-previous.gif"
+						style="border:none;" title="Previous Page"
+						action="#{Session.missingRelations.browseBean.advancedPrevious}" />
+
+					<h:outputText
+						value="#{Session.missingRelations.browseBean.advancedPaginator.recordStatus}"
+						styleClass="sumaryMsg" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-next.gif"
+						style="border:none;" title="Next Page"
+						action="#{Session.missingRelations.browseBean.advancedNext}" />
+
+					<h:commandButton image="/resources/css/xp/css-images/arrow-ff.gif"
+						style="border:none;" title="Fast Forward"
+						action="#{Session.missingRelations.browseBean.advancedFastForward}" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-last.gif"
+						style="border:none;" title="Last Page"
+						action="#{Session.missingRelations.browseBean.advancedLast}" />
+				</h:panelGroup>
+			</h:column>
+
+		    <h:column rendered="#{!empty Session.missingRelations.browseBean.entities}">
+		        <h:commandButton value="download all as CSV"
+		            actionListener="#{Session.missingRelations.browseBean.downloadAdvancedCsv}" />
+		    </h:column>
+
+		</h:panelGrid>
+
+		<h:panelGrid columns="3" styleClass="displayPanel" id="lostMisattributionButton"
+			columnClasses="displayPanelColumn01,displayPanelColumn02">
+
+			<a4j:commandButton value="Delete all these Misattributions"
+				rendered="#{Session.canDelete and (!empty Session.missingRelations.browseBean.entities)}"
+				onclick="if(!confirm('Do you really want to delete all selected Misattributions?')){ return; };"
+				actionListener="#{Session.missingRelations.actionDeleteSelectedEntities}"
+				render="showMisattributionPanel,lostMisattributionButton" />
+            <h:outputText/>
+            <h:outputText/>
+
+		</h:panelGrid>
+
+
+	</ui:composition>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/clean/components/lostMisidentification.xhtml	Fri Oct 04 17:42:27 2019 +0200
@@ -0,0 +1,166 @@
+<!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>
+
+        <h2 style="color:black">Misidentifications without relations</h2>
+
+		<h:panelGrid columns="3" styleClass="displayPanel"
+			columnClasses="displayPanelColumn01,displayPanelColumn02">
+
+            <a4j:commandButton value="Show misidentifications without relations"
+                actionListener="#{Session.missingRelations.actionFindLostMisidentification}"
+                render="showMisidentificationPanel,lostMisidentificationButton" />
+            <h:outputText/>
+            <h:outputText/>
+
+		</h:panelGrid>
+
+		<h:panelGrid id="showMisidentificationPanel" columns="1"
+			style="margin-left: auto; margin-right: auto; text-align: center; width: 100%;">
+
+			<h:outputText
+				value="#{Session.missingRelations.browseBean.resultSummaryMsg}"
+				rendered="#{!empty Session.missingRelations.browseBean.resultSummaryMsg}"
+				styleClass="summaryMsg" />
+
+			<h:column
+				rendered="#{!empty Session.missingRelations.browseBean.entities}">
+				<h:outputText value="go to page" styleClass="sumaryMsg" />
+				<h:inputText value="#{Session.missingRelations.browseBean.page}"
+					size="4" />
+				<h:commandButton value="submit"
+					actionListener="#{Session.missingRelations.browseBean.actionGoToPageAdvancedResult}" />
+				<h:outputText value=" #{Session.missingRelations.browseBean.pageMsg}"
+					rendered="#{!empty Session.missingRelations.browseBean.pageMsg}"
+					style="color:red" />
+			</h:column>
+
+
+			<h:column
+				rendered="#{!empty Session.missingRelations.browseBean.entities}">
+				<h:panelGroup>
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-first.gif"
+						style="border:none;" title="First Page"
+						action="#{Session.missingRelations.browseBean.advancedFirst}" />
+
+					<h:commandButton image="/resources/css/xp/css-images/arrow-fr.gif"
+						style="border:none;" title="Fast Backwards"
+						action="#{Session.missingRelations.browseBean.advancedFastRewind}" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-previous.gif"
+						style="border:none;" title="Previous Page"
+						action="#{Session.missingRelations.browseBean.advancedPrevious}" />
+
+					<h:outputText
+						value="#{Session.missingRelations.browseBean.advancedPaginator.recordStatus}"
+						styleClass="sumaryMsg" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-next.gif"
+						style="border:none;" title="Next Page"
+						action="#{Session.missingRelations.browseBean.advancedNext}" />
+
+					<h:commandButton image="/resources/css/xp/css-images/arrow-ff.gif"
+						style="border:none;" title="Fast Forward"
+						action="#{Session.missingRelations.browseBean.advancedFastForward}" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-last.gif"
+						style="border:none;" title="Last Page"
+						action="#{Session.missingRelations.browseBean.advancedLast}" />
+				</h:panelGroup>
+			</h:column>
+
+			<rich:dataTable id="MisidentificationDataTable" rows="30"
+				value="#{Session.missingRelations.browseBean.currentEntities}"
+				rendered="#{!empty Session.missingRelations.browseBean.currentEntities}"
+				var="entity" styleClass="rsPanel" columnClasses="rsPanelColumn">
+				<h:column style="text-align:left">
+                    <f:facet name="header">Misidentification</f:facet>
+                    <h:outputLink target="_blank"
+                        value="#{ApplicationBean1.root}/browse/entityDetails.xhtml?eid=#{entity.id}">
+                        <h:outputText
+                            value="#{entity.ownValue} [#{entity.id}]" />
+                    </h:outputLink>
+					<h:commandButton
+						action="#{Session.missingRelations.browseBean.actionEdit}"
+						rendered="#{Session.canEdit}"
+						image="/resources/css/xp/css-images/edit16.gif"
+						title="Edit this entity" />
+				</h:column>
+                <h:column style="text-align:left">
+                    <f:facet name="header">State</f:facet>
+                    <h:outputText value="#{entity.privacity}" />
+                </h:column>
+			</rich:dataTable>
+
+			<h:column
+				rendered="#{!empty Session.missingRelations.browseBean.entities}">
+				<h:panelGroup>
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-first.gif"
+						style="border:none;" title="First Page"
+						action="#{Session.missingRelations.browseBean.advancedFirst}" />
+
+					<h:commandButton image="/resources/css/xp/css-images/arrow-fr.gif"
+						style="border:none;" title="Fast Backwards"
+						action="#{Session.missingRelations.browseBean.advancedFastRewind}" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-previous.gif"
+						style="border:none;" title="Previous Page"
+						action="#{Session.missingRelations.browseBean.advancedPrevious}" />
+
+					<h:outputText
+						value="#{Session.missingRelations.browseBean.advancedPaginator.recordStatus}"
+						styleClass="sumaryMsg" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-next.gif"
+						style="border:none;" title="Next Page"
+						action="#{Session.missingRelations.browseBean.advancedNext}" />
+
+					<h:commandButton image="/resources/css/xp/css-images/arrow-ff.gif"
+						style="border:none;" title="Fast Forward"
+						action="#{Session.missingRelations.browseBean.advancedFastForward}" />
+
+					<h:commandButton
+						image="/resources/css/xp/css-images/arrow-last.gif"
+						style="border:none;" title="Last Page"
+						action="#{Session.missingRelations.browseBean.advancedLast}" />
+				</h:panelGroup>
+			</h:column>
+
+		    <h:column rendered="#{!empty Session.missingRelations.browseBean.entities}">
+		        <h:commandButton value="download all as CSV"
+		            actionListener="#{Session.missingRelations.browseBean.downloadAdvancedCsv}" />
+		    </h:column>
+
+		</h:panelGrid>
+
+		<h:panelGrid columns="3" styleClass="displayPanel" id="lostMisidentificationButton"
+			columnClasses="displayPanelColumn01,displayPanelColumn02">
+
+			<a4j:commandButton value="Delete all these misidentifications"
+				rendered="#{Session.canDelete and (!empty Session.missingRelations.browseBean.entities)}"
+				onclick="if(!confirm('Do you really want to delete all selected misidentifications?')){ return; };"
+				actionListener="#{Session.missingRelations.actionDeleteSelectedEntities}"
+				render="showMisidentificationPanel,lostMisidentificationButton" />
+            <h:outputText/>
+            <h:outputText/>
+
+		</h:panelGrid>
+
+
+	</ui:composition>
+</body>
+</html>
--- a/src/main/webapp/clean/missingRelations.xhtml	Mon Sep 02 13:14:08 2019 +0200
+++ b/src/main/webapp/clean/missingRelations.xhtml	Fri Oct 04 17:42:27 2019 +0200
@@ -23,45 +23,53 @@
 					itemChangeListener="#{Session.missingRelations.listenerTabChange}"
 					activeItem="#{Session.missingRelations.selectedTab}">
 
-					<rich:tab header="Missing Author" name="aut">
+					<rich:tab header="Author" name="aut">
 						<ui:include src="components/missingAuthor.xhtml" />
 					</rich:tab>
 
-					<rich:tab header="Missing Text" name="txt">
+					<rich:tab header="Text" name="txt">
 						<ui:include src="components/missingText.xhtml" />
 					</rich:tab>
 
-					<rich:tab header="Missing Codex" name="cod">
+					<rich:tab header="Codex" name="cod">
 						<ui:include src="components/missingCodex.xhtml" />
 					</rich:tab>
 
-                    <rich:tab header="Missing Collection" name="col">
+                    <rich:tab header="Collection" name="col">
                         <ui:include src="components/missingCollection.xhtml" />
                     </rich:tab>
 
-                    <rich:tab header="Missing Repository" name="rep">
+                    <rich:tab header="Repository" name="rep">
                         <ui:include src="components/missingRepository.xhtml" />
                     </rich:tab>
 
-                    <rich:tab header="Missing Place" name="plc">
+                    <rich:tab header="Place" name="plc">
                         <ui:include src="components/missingPlace.xhtml" />
                     </rich:tab>
 
-                    <rich:tab header="Lost Alias" name="ali">
+                    <rich:tab header="Alias" name="ali">
                         <ui:include src="components/lostAlias.xhtml" />
                     </rich:tab>
 
-                    <rich:tab header="Lost Floruit" name="flo">
+                    <rich:tab header="Floruit" name="flo">
                         <ui:include src="components/lostFloruit.xhtml" />
                     </rich:tab>
 
-                    <rich:tab header="Lost Reference" name="ref">
+                    <rich:tab header="Reference1" name="ref">
                         <ui:include src="components/lostReference.xhtml" />
                     </rich:tab>
 
-                    <rich:tab header="Empty Reference" name="eref">
+                    <rich:tab header="Reference2" name="eref">
                         <ui:include src="components/emptyReference.xhtml" />
                     </rich:tab>
+
+                    <rich:tab header="Misattribution" name="misa">
+                        <ui:include src="components/lostMisattribution.xhtml" />
+                    </rich:tab>
+
+                    <rich:tab header="Misidentification" name="misi">
+                        <ui:include src="components/lostMisidentification.xhtml" />
+                    </rich:tab>
 				</rich:tabPanel>
 
 			</h:panelGrid>