changeset 161:8049becb05ca

New ALIAS is_alias_identifier_of CODEX/WITNESS for diverse catalog numbers.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Thu, 19 Apr 2018 20:35:12 +0200
parents 1882f1c9974b
children 49a631863746
files src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCodexBean.java src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java src/main/webapp/entry/codex.xhtml src/main/webapp/entry/witness.xhtml
diffstat 5 files changed, 127 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java	Fri Apr 13 12:58:36 2018 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java	Thu Apr 19 20:35:12 2018 +0200
@@ -71,6 +71,7 @@
 	public static String is_prime_alias_name_of = "is_prime_alias_name_of";
 	public static String is_alias_title_of = "is_alias_title_of";
 	public static String is_prime_alias_title_of = "is_prime_alias_title_of";
+    public static String is_alias_identifier_of = "is_alias_identifier_of";
 	public static String alias = "alias";
 	public static String has_floruit_date = "has_floruit_date";
 	
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCodexBean.java	Fri Apr 13 12:58:36 2018 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCodexBean.java	Thu Apr 19 20:35:12 2018 +0200
@@ -32,7 +32,8 @@
 
 	private List<Entity> witnessInCurrentCodex;
 	private boolean showWitnessInCurrentCodex;
-	
+ 
+	private EntityList aliasIdList;
 	private EntityList ownedByPeople;
 	private EntityList readByPeople;
 	
@@ -51,7 +52,7 @@
 			// source relations
 			new String[]{"is_part_of", "is_alias_of", "owned_by", "read_by"},
 			// target relations
-			new String[]{"is_alias_of", "is_reference_of"});
+			new String[]{"is_alias_of", "is_reference_of", is_alias_identifier_of});
 
 	
 	public CurrentCodexBean() {
@@ -70,6 +71,8 @@
 		super.reset();
 		this.entity = new Entity(Node.TYPE_ABOX, CODEX, false);
 		
+		this.aliasIdList = new EntityList(ALIAS, "alias", getWrapper(), getUserName());
+	      
 		this.ownedByPeople = new EntityList(PERSON, "name_translit", true);
 		this.readByPeople = new EntityList(PERSON, "name_translit", true);
 		
@@ -140,6 +143,11 @@
 					this.isAlias = false;
 				}
 				
+                for(Relation rel : getWrapper().getTargetRelations(codex, is_alias_identifier_of, ALIAS, -1)) {
+                    Entity alias = getWrapper().getEntityById(rel.getSourceId());
+                    this.aliasIdList.add(alias);
+                }
+                
 				for(Relation rel : getWrapper().getSourceRelations(codex, owned_by, PERSON, -1)) {
 					this.ownedByPeople.add(getWrapper().getEntityById(rel.getTargetId()), rel.getAttributeByName("date"));
 				}
@@ -244,22 +252,22 @@
 
 			this.entity.replaceUniqueSourceRelation(this.getCollectionLo().entity, COLLECTION, is_part_of);
 			
-			// CODEX -> owner_by (manyToMany) -> PERSON
-			this.entity.removeAllSourceRelationsByName(owned_by);
-			
-			// CODEX -> read_by (manyToMany) -> PERSON
-			this.entity.removeAllSourceRelationsByName("read_by");
-			
-			//REFERENCE -> is_reference_of -> THIS
-			//this.entity = this.prepareReferencesToSave(this.entity);
-			this.saveReferences();		
-
+            // ALIAS -> is_identifier_of -> CODEX
+            replaceMultipleTargetRelations(entity, aliasIdList.getEntities(), ALIAS, is_alias_identifier_of);
+            
 			// CODEX -> owned_by -> PERSON
 			replaceMultipleSourceRelations(entity, ownedByPeople.getEntities(), PERSON, owned_by);
