changeset 121:6f0e9a333c15

misidentification of witness mostly works now.
author casties
date Mon, 09 Jan 2017 20:37:29 +0100
parents 71638720fe2f
children fb3cb7d70f66
files src/main/java/de/mpiwg/itgroup/ismi/auxObjects/ListenerObject.java src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/Misidentification.java src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/MisidentificationTable.java src/main/resources/own-value.cfg.xml src/main/webapp/entry/components/misidentification.xhtml
diffstat 6 files changed, 73 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/auxObjects/ListenerObject.java	Fri Jan 06 20:41:35 2017 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/auxObjects/ListenerObject.java	Mon Jan 09 20:37:29 2017 +0100
@@ -32,6 +32,13 @@
 		this.attName = attName;
 	}
 	
+	public ListenerObject(List<SelectItem> suggestedItemsNew,
+			Attribute attributeNew, Entity entityNew) {
+		suggestedItems = suggestedItemsNew;
+		attribute = attributeNew;
+		entity = entityNew;
+	}
+
 	/**
 	 * When the term is changed in the inputtext, 
 	 * this method will be called to change the suggestion list.
@@ -42,8 +49,12 @@
 		changeListener(event, classObj, attName);
 	}
 	
-	public void actionListenerSelect(ActionEvent event){
-		
+	/**
+	 * Called when an entry in the suggestion list is clicked.
+	 * 
+	 * @param event
+	 */
+	public void actionListenerSelect(ActionEvent event){		
 		this.suggestedItems = new ArrayList<SelectItem>();
 		SelectItem selectItem = (SelectItem) getRequestBean("item");
 		if(selectItem != null){
@@ -89,13 +100,6 @@
 		return null;
 	}
 	
-	public ListenerObject(List<SelectItem> suggestedItemsNew,
-			Attribute attributeNew, Entity entityNew) {
-		suggestedItems = suggestedItemsNew;
-		attribute = attributeNew;
-		entity = entityNew;
-	}
-
 	public List<SelectItem> getSuggestedItems() {
 		return suggestedItems;
 	}
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java	Fri Jan 06 20:41:35 2017 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java	Mon Jan 09 20:37:29 2017 +0100
@@ -235,7 +235,7 @@
 			
 			
 			/*
-			 * save misattributions
+			 * save misidentifications
 			 */
 			this.entity = this.misidentTable.saveMisidentifications(this.entity);
 			
--- a/src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/Misidentification.java	Fri Jan 06 20:41:35 2017 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/Misidentification.java	Mon Jan 09 20:37:29 2017 +0100
@@ -41,12 +41,12 @@
 
 		// set title
 		if (!misident.containsAttribute(TITLE)) {
-			misident.addAttribute(new Attribute(title, "text", title));
+			misident.addAttribute(new Attribute(TITLE, "arabic", title));
 		} else {
 			misident.getAttributeByName(TITLE).setOwnValue(title);
 		}
 		if (!misident.containsAttribute(TITLE_TRANSLIT)) {
-			misident.addAttribute(new Attribute(title, "text", title_translit));
+			misident.addAttribute(new Attribute(TITLE_TRANSLIT, "text", title_translit));
 		} else {
 			misident.getAttributeByName(TITLE_TRANSLIT).setOwnValue(title_translit);
 		}
@@ -57,6 +57,9 @@
 
 		// set person relation to misidentification
 		this.misident.removeAllSourceRelations(MISATTRIBUTED_TO, "PERSON");
+		if (person.isLightweight()) {
+			person = ot.getEntityContent(person);
+		}
 		new Relation(misident, person, MISATTRIBUTED_TO);
 
 		// set reference relation to misidentification
@@ -90,7 +93,8 @@
 		Misidentification obj = new Misidentification(ot, userName);
 
 		if (misident.isLightweight()) {
-			obj.setMisident(ot.getEntityByIdWithContent(misident.getId()));
+			misident = ot.getEntityByIdWithContent(misident.getId());
+			obj.setMisident(misident);
 		}
 		
 		// load title
--- a/src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/MisidentificationTable.java	Fri Jan 06 20:41:35 2017 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/MisidentificationTable.java	Mon Jan 09 20:37:29 2017 +0100
@@ -57,10 +57,12 @@
 		//@TODO
 	}
 	
