changeset 8:54c1bb63a713

(none)
author jurzua
date Thu, 30 Oct 2014 12:50:33 +0000
parents 764f47286679
children e07a1ae515b7
files src/main/java/de/mpiwg/itgroup/ismi/publicView/pages/JSPDynamicPage.java src/main/java/de/mpiwg/itgroup/ismi/utils/templates/TitleTemplate.java src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java src/main/resources/hibernate.cfg.xml src/main/webapp/imageServer/resources/js/diva4ismi.js src/main/webapp/public/publicWitness.jsp
diffstat 6 files changed, 62 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/publicView/pages/JSPDynamicPage.java	Wed Oct 29 14:28:34 2014 +0000
+++ b/src/main/java/de/mpiwg/itgroup/ismi/publicView/pages/JSPDynamicPage.java	Thu Oct 30 12:50:33 2014 +0000
@@ -9,6 +9,7 @@
 import org.mpi.openmind.repository.bo.ViewerAttribute;
 import org.mpi.openmind.repository.bo.ViewerPage;
 import org.mpi.openmind.repository.utils.OMUtils;
+import org.mpi.openmind.repository.utils.RomanizationLoC;
 
 import de.mpiwg.itgroup.diva.jsp.AbsJSPWrapper;
 
@@ -58,7 +59,7 @@
 						if(att.getDisplayMode() != ViewerAttribute.HIDE){
 							this.attMapTextAlign.put(att.getLabel(), att.getTextAlign());
 							List<String> values = OMUtils.resolveQuery(currentEntId, att.getQuery(), getWrapper(), att.getContentType());
-							
+							values = romanizeList(values);
 							if(values.size() > 0 || att.getDisplayMode() == ViewerAttribute.SHOW_ALWAYS){
 								this.attMap.put(att.getLabel(), values);
 								this.labelList.add(att.getLabel());	
@@ -73,6 +74,14 @@
 		}
 		System.out.println("");
 	}