+            
 			// CODEX -> read_by -> PERSON
 			replaceMultipleSourceRelations(entity, readByPeople.getEntities(), PERSON, "read_by");
 			
 			/* TODO: currently ignoring date on relations
+            // CODEX -> owner_by (manyToMany) -> PERSON
+            this.entity.removeAllSourceRelationsByName(owned_by);
+            
+            // CODEX -> read_by (manyToMany) -> PERSON
+            this.entity.removeAllSourceRelationsByName("read_by");
+            
 			for (Entity owner : this.ownedByPeople.getEntities()) {
 				if (owner.isLightweight()) {
 					owner = getWrapper().getEntityByIdWithContent(owner.getId());
@@ -279,6 +287,11 @@
 			}
 			*/
 
+			//REFERENCE -> is_reference_of -> THIS
+            //this.entity = this.prepareReferencesToSave(this.entity);
+            this.saveReferences();      
+
+
 			// save this entity
 			this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), editCodexIntent);
 			
@@ -356,7 +369,21 @@
 		}
 	}
 	
-	public EntityList getOwnedByPeople() {
+	/**
+     * @return the aliasIdList
+     */
+    public EntityList getAliasIdList() {
+        return aliasIdList;
+    }
+
+    /**
+     * @param aliasIdList the aliasIdList to set
+     */
+    public void setAliasIdList(EntityList aliasIdList) {
+        this.aliasIdList = aliasIdList;
+    }
+
+    public EntityList getOwnedByPeople() {
 		return ownedByPeople;
 	}
 
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java	Fri Apr 13 12:58:36 2018 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java	Thu Apr 19 20:35:12 2018 +0200
@@ -90,6 +90,7 @@
 	private boolean renderShowAllCodexCandidates = false;
 	//private Entity witness_old;
 	
+    private EntityList aliasIdList;
 	private String newIdentifier;
 
 	//private IslamicCalendar islamicCalCopyDate;
@@ -114,7 +115,7 @@
 					"was_copied_in", "was_copied_in_as", "had_patron", "was_studied_by",
 					"has_author_written_as", "has_title_written_as"},
 			// target relations
-			new String[] {"is_reference_of"});
+			new String[] {"is_reference_of", is_alias_identifier_of});
 
 	public CurrentWitnessBean() {
 		super();
@@ -188,7 +189,9 @@
 		this.createCodexRendered = false;
 		this.renderShowAllCodexCandidates = false;
 		
-		this.newIdentifier = "";
+        this.aliasIdList = new EntityList(ALIAS, "alias", getWrapper(), getUserName());
+
+        this.newIdentifier = "";
 		
 		//this.islamicCalCopyDate = new IslamicCalendar();
 		this.copyDate = new Calendar();
@@ -245,6 +248,8 @@
 			// WITNESS -> had_patron -> PERSON
 			this.entity.replaceUniqueSourceRelation(this.patronageLo.entity, PERSON, rel_had_patron);
 			
+            // ALIAS -> is_identifier_of -> CODEX
+            replaceMultipleTargetRelations(entity, aliasIdList.getEntities(), ALIAS, is_alias_identifier_of);
 			
 			/*
 			 * save misidentifications
@@ -528,7 +533,13 @@
 				}
 			}
 			
-			//this.loadReferences(this.entity);
+			// ALIAS is_alias_identifier_of WITNESS
+            for(Relation rel : getWrapper().getTargetRelations(witness, is_alias_identifier_of, ALIAS, -1)) {
+                Entity alias = getWrapper().getEntityById(rel.getSourceId());
+                this.aliasIdList.add(alias);
+            }
+
+            //this.loadReferences(this.entity);
 			this.loadEndNoteRefs();
 
 			this.setCurrentId(this.entity.getId().toString());
@@ -1131,6 +1142,20 @@
 	public void setMisidentTable(MisidentificationTable misidentTable) {
 		this.misidentTable = misidentTable;
 	}
+
+    /**
+     * @return the aliasIdList
+     */
+    public EntityList getAliasIdList() {
+        return aliasIdList;
+    }
+
+    /**
+     * @param aliasIdList the aliasIdList to set
+     */
+    public void setAliasIdList(EntityList aliasIdList) {
+        this.aliasIdList = aliasIdList;
+    }
 	
 }
 