-	public void listenerCreate(ActionEvent event){
-		if(this.lo.entity != null & this.lo.entity.isPersistent()){
+	public void listenerCreate(ActionEvent event) {
+		Entity ent = this.lo.entity;
+		if(ent != null & ent.isPersistent()){
 			// FIXME: where to get title?
-			this.create(null, null, this.lo.entity);	
+			
+			this.create(null, null, ent);	
 		}
 	}
 	
--- a/src/main/resources/own-value.cfg.xml	Fri Jan 06 20:41:35 2017 +0100
+++ b/src/main/resources/own-value.cfg.xml	Mon Jan 09 20:37:29 2017 +0100
@@ -59,6 +59,27 @@
         </own-value-rule>
 
 
+       <own-value-rule id="misident_01">
+            <target-relation name="has_misidentification" substring="false">
+                <source object-class="WITNESS">
+                    <source-relation name="is_exemplar_of" substring="false">
+                        <target object-class="TEXT">
+                            <attribute name="full_title_translit" end-node="true"/>
+                        </target>
+                    </source-relation>
+                </source>
+            </target-relation>
+        </own-value-rule>                                
+
+        <own-value-rule id="misident_02">
+            <source-relation name="misattributed_to" substring="false">
+                <target object-class="PERSON">
+                    <attribute name="name_translit" end-node="true"/>
+                </target>
+            </source-relation>
+        </own-value-rule>
+
+
         <own-value-rule id="eventCopy_witness">
             <source-relation name="is_a_copy_of" substring="false">
                 <target object-class="WITNESS">
@@ -326,6 +347,12 @@
             <entry own-value-rule="misattr_02"/>
         </print-rule>    
             
+        <print-rule for="MISIDENTIFICATION">
+			<formatstr value="%misident_01% to %misident_02%"/>
+            <entry own-value-rule="misident_01"/>
+            <entry own-value-rule="misident_02"/>
+        </print-rule>    
+            
         <print-rule for="REFERENCE">
             <formatstr value="%reference0%"/>
             <entry own-value-rule="reference0"/>
--- a/src/main/webapp/entry/components/misidentification.xhtml	Fri Jan 06 20:41:35 2017 +0100
+++ b/src/main/webapp/entry/components/misidentification.xhtml	Mon Jan 09 20:37:29 2017 +0100
@@ -23,7 +23,7 @@
 						style="opacity: 0.1; width: 500px; height: 350px; left: 5px; top: 5px; bottom: -5px;">
 					</div>
 					<div class="rf-pp-hdr " style="cursor: default;">
-						<div class="rf-pp-hdr-cnt">EndNote Reference</div>
+						<div class="rf-pp-hdr-cnt">Misidentification</div>
 					</div>
 
 					<h:panelGrid columns="1" class="rf-pp-cnt-scrlr"
@@ -33,11 +33,23 @@
 							<h:panelGrid columns="1">
 								<h:panelGrid columns="2">
 
-									<h:outputLabel value="EndNote Id" />
+									<h:outputText value="Author" />
+									<h:outputText
+										value="[#{CurrentWitness.misidentTable.misident.person.id}] #{CurrentWitness.misidentTable.misident.person.ownValue}" />
+
+									<h:outputText value="Title" />
+									<h:inputText size="80"
+										value="#{CurrentWitness.misidentTable.misident.title}" />
+								
+									<h:outputText value="Title translit" />
+									<h:inputText size="80"
+										value="#{CurrentWitness.misidentTable.misident.title_translit}" />
+				
+									<h:outputLabel value="Reference Id" />
 									<h:inputText size="80"
 										value="#{CurrentWitness.misidentTable.misident.ref.endNoteId}" />
 
-									<h:outputLabel value="EndNote Content" />
+									<h:outputLabel value="Full Reference" />
 									<h:inputTextarea
 										value="#{CurrentWitness.misidentTable.misident.ref.endNoteContent}"
 										rows="10" cols="80" />
@@ -73,7 +85,7 @@
 								<h:outputText value="Title" />
 							</f:facet>
 							<h:outputText
-								value="#{item.obj.person.ownValue}" />
+								value="#{item.obj.title}" />
 						</rich:column>
 
 						<rich:column>
@@ -81,7 +93,7 @@
 								<h:outputText value="Title (translit)" />
 							</f:facet>
 							<h:outputText
-								value="#{item.obj.person.ownValue}" />
+								value="#{item.obj.title_translit}" />
 						</rich:column>
 
 						<rich:column>
@@ -128,9 +140,10 @@
 						render="misidentArea"/>
 				</h:panelGrid>
 
-				<h:panelGrid columns="2">
+				<h:panelGrid columns="3">
+					<h:outputText value="Author"/>
 					<ismi:autocomplete lo="#{CurrentWitness.misidentTable.lo}" />
-					<a4j:commandButton value="Add"
+					<a4j:commandButton value="Add misidentification"
 						actionListener="#{CurrentWitness.misidentTable.listenerCreate}"
 						render="misidentArea"/>
 				</h:panelGrid>