+	
+	public List<String> romanizeList(List<String> list){
+		List<String> rs = new ArrayList<String>();
+		for(String s : list){
+			rs.add(RomanizationLoC.convert(s));
+		}
+		return rs;
+	}
 
 	public Long getCurrentEntId() {
 		return currentEntId;
--- a/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/TitleTemplate.java	Wed Oct 29 14:28:34 2014 +0000
+++ b/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/TitleTemplate.java	Thu Oct 30 12:50:33 2014 +0000
@@ -54,52 +54,45 @@
 			
 			this.privacity = entity.getPrivacity();
 			
-			//attributes
-			Attribute att = om.getAttributeByName(entity.getId(), "full_title");
-			this.fullTitle = (att != null) ? att.getOwnValue() : null;
-			this.fullTitle = (useRomanization) ? RomanizationLoC.convert(fullTitle) : fullTitle;
+			Attribute att = null;
+			Long entId = entity.getId();
 			
-			att = om.getAttributeByName(entity.getId(), "full_title_translit");
-			this.fullTitleTranslit = (att != null) ? att.getOwnValue() : null;
-			this.fullTitleTranslit = (useRomanization) ? RomanizationLoC.convert(fullTitleTranslit) : fullTitleTranslit;
+			//attributes
+			this.fullTitle = om.getAttributeOVByName(entId, "full_title", useRomanization);
 			
-			att = om.getAttributeByName(entity.getId(), "creation_date");
+			this.fullTitleTranslit = om.getAttributeOVByName(entId, "full_title_translit", useRomanization);
+			
+			att = om.getAttributeByName(entId, "creation_date");
 			if(att != null){
 				Calendar creationDate = new Calendar(att.getOwnValue());
 				this.creationDate = creationDate.getCalendarAsHtml();
 			}
 			
-			att = om.getAttributeByName(entity.getId(), "language");
-			this.language = (att != null) ? att.getOwnValue() : null;
+			this.language = om.getAttributeOVByName(entId, "language", useRomanization);
+			
+			this.notes = om.getAttributeOVByName(entId, "notes", useRomanization);
 			
-			att = om.getAttributeByName(entity.getId(), "notes");
-			this.notes = (att != null) ? att.getOwnValue() : null;
+			this.incipit = om.getAttributeOVByName(entId, "incipit", useRomanization);
 			
-			att = om.getAttributeByName(entity.getId(), "incipit");
-			this.incipit  = (att != null) ? att.getOwnValue() : null;
+			this.explicit = om.getAttributeOVByName(entId, "explicit", useRomanization);
 			
-			att = om.getAttributeByName(entity.getId(), "explicit");
-			this.explicit = (att != null) ? att.getOwnValue() : null;
+			this.dedication = om.getAttributeOVByName(entId, "dedication", useRomanization);
 			
-			att = om.getAttributeByName(entity.getId(), "dedication");
-			this.dedication  = (att != null) ? att.getOwnValue() : null;
+			this.tableOfContents = om.getAttributeOVByName(entId, "table_of_contents", useRomanization);
 			
-			att = om.getAttributeByName(entity.getId(), "table_of_contents");
-			this.tableOfContents = (att != null) ? att.getOwnValue() : null;
-			
-			List<Entity> tarList =  om.getTargetsForSourceRelation(entity.getId(), "has_subject", "SUBJECT", 1);
-			this.category = (tarList.size() > 0) ? tarList.get(0).getOwnValue() : null ; 
+			List<Entity> tarList =  om.getTargetsForSourceRelation(entId, "has_subject", "SUBJECT", 1);
+			this.category = (tarList.size() > 0) ? tarList.get(0).getOwnValue() : null ;
+			this.category = (useRomanization) ? RomanizationLoC.convert(category) : category;
 			
 			tarList =  om.getTargetsForSourceRelation(entity.getId(), "was_created_in", "PLACE", 1);
 			this.createIn = (tarList.size() > 0) ? tarList.get(0).getOwnValue() : null ;
+			this.createIn = (useRomanization) ? RomanizationLoC.convert(createIn) : createIn;
 			
 			List<Entity> list0 = om.getSourcesForTargetRelation(entity.getId(), "is_reference_of", "REFERENCE", -1);
 			for(Entity ref : list0){
 				this.refEntityList.add(om.getEntityContent(ref));
 			}
 			
-			
-			
 			list0 = om.getTargetsForSourceRelation(entity.getId(), "was_created_by", "PERSON", -1);
 			if(list0.size() > 0){
 				this.author = list0.get(0).getOwnValue();
@@ -111,7 +104,8 @@
 			
 			list0 = om.getSourcesForTargetRelation(entity, "is_alias_title_of", "ALIAS", -1);
 			for(Entity alias : list0){
-				this.aliasList.add(alias.getOwnValue());
+				String alias0 = (useRomanization) ? RomanizationLoC.convert(alias.getOwnValue()) : alias.getOwnValue();
+				this.aliasList.add(alias0);
 			}
 			
 			list0 = om.getTargetsForSourceRelation(entity, "has_author_misattribution", "MISATTRIBUTION", -1);
--- a/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java	Wed Oct 29 14:28:34 2014 +0000
+++ b/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java	Thu Oct 30 12:50:33 2014 +0000
@@ -12,7 +12,6 @@
 import org.mpi.openmind.repository.bo.Attribute;
 import org.mpi.openmind.repository.bo.Entity;
 import org.mpi.openmind.repository.bo.Relation;
-import org.mpi.openmind.repository.services.PersistenceService;
 import org.mpi.openmind.repository.utils.RomanizationLoC;
 
 import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean;
@@ -111,83 +110,35 @@
 					this.status = witness.getStatus();
 				}
 
-				Attribute att0 = om.getAttributeByName(witness.getId(), "start_page");
-				this.startPage = (att0 != null) ? att0.getValue() : null;
-
-				att0 = om.getAttributeByName(witness.getId(),
-						"end_page");
-				this.endPage = (att0 != null) ? att0.getValue() : null;
 				
-				att0 = om.getAttributeByName(witness.getId(),
-						"folios");
-				this.folios = (att0 != null) ? att0.getValue() : null;
-
-				att0 = om.getAttributeByName(witness.getId(),
-						"ahlwardt_no");
-				this.ahlwardtNo = (att0 != null) ? att0.getValue() : null;
-				
-				att0 = om.getAttributeByName(witness.getId(), "colophon");
-				this.colophon = (att0 != null) ? att0.getValue() : null;
+				this.startPage = om.getAttributeOVByName(id, "start_page", false);
+				this.endPage = om.getAttributeOVByName(id, "end_page", false);
 				
-				att0 = om.getAttributeByName(witness.getId(), "page_dimensions");
-				this.page_dimensions = (att0 != null) ? att0.getValue() : null;
-				
-				att0 = om.getAttributeByName(witness.getId(), "written_area_dimensions");
-				this.written_area_dimensions = (att0 != null) ? att0.getValue() : null;
-				
-				att0 = om.getAttributeByName(witness.getId(), "lines_per_page");
-				this.lines_per_page = (att0 != null) ? att0.getValue() : null;
+
+				this.folios = om.getAttributeOVByName(id, "folios", useRomanization);
+				this.ahlwardtNo = om.getAttributeOVByName(id, "ahlwardt_no", useRomanization);
+				this.colophon = om.getAttributeOVByName(id, "colophon", useRomanization);
+				this.page_dimensions = om.getAttributeOVByName(id, "page_dimensions", useRomanization);
+				this.written_area_dimensions = om.getAttributeOVByName(id, "written_area_dimensions", useRomanization);
+				this.lines_per_page = om.getAttributeOVByName(id, "lines_per_page", useRomanization);
+				this.page_layout = om.getAttributeOVByName(id, "page_layout", useRomanization);
+				this.script = om.getAttributeOVByName(id, "script", useRomanization);
+				this.writing_surface = om.getAttributeOVByName(id, "writing_surface", useRomanization);
 				
-				att0 = om.getAttributeByName(witness.getId(), "page_layout");
-				this.page_layout = (att0 != null) ? att0.getValue() : null;
-				
-				att0 = om.getAttributeByName(witness.getId(), "script");
-				this.script = (att0 != null) ? att0.getValue() : null;
-				
-				att0 = om.getAttributeByName(witness.getId(), "writing_surface");
-				this.writing_surface = (att0 != null) ? att0.getValue() : null;
-				
-				att0 = om.getAttributeByName(witness.getId(), "creation_date");
+				Attribute att0 = om.getAttributeByName(witness.getId(), "creation_date");
 				Calendar creationDate0 = AbstractISMIBean.updateCalendar(att0);
 				this.creationDate = creationDate0.getCalendarAsHtml();
 				
 				if(extended){
-					Attribute incipit = om.getAttributeByName(witness.getId(),
-							"incipit");
-					this.incipit = (incipit != null) ? incipit.getValue() : null;
-	
-					Attribute explicit = om.getAttributeByName(witness.getId(),
-							"explicit");
-					this.explicit = (explicit != null) ? explicit.getValue() : null;
+					this.incipit = om.getAttributeOVByName(id, "incipit", useRomanization);
+					this.explicit = om.getAttributeOVByName(id, "explicit", useRomanization);
 				}
 				
-				Attribute table_of_contents = om.getAttributeByName(
-						witness.getId(), "table_of_contents");
-				this.tableOfContents = (table_of_contents != null) ? table_of_contents
-						.getValue() : null;
-
-				Attribute notes_on_title_author = om.getAttributeByName(
-						witness.getId(), "notes_on_title_author");
-				if (notes_on_title_author != null) {
-					this.notesOnTitleAuthor = notes_on_title_author.getValue();
-				}
-
-				Attribute notes_on_collation_and_corrections = om
-						.getAttributeByName(witness.getId(),
-								"notes_on_collation_and_corrections");
-				if (notes_on_collation_and_corrections != null) {
-					this.notesOnCollationAndCorrections = notes_on_collation_and_corrections
-							.getValue();
-				}
-
-				Attribute notes_on_ownership = om.getAttributeByName(
-						witness.getId(), "notes_on_ownership");
-				if (notes_on_ownership != null) {
-					this.notesOnOwnership = notes_on_ownership.getValue();
-				}
-
-				att0 = om.getAttributeByName(witness.getId(), "notes");
-				this.notes = (att0 != null) ? att0.getValue() : null;
+				this.tableOfContents = om.getAttributeOVByName(id, "table_of_contents", useRomanization);				
+				this.notesOnTitleAuthor = om.getAttributeOVByName(id, "notes_on_title_author", useRomanization);
+				this.notesOnCollationAndCorrections = om.getAttributeOVByName(id, "notes_on_collation_and_corrections", useRomanization);
+				this.notesOnOwnership = om.getAttributeOVByName(id, "notes_on_ownership", useRomanization);
+				this.notes = om.getAttributeOVByName(id, "notes", useRomanization);
 
 				List<Entity> list0 = om.getTargetsForSourceRelation(witness.getId(), "is_exemplar_of", "TEXT", 1);
 				if (list0.size() > 0) {
@@ -218,6 +169,7 @@
 						//Attribute subject = om.getAttributeByName(witness.getId(), "subject");
 						list0 = om.getTargetsForSourceRelation(this.titleId, "has_subject", "SUBJECT", 1);
 						this.subject = (!list0.isEmpty()) ? list0.get(0).getOwnValue() : null;
+						this.subject = (useRomanization) ? RomanizationLoC.convert(subject) : subject;
 						
 					}
 				}