--- a/src/main/webapp/entry/codex.xhtml	Fri Apr 13 12:58:36 2018 +0200
+++ b/src/main/webapp/entry/codex.xhtml	Thu Apr 19 20:35:12 2018 +0200
@@ -104,6 +104,35 @@
 			<h:outputText />
 			<h:outputText />
 
+            <h:outputText value="Alias Identifiers" />
+            <h:panelGrid columns="1">
+                <h:panelGrid columns="2">
+                    <h:dataTable value="#{CurrentCodex.aliasIdList.entities}" var="item"
+                        rendered="#{!empty CurrentCodex.aliasIdList.entities}">
+                        <h:column>
+                            <h:outputText value="#{item.ownValue}" />
+                        </h:column>
+                        <h:column>
+                            <h:selectBooleanCheckbox
+                                value="#{CurrentCodex.aliasIdList.selections[item.id]}" />
+                        </h:column>
+                    </h:dataTable>
+                    <h:commandButton value="Remove Selected"
+                        actionListener="#{CurrentCodex.aliasIdList.listenerRemoveSelection}"
+                        rendered="#{!empty CurrentCodex.aliasIdList.entities}" />
+                </h:panelGrid>
+
+                <h:panelGrid columns="2">
+                    <h:inputText value="#{CurrentCodex.aliasIdList.input}" size="80"/>
+                    <h:commandButton value="CREATE"
+                        actionListener="#{CurrentCodex.aliasIdList.listenerCreate}" />
+                </h:panelGrid>
+            </h:panelGrid>
+            <h:outputText value="Use schema 'catalogname: identifier', e.g. 'Ahlward: 7653'." />
+            <h:outputText />
+
+
+
 		</h:panelGrid>
 
 		<h:panelGrid columns="2" styleClass="createPanel"
--- a/src/main/webapp/entry/witness.xhtml	Fri Apr 13 12:58:36 2018 +0200
+++ b/src/main/webapp/entry/witness.xhtml	Thu Apr 19 20:35:12 2018 +0200
@@ -123,12 +123,39 @@
 		</h:panelGrid>
 
 
-		<h:panelGrid columns="2" styleClass="createPanel"
+		<h:panelGrid columns="3" styleClass="createPanel"
 			columnClasses="createPanelFirstColumn,createPanelColumn02">
 
-			<h:outputText value="Ahlwardt No." />
+            <h:outputText value="Alias Catalog Identifiers" />
+            <h:panelGrid columns="1">
+                <h:panelGrid columns="2">
+                    <h:dataTable value="#{CurrentWitness.aliasIdList.entities}" var="item"
+                        rendered="#{!empty CurrentWitness.aliasIdList.entities}">
+                        <h:column>
+                            <h:outputText value="#{item.ownValue}" />
+                        </h:column>
+                        <h:column>
+                            <h:selectBooleanCheckbox
+                                value="#{CurrentWitness.aliasIdList.selections[item.id]}" />
+                        </h:column>
+                    </h:dataTable>
+                    <h:commandButton value="Remove Selected"
+                        actionListener="#{CurrentWitness.aliasIdList.listenerRemoveSelection}"
+                        rendered="#{!empty CurrentWitness.aliasIdList.entities}" />
+                </h:panelGrid>
+
+                <h:panelGrid columns="2">
+                    <h:inputText value="#{CurrentWitness.aliasIdList.input}" size="80"/>
+                    <h:commandButton value="CREATE"
+                        actionListener="#{CurrentWitness.aliasIdList.listenerCreate}" />
+                </h:panelGrid>
+            </h:panelGrid>
+            <h:outputText value="Use schema 'catalogname: identifier', e.g. 'Ahlward: 7653'." />
+
+			<h:outputText value="Ahlwardt No. (deprecated)" />
 			<h:inputText value="#{CurrentWitness.attributes['ahlwardt_no']}"
 				style="width: 300px;" />
+            <h:outputText />
 		</h:panelGrid>