changeset 200:95c18711c0be

new find-lost-references function in clean menu to delete references without relations.
author casties
date Thu, 24 Jan 2019 16:10:29 +0100
parents 8af530c5b4cd
children fa99ee693125
files src/main/java/de/mpiwg/itgroup/ismi/merge/MissingRelationsBean.java src/main/webapp/clean/components/lostAlias.xhtml src/main/webapp/clean/components/lostReference.xhtml src/main/webapp/clean/missingRelations.xhtml
diffstat 4 files changed, 192 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/merge/MissingRelationsBean.java	Wed Jan 23 20:28:00 2019 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/merge/MissingRelationsBean.java	Thu Jan 24 16:10:29 2019 +0100
@@ -12,8 +12,6 @@
 import de.mpiwg.itgroup.ismi.browse.EntityRepositoryBean;
 import de.mpiwg.itgroup.ismi.browse.FullEntityRepositoryBean;
 import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean;
-import de.mpiwg.itgroup.ismi.entry.beans.SessionBean;
-import de.mpiwg.itgroup.ismi.entry.utils.PrivacityUtils;
 
 public class MissingRelationsBean extends AbstractISMIBean implements Serializable{
 	
@@ -211,6 +209,27 @@
 		logger.debug("Done findLostAlias.");
 	}
 	
+    public void actionFindLostReference() {
+		logger.debug("Start findLostReference...");
+		List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
+		/*
+		 * find ALIAS without relation
+		 */
+        browseBean = new FullEntityRepositoryBean();
+	    browseBean.setObjectClass(REFERENCE);
+	    RelationFilter relFilter = new RelationFilter();
+	    relFilter.relObjectClass = "*";
+	    relFilter.tarObjectClass = "*";
+	    relFilter.relationMissing = true;
+	    relFilters.add(relFilter);
+	    try {
+            browseBean.searchByRelations(relFilters);
+        } catch (Exception e) {
+            logger.error(e);
+        }
+		logger.debug("Done findLostReference.");
+	}
+	
     /**
      * Delete the selected Entities.
      * @return
--- a/src/main/webapp/clean/components/lostAlias.xhtml	Wed Jan 23 20:28:00 2019 +0100
+++ b/src/main/webapp/clean/components/lostAlias.xhtml	Thu Jan 24 16:10:29 2019 +0100
@@ -85,7 +85,7 @@
 				rendered="#{!empty Session.missingRelations.browseBean.currentEntities}"
 				var="entity" styleClass="rsPanel" columnClasses="rsPanelColumn">
 				<h:column style="text-align:left">
-                    <f:facet name="header">Codex</f:facet>
+                    <f:facet name="header">Alias</f:facet>
                     <h:outputLink target="_blank"
                         value="#{ApplicationBean1.root}/browse/entityDetails.xhtml?eid=#{entity.id}">
                         <h:outputText
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/clean/components/lostReference.xhtml	Thu Jan 24 16:10:29 2019 +0100
@@ -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">References without relations</h2>
+
+		<h:panelGrid columns="3" styleClass="displayPanel"
+			columnClasses="displayPanelColumn01,displayPanelColumn02">
+
+            <a4j:commandButton value="Show references without relations"
+                actionListener="#{Session.missingRelations.actionFindLostReference}"
+                render="showReferencePanel,lostReferenceButton" />
+            <h:outputText/>
+            <h:outputText/>
+
+		</h:panelGrid>
+
+		<h:panelGrid id="showReferencePanel" 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="ReferenceDataTable" 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">Reference</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="lostReferenceButton"
+			columnClasses="displayPanelColumn01,displayPanelColumn02">
+
+			<a4j:commandButton value="Delete all these references"
+				rendered="#{Session.canDelete and (!empty Session.missingRelations.browseBean.entities)}"
+				onclick="if(!confirm('Do you really want to delete all selected references?')){ return; };"
+				actionListener="#{Session.missingRelations.actionDeleteSelectedEntities}"
+				render="showReferencePanel,lostReferenceButton" />
+            <h:outputText/>
+            <h:outputText/>
+
+		</h:panelGrid>
+
+
+	</ui:composition>
+</body>
+</html>
--- a/src/main/webapp/clean/missingRelations.xhtml	Wed Jan 23 20:28:00 2019 +0100
+++ b/src/main/webapp/clean/missingRelations.xhtml	Thu Jan 24 16:10:29 2019 +0100
@@ -50,6 +50,10 @@
                     <rich:tab header="Lost Alias" name="ali">
                         <ui:include src="components/lostAlias.xhtml" />
                     </rich:tab>
+
+                    <rich:tab header="Lost Reference" name="ref">
+                        <ui:include src="components/lostReference.xhtml" />
+                    </rich:tab>
 				</rich:tabPanel>
 
 			</h:panelGrid>