@@ -246,8 +198,9 @@
 					this.wasStudiedByList.add((useRomanization) ? RomanizationLoC.convert(ent.getOwnValue()) : ent.getOwnValue());
 				}
 				
-				List<Entity> list = om.getTargetsForSourceRelation(
-						witness.getId(), "is_part_of", "CODEX", 1);
+				//**** Getting the Codices
+				List<Entity> list = 
+						om.getTargetsForSourceRelation(witness.getId(), "is_part_of", "CODEX", 1);
 				if (list.size() > 0) {
 					Entity codex = list.get(0);
 
@@ -257,12 +210,11 @@
 						this.codex = att.getValue();
 					}
 
-					for (Relation rel : om.getSourceRelations(codex,
-							"owned_by", "PERSON", -1)) {
+					for (Relation rel : om.getSourceRelations(codex, "owned_by", "PERSON", -1)) {
 						String date = (rel.getAttributeByName("date") != null) ? new Calendar(
 								rel.getAttributeByName("date").getOwnValue())
 								.getCalendarAsHtml() : "";
-							String ov = om.getEntityById(rel.getTargetId()).getOwnValue(); 
+						String ov = om.getEntityById(rel.getTargetId()).getOwnValue(); 
 						String ownedLabel = (useRomanization) ? RomanizationLoC.convert(ov) : ov; 
 						this.ownedByMap.put(ownedLabel, date);
 					}
@@ -371,10 +323,6 @@
 		return country;
 	}
 
