diff src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java @ 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 1c09041f1182
children c9347929be25
line wrap: on
line diff
--- 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;
+    }
 	
 }