-	/*
-	 * public List<String> getReferenceList() { return referenceList; }
-	 */
-
 	public Map<String, String> getOwnedByMap() {
 		return ownedByMap;
 	}
--- a/src/main/resources/hibernate.cfg.xml	Wed Oct 29 14:28:34 2014 +0000
+++ b/src/main/resources/hibernate.cfg.xml	Thu Oct 30 12:50:33 2014 +0000
@@ -22,7 +22,7 @@
 		<property name="hibernate.connection.url">jdbc:mysql://localhost/openmind?characterEncoding=UTF-8</property>
         <property name="hibernate.connection.charSet">UTF-8</property>  
         <property name="hibernate.connection.username">root</property>
-        <property name="hibernate.connection.password">e1nste1n</property>   
+        <property name="hibernate.connection.password">admin</property>   
                  
 		<!--
 		<property name="hibernate.connection.username">ismi</property>
--- a/src/main/webapp/imageServer/resources/js/diva4ismi.js	Wed Oct 29 14:28:34 2014 +0000
+++ b/src/main/webapp/imageServer/resources/js/diva4ismi.js	Thu Oct 30 12:50:33 2014 +0000
@@ -1,7 +1,7 @@
 var divaGlobal = {
-		//rest_url : "http://localhost:8080/ismi-richfaces",
+		rest_url : "http://localhost:8080/ismi-richfaces",
 		debugModus : false,
-		rest_url : "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi",
+		//rest_url : "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi",
 		iipServerURL: "https://images.rasi.mcgill.ca/fcgi-bin/iipsrv.fcgi"
 }
 
@@ -31,7 +31,7 @@
     		$('#title-details-show-more').attr('data-title-id', titleId);
     		$('#title-details-show-less').attr('data-title-id', titleId);
 			
-			var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_title_details&id=' + titleId;
+			var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_title_details&include_romanization=true&id=' + titleId;
     		
 			console.log(jsonRequest);
 			
@@ -64,7 +64,7 @@
     		$('#witness-details-show-more').attr('data-witness-id', witnessId);
     		$('#witness-details-show-less').attr('data-witness-id', witnessId);
 			
-			var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_witness_details&id=' + witnessId;
+			var jsonRequest = divaGlobal.rest_url + '/jsonInterface?method=get_witness_details&include_romanization=true&id=' + witnessId;
     		
 			console.log(jsonRequest);
 			
--- a/src/main/webapp/public/publicWitness.jsp	Wed Oct 29 14:28:34 2014 +0000
+++ b/src/main/webapp/public/publicWitness.jsp	Thu Oct 30 12:50:33 2014 +0000
@@ -6,7 +6,7 @@
 
 <html>
 	<head>
-		<title>Codex Details</title>
+		<title>Witness Details</title>
 		
 		<link href="../imageServer/resources/css/diva4ismi.css" type="text/css" rel="stylesheet" />
 		<link href="../imageServer/resources/css/bootstrap.css" type="text/css" rel="stylesheet" />